Assign a reserved IP address to a certain host in Linux DHCP server

Home > Search
  by

To assign a certain IP address to a host in your network, add the "host" block to your /etc/dhcp/dhcpd.conf file. In this example, the client PC that has MAC address 00:50:56:A8:8C:AB will be assigned IP address 192.168.0.201.

subnet 192.168.0.0 netmask 255.255.255.0 {
  option routers                  192.168.0.1;
  option subnet-mask              255.255.255.0;
  option domain-name-servers      dns1.example.com, dns2.example.com;
  default-lease-time              43200;
  max-lease-time                  86400;
  range                           192.168.0.100 192.168.0.254;

  host pc1 {
   option host-name "pc1.example.com";
   hardware ethernet 00:50:56:A8:8C:AB; 
   fixed-address 192.168.0.201;
  }

}

 

The /var/log/messages file should show that the DHCPD server assigned IP address 192.168.0.201 to the host.

~]# cat /var/log/messages
Jun 25 17:29:45 dhcp1 dhcpd: DHCPDISCOVER from 00:50:56:A8:8C:AB (Windows) via eno16777984
Jun 25 17:29:45 dhcp1 dhcpd: DHCPOFFER on 192.168.0.201 to 00:50:56:A8:8C:AB (Windows) via eno16777984
Jun 25 17:29:45 dhcp1 dhcpd: DHCPREQUEST for 192.168.0.201 (192.168.0.4) from 00:50:56:A8:8C:AB (Samsung) via eno16777984
Jun 25 17:29:45 dhcp1 dhcpd: DHCPACK on 192.168.0.201 to 00:50:56:A8:8C:AB (Windows) via eno16777984

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments