Adding Static Hosts to dhcp

You have some servers or other machines to which you want to assign static IP addresses. You can use /etc/hosts, but it’s a bit of bother to edit /etc/hosts on each of the zillion PCs you’re responsible for. Can you do it in dhcpd.conf?

Yes, you surely can. You’ll need the MAC address of your network card, which you can find with ifconfig:

$ /sbin/ifconfigeth0      Link encap:Ethernet  HWaddr 00:03:6D:00:83:CF

inet addr:  Bcast:  Mask:



You want the HWaddr value.

On Windows 95/98/ME, open a DOS prompt and run winipcfg. On NT/2000/XP, run ipconfig.

Make an entry in dhcpd.conf like this:

host mail1 {   hardware ethernet 00:03:6D:00:83:CF;



Note that multiple-line directives must be enclosed in curly braces.

Name servers have their own directive in dhcpd.conf, so they don’t need MAC addresses:

option domain-name-servers,

That’s all there is to it. Use this for any machine you wish to have a static IP address.

You can still use /etc/hosts for important servers, as a fallback for local users. Remember, with /etc/hosts the network does not break when a single server goes down.

Every network card ever made has a unique 48-bit Media Access Control (MAC address). The Institute of Electrical and Electronics Engineers, Inc. (IEEE) assigns the first 24 bits, then the manufacturer assigns the remaining 24 bits.