LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   dhcp and multiple machines (https://www.linuxquestions.org/questions/linux-networking-3/dhcp-and-multiple-machines-193964/)

xthel 06-15-2004 07:57 PM

dhcp and multiple machines
 
I have just moved to Linux and have set up a small home network of 5 machines. All machines receive IP addresses from a (non-linux) DHCP server. This works fine as far as it goes.

However, if the power fails or machines reboot, they all come back up with different IP addresses, and this begins my infuriating time. It seems that the IP addresses of the other machines on the local network are stored in various places in the filesystems - not only /etc/hosts, but other places such as ssh configuration files and so forth. This all breaks when the machines reboot! I end up spending an hour hunting down all the places I have to update the new set of IP addreses.

Is there some way I can configure my machines so that when they come back up with different IPs, they keep working fine (as they used to do under 'doze)?

It's fine to point me at a FAQ - although so far all the googling I've done has only pointed me to info on either (1) setting up a Linux DHCP server, or (2) configuring a single machine to get its IP from DHCP, neither of which is my problem.

Thanks,

xthel

xthel 06-15-2004 08:02 PM

I should also mention: this is mandrake 9.2, boxed set with latest patches.

AltF4 06-15-2004 08:16 PM

To solver your problem you might want to
a) instruct your dhcp server to give out static ip addresses based on NIC hardware address (simple)
b) set up your a private dns server with dynamic updates allowed (more comlicated)

windows does not need this because it tries to resolve local ip addresses by "asking" for the hostname/ip info on the LAN (google for "broadcast name resolution")

xthel 06-15-2004 08:44 PM

Quote:

Originally posted by AltF4

a) instruct your dhcp server to give out static ip addresses based on NIC hardware address (simple)
b) set up your a private dns server with dynamic updates allowed (more comlicated)

Thanks for the reply. Alas, my DHCP server is a dumb linksys consumer hardware thing, and I'm not sure it supports static IP address assignment based on MAC addrss. At least, I haven't found a way to do it. I can see the mapping table of MACs to IPs, but that's it.

I'd rather not go through the bother of running a local DNS either. Am I then out of luck?

xthel

xthel 06-15-2004 09:32 PM

Hmm, I have just discovered that nmblookup works fine to come up with the IP addresses. If only I had a way to make that happen by default when gethostbyname() is called! Would solve my problem handily, I think.

xthel 06-15-2004 10:00 PM

nsswitch.conf
 
Ok, I hate to follow up to my own post too many times in a row, but I have found /etc/nsswitch.conf, which appears to let me specify wins for name resolution. It seems to pretty much do what I want.

My only concerns now are:

(1) It takes a lot of extra time to open windows in X, presumably due to an initial gethostbyname call having to go out to the network. I can fix this by adding each hostname to /etc/hosts pointing to 127.0.0.1, but then I can't sync my /etc/hosts files between all my machines (since they'd all be different).

(2) I'm still worried that ssh will misbehave, since it seems to stick hostnames in its config files by itself. They'll become wrong after the next reboot, and this seems to cause complaints about "man in the middle" attacks from ssh.

Sorry for my newbiness!

jschiwal 06-16-2004 07:07 AM

Do you have a BEFSR41 or similar linksys router/switch? If so, you can set the starting IP address. The default is 192.168.1.100, so you don't even need to change it. Just give your computers IP address below this one with static configurations.

xthel 06-16-2004 08:32 PM

Quote:

Originally posted by jschiwal
Do you have a BEFSR41 or similar linksys router/switch? If so, you can set the starting IP address.
Yeah. I know I can use static IPs - was just hoping not to.

I have successfully got most things working with WINS. However, alas, emacs seems to segfault when I start it that way. Most other things are OK (gnome, at least). Ssh still embeds fixed IPs, which I wish I could make it stop doing.

IMHO, this is an area that could stand a bit of improvement.


All times are GMT -5. The time now is 04:58 PM.