Click to See Complete Forum and Search --> : naming Linux box so other computers can access by name
cmoller
09-08-2002, 05:30 PM
I've read everything I can find about hostname and I'm STILL confused. How come my router (Linksys Cable/DSL Router) shows that my windows box has a name but my Linux box doesn't? When I display the DHCP clients table on my router I see me windows box with the name I've given it (computer name in system settings) but my Linux box shows up blank.
I've set hostname for my Linux box in the following places;
edited /etc/HOSTNAME and added line below;
cdaweb
edited /etc/hosts and added line below;
127.0.0.1 cdaweb localhost.localdomain localhost cdaweb
executed hostname cdaweb
edited /etc/sysconfig/network andadded lines below;
HOSTNAME=cdaweb
DHCP_HOSTNAME=cdaweb
edited /etc/sysconfi/gnetwork and /etc/sysconfig/network and added lines below;
DHCP_HOSTNAME=cdaweb
* cdaweb is the name I want for my Linux box
That said, does it matter? I've been assuming if my router knows the name of my Linux box then I should be able to reach my Linux box by name from other computers on my home network, but, is that even true? Is the only way to access computers by name on a home network to either use /etc/hosts and assign static IPs (something I thought you weren't supposed to do with DHCP) or run an internal DNS Server?
I'd really appreciate it if someone could clear this up for me! I hope to eventually run my Linux box as a Web Server visible from outside my network, so I'd like to set it up in a way that would best suit that in the end.
Thanks!
Charlotte
I'm not sure why your hostname isn't recognized by the router, as you certainly seem to have entered the hostname in every conceivable way possible. Unfortunately, I'm not familiar enough with the Linksys to offer any suggestions there.
As for accessing the Linux box from other machines on your network goes, I assume the other machines are Windows boxen, yes? If so, you won't be able to much more that ping the Linux box from the Win machines unless you've set up Samba (http://www.samba.org) (or are running a Web, FTP, Mail, etc. server) on the Linux box. Even if the router recognized the Linux box's hostname, that wouldn't be enough to allow the other boxen to communicate with the Linux box.
If one of your goals is to have the Linux box accessible to the other machines in their Network Neighborhood/My Network Places, then you will definitely need to install Samba. Samba is the program that enables Linux to interface with a Windows SMB/CIFS network environment.
cmoller
09-08-2002, 10:36 PM
Thanks for the info re: Samba.
Should the router be able to handle a request i.e. ping <name> and resolve the name to the correct IP address or does it have to be in /etc/hosts or a local DNS Server? It puzzles me why, if the router knows the name/IP address, why it can't just resolve it itself. But maybe I'm missing the point.
Charlotte
cmoller
09-08-2002, 10:55 PM
I just noticed if I try ifdown eth0 and then ifup eth0, it comes back saying "Determining IP information for eth0... failed.". I never noticed this before since I can actually access the network (ping my Windows box by IP, browse the Internet). Does this message mean anything? How can I find out more about what causes the message?
Charlotte
Originally posted by cmoller
Thanks for the info re: Samba.
Should the router be able to handle a request i.e. ping <name> and resolve the name to the correct IP address or does it have to be in /etc/hosts or a local DNS Server? It puzzles me why, if the router knows the name/IP address, why it can't just resolve it itself.Unfortunately, it doesn't work that simply. The router would have to be able to act as a DNS server in order for it to do the resolution, and your Linux box would have to be told (via an entry in /etc/resolv.conf) that it should look to the router for answers when trying to resolve a name to an IP. For a small network, entering the IP/hostname info for all of the machines into /etc/hosts would be the way to go. For that matter, why bother with DHCP at all on a small network? It might be easier to just assign the machines static IP addresses.
As for the "Determining IP information for eth0... failed" message, that's what you get when your system thinks it can't/hasn't obtained its IP configuration from the DHCP server. Why you're suddenly getting this, but can still browse, I don't know. Do you see a similar error in the messages that scroll by at bootup?
It's 5AM in my end of the world, and although I do have some other ideas, I really need to sleep, so the rest will have to wait until I've had a few ZZZZZs...
cmoller
09-09-2002, 04:17 PM
Mmm, that makes sense... Actually, when I reboot my machine the eth0 comes up fine, it's just on the ifup, so, I don't really know what that means but it doesn't seem to affect anything, so maybe it's irrelevant?
Linux sure is great, though, I'm learning all kinds of stuff about networking I never really understood very well!
Char
Originally posted by cmoller
Linux sure is great, though, I'm learning all kinds of stuff about networking I never really understood very well!I've found the same to be true; I was never able to learn as much from working with Windows as I have from working with Linux.
However, regardless of what I have learned, I still have no idea why ifup/ifdown gives you the error even though the card boots up fine. I would say that if it functions properly otherwise, don't sweat it (or switch to static IPs if it bothers you).
:)
bcsmith100
09-12-2002, 12:23 PM
I am working on this same issue right now (see my post for where I stand). I have samba up and running and I can see window from my Linux box, but I can't see Linux from Windows.
I was not getting anywhere until I added a few lines in my /etc/hosts file:
I have the following:
127.0.0.1 localhost localhost
192.0.0.2 WinPC1
bcsmith100
09-12-2002, 12:28 PM
opps, I hit the wrong button while typing... anyway to continue:
I have the following in my /etc/hosts file
127.0.01 localhost localhost
192.168.0.2 WinPC1 WinPC1
192.168.0.3 WinPC2 WinPC2
192.168.0.4 dhcppc3 Linuxworkstation
When I added these additional lines I can now see my Linuxworkstation by name from my router (a NetGear). I can also ping my Linuxworkstation by IP address from Windows, but I can't ping my workstation by name.
From what I have been able to figure out so far SAMBA does not come into play until after I can get ping working... I am lucky to have Samba working in one direction, and I have the router seeing the name of the Linux workstation, but now I need to figure out what to do to get the windows boxes to see the Linux box by name...
By the way, I know that with DHCP I should not have to put the IP addresses in my /etc/hosts file...I tried this because I was running out of things to try and it partially worked, I have not figured out the long term "correct" way to get the router to see my Linux workstation by name.