How to install and configure DHCP Server in Ubunut 17.04
Install DHCP package
sudo apt-get install isc-dhcp-server
Make below entry in configuration file /etc/dhcp/dhcpd.conf
$ sudo vim /etc/dhcp/dhcpd.conf
option domain-name "example.org";
option domain-name-servers ns1.example.org, ns2.example.org;
default-lease-time 600;
max-lease-time 7200;
ddns-update-style none;
authoritative;
subnet 10.0.0.0 netmask 255.255.255.0 {
option routers 10.0.0.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 8.8.8.8,4.2.2.2;
range dynamic-bootp 10.0.0.200 10.0.0.254;
}
Start and enable service
sudo systemctl enable isc-dhcp-server.service
sudo systemctl start isc-dhcp-server.service
sudo systemctl status isc-dhcp-server.service
Error:
Jul 27 22:05:24 shahzad-virtual-machine systemd[1]: isc-dhcp-server.service: Main process exited, code=exited, status=1/FAILURE
Jul 27 22:05:24 shahzad-virtual-machine systemd[1]: isc-dhcp-server.service: Unit entered failed state.
Jul 27 22:05:24 shahzad-virtual-machine systemd[1]: isc-dhcp-server.service: Failed with result 'exit-code'.
Solutions:
Need to check correct parameter in configuration file and also need to check the subnet range according to LAN network.
Check configuration file
sudo dhcpd -t -cf /etc/dhcp/dhcpd.conf