Have Ubuntu Server hand out “static” or “fixed” addresses via DHCP

Nowadays, most local area networks have a DHCP server running on them. This is, of course, how hosts on the network are assigned their IP address and other stuff they need to know (router address, DNS servers, etc.).

The DHCP server has a pool of addresses that it is allowed to hand out to clients, and it will often hand out these addresses sequentially. In some cases, the address chosen for a particular client may be based on some sort of hash function on the client’s MAC address (so that the client will always be assigned the same address, unless there is a hash collision).

Of course, sometimes it’s nice to assign a particular device on your network a specific IP address (a “static” or “fixed” IP address). This way, you will always know without any doubt what the IP address or your printer or file server or whatever is. Of course, you can just set the address manually on the device, taking care to place it outside of the DHCP pool.

Another way to go about it is to reserve a specific IP address for your device on your DHCP server using the device’s physical (or “MAC”) address. This is handy if you have many devices that you would like to assign fixed addresses to – if, for whatever reason, you ever want to change the IP address of something on your network, you just make the change on the DHCP server and you do not have to bother touching the device itself. The change will take place the next time the device renews its DHCP lease.

Using the DHCP server included with Ubuntu Server, if you would like to assign a fixed address to a particular device, just add some lines like this to /etc/dhcp3/dhcpd.conf:

host aaron-vmware {
    hardware ethernet 00:0c:29:f8:47:3e;
    fixed-address 192.168.100.81;
}

Restart the DHCP server configuration using sudo service dhcp3-server restart and you’re all set.

3 thoughts on “Have Ubuntu Server hand out “static” or “fixed” addresses via DHCP”

  1. Just a an FYI on this, if you have not had the device with the mac address claim its IP it is fair game, do not include the address in your range for the DHCP server to ensure no one else gets it.

  2. Hii, Thanks for the sharing nice posting with us. i’m really impressed.
    Call Us at @0800-090-3905 for free avg, avg removal tool, avg security, avg support, avg uk, avg customer service, avg contact, avg phone number, avg contact number, avg help, contact avg, avg phone number uk.

Leave a Reply

Your email address will not be published. Required fields are marked *

*