How to configure Dynamic Host Configuration Protocol Server (DHCP) on Linux

DHCP is a network protocol that among other things can dynamically distribute IP addresses and other network setting to computers. With DHCP, the process of connecting a new client to the network is as easy as plugging it in.
This section covers the basic interaction between a client and DHCP server to assign an IP address to a client on the network.
1. A DHCP transaction begins when a client sends out a DHCP DISCOVER packet. This is usually a broadcast packet. At minimum, the packet will contain only the client's hardware address.
2. The server receives the DHCP DISCOVER packet. If an IP address on the client subnet is available and the server is willing to grant a lease, it makes an offer by sending a DHCP OFFER packet to the client. The offer packet contains the:
- Proposed IP address for client
- Server's name
- Server's IP address
- Other configuration information
3.The client receives the DHCP OFFER packet. The client might receive more than one offer if you have more than one DHCP server on the network. HP strongly recommends that you have only one DHCP server on the network. If the client likes the offer, it sends a DHCPREQUEST packet to the server. This indicates a formal request to lease the IP address offered by the server.
4. The DHCP server receives the DHCPREQUEST packet and grants the client its request to lease the IP address. The server sends a DHCPACK to the client. This is the official notification that the address has been granted.
5. Before the lease time expires, the DHCP client requests to extend the lease by sending a DHCPREQUEST packet to the server. The server then updates and extends the lease time. It sends a DHCPACK to the client to notify it that the lease has been extended. These updates and lease extensions continue as long as the client is powered on. If the lease expires and the client is not powered on, and not able to request an extension on the lease, the IP address is recycled.
6. The DHCP server sends DHCPACK to extend the lease on the IP address.
Install the DHCP Package
Most RedHat and Fedora Linux software products are available in the RPM format. Downloading and installing RPMs aren't hard.

1. Check packet of DHCP
[root@localhost ~]# rpm –qa|grep dhcp

2. Browse software of DHCP in CD
[root@localhost ~]# cd /media/CentOS_5.3_Final/CentOS/
[root@localhost CentOS]# ls *dhcp*

3. Install package that selected in picture above
[root@localhost CentOS]# rpm -ihv dhcp-3.0.5-23.el5.i386.rpm

4. Check package that installed
[root@localhost ~]# rpm –qa|grep dhcp

5. Restart service of dchp
[root@localhost ~]# service dhcpd restart

6. By picture above it is not processed, so we copy file in path "/usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample" to "/etc/dhcpd.conf"
[root@localhost ~]#cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf

7. Edit configuration file of dhcp
[root@localhost ~]# vi /etc/dhcpd.conf

It will show dialog

8. Restart service of dhcp again
[root@localhost ~]# service dhcpd restart

9. Test on client
Success for configure DHCP Server on Linux.

No comments:

Post a Comment