dhcp and hostnames

dhcp and hostnames

Post by Mark » Wed, 12 Mar 2003 17:28:41



Hi,

I have a server at home which uses a dhcp server to assign IP addresses to
the other machines on the network. What I want now is that the server uses
the machine names to link their IP to their name. So when I do for instance
a ping to machineX, that the server which also has a DNS server, links the
machine with name machineX to its current IP address.

Is this possible and if so how?

Another question I have, is how can I make sure that the order a name or an
IP is resolved, is localhost before external DNS server? I know I can
specify it in resolv.conf, but every time I reconnect to internet, my
resolv.conf gets altered. Can anybody give me some pointers on what to
configure or anything to sort this.

Thanks in advance,
  Mark

 
 
 

dhcp and hostnames

Post by Robe » Fri, 14 Mar 2003 05:01:52


Hey Mark,
Hope this helps...

Quote:> I have a server at home which uses a dhcp server to assign IP addresses to
> the other machines on the network. What I want now is that the server uses
> the machine names to link their IP to their name. So when I do for instance
> a ping to machineX, that the server which also has a DNS server, links the
> machine with name machineX to its current IP address.

> Is this possible and if so how?

The way to do this is through MAC address - by supplying the DHCP server with
the mappings to the MAC address on the NIC of each machine. Use the ifconfig
command to get the MAC address of each NIC you want supplied a specific
IP address.  It will be listed under 'Hardware address', and be in hexadecimal
form (like 2B:AF:5F:C7:8D:6A).  It will bind them together so whenever a
machine with a MAC address listed in the config file sends a DHCP discover
packet, it will automatically give it the IP you specified rather than one from
the pool of IPs.  Check out this link to make the necessary changes to your
dhcpd.conf file (Im assuming youre using a linux box...)
http://www.tldp.org/HOWTO/mini/DHCP/x369.html#AEN403

Quote:

> Another question I have, is how can I make sure that the order a name or an
> IP is resolved, is localhost before external DNS server? I know I can
> specify it in resolv.conf, but every time I reconnect to internet, my
> resolv.conf gets altered. Can anybody give me some pointers on what to
> configure or anything to sort this.

> Thanks in advance,
>   Mark

You have to edit the /etc/nsswitch.conf file.  Change the line that starts with
hosts:
Change the order to 'files' before 'dns'.

Hope this helps...
Rob