Linux Hostname on LAN

Ok I have finally gotten my new Linux server up and running on my LAN and I am using a Linksys router. I am new to this eth0/loopback thing (why the heck do you need an adaptor called loopback? What does it do? Ok my real question though is: my computers can each access the internet through my router but they can't see each other and my router config page shows that my linux box does not have a hostname. I am thinking that could be why they can't see each other but I don't know how to give my linux box a hostname without messing up the protocols. It is listed as localhost.localdomain right now, but if I change that to a name I make up for it, it goves me errors on boot up (though it still reaches the internet, thank goodness). Where do I set the hostname?

Ok here's the update: I found some instructions that said to edit /etc/sysconfig/network and type $hostname <myhostname>, which makes sense blah blah blah but my dhcp client table on my router config still does not show a hostname for the linux box IP. Additionally, I can ping the linux box IP from the xp machine by IP address but not by hostname.<P ID="edit"><FONT SIZE=-1><EM>Edited by CatherineStevens on 06/20/02 03:41 PM.</EM></FONT></P>
14 answers Last reply
More about linux hostname
  1. Okay, gonna need some more info here. I may be able to help, but poorboy is the on you really want to talk to. First of all, how are all your computers connected? Do you have internet -> linksys router -> linux server and XP box, or internet -> linksys router -> linux server -> XP box?

    If the former, then it's not a linux thing, it's a linksys thing. If the latter, then we'll have to do some figuring. Also, do you have samba up and running? They computers should be able to see each other without any trouble even if you don't, but accessing files may be another issue.

    If my baby don't love me, I know, I know, her sister will.
  2. Thanks for the vote of confidence silverpig

    The DHCP server running on the router should ideally set up the host ip and name for both boxes, but I don't think the Linksys routers do that - they just assign an IP address. If /etc/hosts is set up ok, I guess Linux should "know" its name from that, but a local lan DNS server (with reverse zones) is the real solution.

    You may get away with just editing the host files on both machines, which is kinda ok for just two boxes.

    edit: I think that when samba is up and running, windows will "see" the linux box, and map its windows name to ip address. this might be a better thing to try first before getting into dns servers (and probably linux based dhcp servers too)

    <i>Do I look like I care?</i><P ID="edit"><FONT SIZE=-1><EM>Edited by poorboy on 06/22/02 03:44 AM.</EM></FONT></P>
  3. Ok it goes:

    DSL modem -> Linksys DSL Router -> both machines (XP and Linux)

    basically the two machines are in parallel.
    Yes, seeing files on each one is important to me but right now I just want to view my Linux box's web page from my XP machine, so I need to be able to browse it by hostname. I type in the IP adress of the linux box and get nothing (though I can ping it by IP), even though I can ping it, so EITHER it is a router thing or my apache is not set up right. So basically I need to browse the linux box from my XP machine for diagnostic purposes.
  4. Thanks for the help 8-) I really appreciate it. So samba will do it huh? Ok two things: first of all, I think I may NOT have my hosts file set up correctly. I'll show you what I mean:

    hostname=ibn *******************************
    gateway= *************************

    ____________ localhost.localdomain localhost ibn.localdomain ibn ************

    all say the same thing:
    netmask= ***********************

    The lines with *'s are the ones I added.

    Also, I can't get samba set up. But let's attack one problem at a time, I guess. Remember, I
    m a newbie! 8-)) THANKS.
  5. Ok here's the samba thing: I DON'T KNOW HOW IT WORKS.

    8-) haha. pretty blatant, huh? 8-)

    I don't know whether I installed it during OS install or not, and I haven't been able to find any good directions out there on it. All the places I look, the instructions I find either include rpms that give me errors when I run them, or are incomplete. If I already have samba installed, how do I start it?
  6. OK, now I know what the aim is, we can get stuff working. We'll hold off from using Samba just yet - all we need is to get IP addresses and names resolving correctly.

    There's just two machines invloved right? A Linux based DNS server and DHCP server is probably overkill. So we should set them up with static IP addresses, and then add entries into each machines hosts file.

    /etc/hosts looks ok, but would want a line like: xp.localdomain xp
    to locate the windows machine (change it to suit your setup).

    You should then be able to type:
    $ ping xp
    and get a response.

    Add lines for the machines into the file
    so that windows can locate the linux box.

    The /etc/sysconfig/network-scripts/ifcfg-eth0 file should be something like this.

    You may need to edit /etc/resolv.conf and enter your dns server number into it:

    nameserver 203.97.xx.xx
    nameserver 203.97.xx.xx

    I'll leave the Windows setup to you, 'cos I'm no good at drawing gui's in ascii art :-) Then you can turn of the DHCP server on the router.

    That should be enough to get basic ip->name->ip stuff working. We can look at Samba once this is working.

    <i>Do I look like I care?</i>
  7. Well I really did want the DHCP server on the router to recognize my linux box with a hostname and not have to give all the machines a static IP. I guess one advantage to doing that though would be that redirecting calls to the web page through the router to the linux box will be easier, even if it gets rebooted accidentally and picks up a different IP. Ok lemme try this and get back t'ya. THANKS.
  8. Oh and I really should tell you - I have 4 machines now. Linux, XP, two 98's. Still think static is the way to go?

    PS - I was researching samba and it seems it is not only for printing. It seems maybe samba can resolve the whole "seeing other" despite different operating systems stuff. Right?
    <P ID="edit"><FONT SIZE=-1><EM>Edited by catherinestevens on 06/26/02 07:27 PM.</EM></FONT></P>
  9. Re Samba, yes it will let you all "see" each other, print and share files, but remember that it runs over IP, so you'll need to get that sorted first (and for web browsing etc)

    I think the scales have tipped the other way now. Dynamic is nice, but only because it lets you "admin" a single box. Realistically, this means using the Linux box as the DHCP server, and as the DNS server. While you're at it, you might as well set up a squid web-proxy (speedy internet) and firewall (safer internet).

    The reason for using the Linux box is because it lets you setup lots more things (like hostnames) and it lets you assign IP addresses to Network Card MAC addresses - which means that machines won't accidentally get the "wrong" IP address after a reboot, and your IPs will point to the correct names (and vice-versa).

    Where to start?

    You'll need the dhcpd package first, and then the bind and bind-utils packages for letting names resolve on your lan.

    dhcpd is a doddle to set up. The man page should tell you all you need to know. bind is a bit more fiddly. I'll post some examples once I get home and have access to my server.

    <i>Do I look like I care?</i>
  10. I had the same problem. I had to edit dhclient.conf to add the line

    send host-name "myhost"

    and remove host-name from the request line.

    This way you can have all dynamic ip addresses.
  11. *shakes head at necro*
  12. 7 years???

    Man that's got to be up there as one of the best yet.
  13. Sweet Jesus Christ Almighty in Heaven! Why are people waking all of these long dead threads?

  14. audiovoodoo said:
    7 years???

    Man that's got to be up there as one of the best yet.

    I have seen a 2001 thread raised from the depths. They were talking about Durons IIRC.
Ask a new question

Read More

Routers Hostname Linux