DHCP Installation & Configuration



What is DHCP Server ?

Dynamic Host Configuration Protocol (DHCP) is a network protocol that automatically assigns TCP/IP information to client machines. Each DHCP client connects to the centrally located DHCP server, which returns the network configuration (including the IP address, gateway, and DNS servers) of that client.


Use of DHCP Server


DHCP is useful for automatic configuration of client network interfaces. When configuring the client system, you can choose DHCP instead of specifying an IP address, netmask, gateway, or DNS servers. The client retrieves this information from the DHCP server. DHCP is also useful if you want to change the IP addresses of a large number of systems. Instead of reconfiguring all the systems, you can just edit one configuration file on the server for the new set of IP addresses. If the DNS servers for an organization changes, the changes happen on the DHCP server, not on the DHCP clients. When you restart the network or reboot the clients, the changes go into effect.



Advantages of having a DHCP server connected to network :-

  • No IP address conflicts. DHCP can guarantee that all hosts on the network will have unique IP address. DHCP server keeps a record of all IP addresses assigned and cross reference them with host's MAC addresses.
  • Based on the MAC address DHCP allows for a fixed parameter configuration for a specific host.
  • Efficiency with minimum local client configuration.

DHCP Server Configuration

copy the /usr/share/doc/dhcp-*/dhcpd.conf.sample to /etc/ as a dhcpd.conf & do the editing 
as required.

Command is :-

cp /usr/share/doc/dhcp-*/dhcpd.conf.sample /etc/dhcpd.conf

Packages Required :-

dhcpv6_client-0.10-33.el5
dhcpv6-0.10-33.el5
dhcp-3.0.5-7.el5

ls -ltr to check the files installed in respective path.

dhcpd.leases - in this file shows that ip leased or borrowed from DHCP Server by Users.

dhcpd.conf - Main Configuration file of DHCP Server

/etc/init.d/dhcpd start/restart/stop -> To Start/Restart/Stop the service.

service dhcpd start/restart/stop -> To Start/Restart/Stop the service.

chkconfig dhcpd on OR chkconfig --level 35 dhcpd on -> To Start the service on startup.

Starting the DHCP Server for the First Time



When the DHCP server is started for the first time, it fails unless the dhcpd.leases file exists. Use the command touch /var/lib/dhcpd/dhcpd.leases to create the file if it does not exist.
If the same server is also running BIND as a DNS server, this step is not necessary, as starting the namedservice automatically checks for a dhcpd.leases file.