Psychz - Amol
Votes: 0Posted On: Jul 21, 2017 04:13:32
The Dynamic Host Configuration Protocol (DHCP) is a client/server protocol used to automatically assign IP addresses to hosts when they move from one subnet to another. Before the development of DHCP, when the devices using Internet Protocol migrated from one subnet to another, they had to be configured manually. With the help of DHCP, the devices are provided the IP addresses automatically. The DHCP server maintains a pool of IP addresses and allots the IP addresses automatically to every DHCP-clint as it enters the network.
ISC-DHCP Server Configuration
Prerequisites
1. OPERATING SYSTEM - Ubuntu 14.04
2. An active network
3. Installation - Please open the terminal and run the following command to install ISC-DHCP server.
sudo apt-get install isc-dhcp-server
The command will install DHCP server in your Ubuntu operating system. The DHCP configuration file named "dhcpd.conf" is created in the directory "/etc/dhcp/dhcpd.conf". This file is a default file and it needs to be configured according to the specifications of your network.
Another file called "isc-dhcp server" is created in "/etc/default". You need to edit the file to specify the interfaces DHCP should listen to. By default, the DHCP listens to "eth0".
DHCP configuration
1. Edit the "dhcp.conf" file with the help of any editor and modify it as following.
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.254;
option domain-name-servers 192.168.1.1, 192.168.1.2;
option domain-name "mydomain.example";
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.110;
range 192.168.1.160 192.168.1.200;
}
As we can see in the latter part of this configuration, a subnet "192.168.1.0" is defined with a netmask of 255.255.255.0, that is 256 IPs. Ranges are also defined so that IPs in the range of 192.168.1.10-192.168.1.110 and 192.168.1.160-192.168.1.200 can only be assigned to the devices.
Also, default lease time of 600 is provided which means that the DHCP will reserve an IP for only 600 seconds by default. The maximum lease time that can be allotted is set to 7200 seconds.
Other parameters that are provided are the broadcast address, the DNS servers among others.
2. The following command is used to make this DHCP server the official DHCP server for the local network.
authoritative;
3. Edit the "isc-dhcp server" file with any editor of your choosing. The path of "isc-dhcp server" file is "/etc/default/isc-dhcp-server". In this file, you will find the option "INTERFACES". You can choose multiple interfaces with a space between them. For example,
INTERFACES="wlan0 eth0"
Restart ISC-DHCP server
Now that the isc-dhcp-server configuration is complete, we need to reload the DHCP server, so that the new configurations can be implemented.
sudo service isc-dhcp-server restart
sudo service isc-dhcp-server start
sudo service isc-dhcp-server stop