[plug] Basic DHCP questions

Steege, Phil E phil.e.steege at lmco.com
Fri Jun 14 19:34:58 WST 2002


So they keep track of mac address/hostname pairs instead of ip/hostname
combinations as in /etc/hosts.
Thanks for the inputs.
Phil

-----Original Message-----
From: Colin Muller [mailto:colin at twobluedots.com.au] 
Sent: Thursday, June 13, 2002 9:20 PM
To: plug at plug.linux.org.au
Subject: Re: [plug] Basic DHCP questions


> My question is do I have to remove the hostname/ip addresses I have in 
> the /etc/hosts file, and change the /etc/nsswitch.conf to be "dns file 
> nis" instead of "files dns nis"?  How does dhcp or arp keep track of a 
> machine hostname to ip address connection, when the ip addresses can 
> change each time you reboot?  Is there a dhcp cache or config file 
> maintained by dhcp which assigns hostnames to mac addresses to keep it 
> all straight?

There are probably other and simpler ways, but I do this:

1. Run a domain name server on the DHCP server (192.168.1.1) which
  provides name-to-IP resolution for all machines on the LAN

2. In the relevant subnet section (in my case 192.168.1.0) of
  /etc/dhcpd.conf, put this line: 
  option domain-name-servers 192.168.1.1;

3. The group statement for the machines on the LAN goes like this:

group {
    use-host-decl-names on;
    host colinlabtop2 { 
	hardware ethernet 00:00:00:00:00:00;
	fixed-address colinlabtop2.homelan; 
    } 
    host joanibook { 
	hardware ethernet 00:000:00:00:00:00;
	fixed-address joanibook.homelan; 
    } 
    ... and so on, one host statement per machine on the LAN
 }

You replace the '00's in the ethernet lines with the real MAC numbers of the
ethernet cards on your LAN, which you can find when all machines are
connected by doing 'arp -a' on the server.

4. For good measure, make the hostnames of the machines on the LAN match
  the names in the host statements (here, colinlabtop2 and joanibook).

5. And for further good measure, I put into /etc/resolv.conf on each LAN
machine: nameserver 192.168.1.1

It's the colinlabtop2.homelan and joanibook.homelan addresses which you need
to have your DNS resolve to an IP; then DHCP will always give them the same
IP when a machine with the matching ethernet card connects and ask for an
IP. You won't need to change your /etc/hosts if the IPs in it match those
given by DNS.

['labtop' is an in-joke; it's not that I use the same spell-checker as James
and Tony :-)]

Colin




More information about the plug mailing list