If you are using ISC DHCP Server on either Debian or Ubuntu, you may have the need to setup static leases for network clients such as printers, switches, etc. If that is the case, then this article is for you. Below we will show you how to assign a static dhcp lease to any network client be serviced by your ISC DHCP server. First you will need to open the main DHCP configuration file /etc/dhcp/dhcpd.conf
. Once open, you will want to add the following code directly below your subnet declaration.
subnet 172.16.12.0 netmask 255.255.255.0 { range 172.16.12.10 172.16.12.50; option domain-name-servers 172.16.12.100; option dhcp-server-identifier 172.16.12.100; option netbios-name-servers 172.16.12.100; option broadcast-address 172.16.12.255; option ntp-servers 172.16.12.1; option routers 172.16.12.1; default-lease-time 21600; max-lease-time 43200; filename "gpxelinux.0"; } # Desktop Fixed Address host 81U1 { hardware ethernet c8:f7:33:22:6c:4e; fixed-address 172.16.12.50; } # Phone Fixed Address host DROID { hardware ethernet fc:c2:de:bd:14:9a; fixed-address 172.16.12.49; }
Note: In the example above, the “81U1” defined after
host
is the actual hostname of the machine that will be receiving the fixed lease. Also note that hardware ethernet
refers to the MAC Address of the host “81U1”.Once these changes are made, simply restart your DHCP Server with the command below. Once that is complete you can disable and then re-enable the network adapters on the clients you have defined the fixed leases for and they should get the IP addresses you declared in the conf file.
service isc-dhcp-server restart