When there are a large number of hosts in the LAN, if you set the IP address, default gateway,DNS server address and other network parameters, it is obviously a laborious and may not be pleasing method, then use DHCP to distribute the IP address, The ability to dynamically configure the network address parameters of each client greatly reduces the cost of management and maintenance. The following is an example of installing a DHCP server and a DHCP relay server.
the company's internal network is divided into three physical segments and connected to one another through a Linux gateway server.
In order to provide centralized address assignment management, it is necessary to build a DHCP server to dynamically configure network parameters such as IP addresses for clients in different networks without increasing hardware investment.
The network topology diagram is as follows:
Verify that the network address is configured correctly
for DHCP server,DHCP relay server to correctly add the virtual network card device according to the topology diagram and configure the IP address of each interface and other parameters, it is noted that the DHCP server's default gateway address is set to 192.168.1.1 in order to communicate with intranet clients
Configuring the DHCP server
1.
Installing the DHCP server package
Check the rpm command first to check if the DHCP package is installed on the system, and if it is not installed, Mount the RHEL5 system CD and install the dhcp-3.0.5.el5.i386.rpm software package.
to view the main files installed by the DHCP package
use VI to open the main profile of the DHCP server /etc/dhcpd.conf, but the file does not contain any valid configuration by default, you need to manually establish
dynamically assigned IP addresses for each client, with a default lease time of 21,600 seconds and a maximum lease time of 43,200 seconds, corresponding to three physical network segments for dynamically assigned IP address ranges:192.168.1.10~ 192.168.1.100,192.168.2.10~192.168.2.100,192.168.3.10~192.168.3.100
start the dhcpd service
Open Command parameter Profile /ETC/SYSCONFIG/DHCPD, set dhcpd service to provide dynamic address assignment service only for eth0, eth1, eth2 network cards
Configuring a DHCP Relay server
in the RHEL5 system, the DHCP software package is installed, and after the installation is complete, the DHCP relay related programs and scripts are included. when configuring a DHCP relay server, you only need to modify the configuration file /etc/sysconfig/dhcrelay service, and when used as a router, you also have to turn on the server's route forwarding function
turn on the Routing and forwarding function of the server
Edit the /etc/sysctl.conf file, Modify the value of the Net.ipv4.ip_forward configuration item to 1, and execute the sysctl-p command to take effect
Open the configuration file for the DHCP relay server, set the interface that allows DHCP relay data, and the IP address of the DHCP server
start the dhcrelay Relay Service Program
Verifying DHCP results
Modify the test client's virtual NIC connection, using a different NIC for testing. Ensure that the correct network address configuration can be obtained by DHCP (two methods)
1.
If the test client is using a Linux system, take the dhclient eth0 command to get the address, or modify the configuration file for the eth0 NIC, set the bootproto=dhcp, and then restart Network Services
2.
If the test client uses a Windows system, open the cmd Command window, execute the ipconfig/release command to release the lease, and execute the ipconfig/renew command to retrieve the address again
We use Windows Client for authentication here
This article is from the "Shani" blog, make sure to keep this source http://shani.blog.51cto.com/1153831/326907
How to build DHCP and DHCP relay servers