RedHatLinuxDHCP relay we all know that DHCP is required for dynamic IP allocation in the LAN. However, all DHCP information is transmitted in the form of broadcast, so it is impossible to pass through the router. This determines that a DHCP server can only assign IP addresses to clients in the current network segment, if you want to use a DHCP server to allocate IP addresses to different CIDR blocks, you need to set up a DHCP relay proxy for this CIDR block. Machines installed with Linux can be configured as DHCP relay proxies. Let's take an experiment and look at the setting method.
RedHat Linux DHCP relay
We all know that DHCP is required for dynamic IP allocation in the LAN. However, all DHCP information is transmitted in the form of broadcast, so it is impossible to pass through the router. This determines that a DHCP server can only assign IP addresses to clients in the current network segment, if you want to use a DHCP server to allocate IP addresses to different CIDR blocks, you need to set up a DHCP relay proxy for this CIDR block. Machines installed with Linux can be configured as DHCP relay proxies. Let's take an experiment and look at the setting method.
Experimental Platform: two servers with Linux system installed, one is the DHCP server Server1, the other is the dhcprelay relay Proxy Server Server2, and the other is the PC1 and PC2 used for testing.
Lab environment: allocate three network segments:
192.168.10.0/24
192.168.20.0/24
Two NICs must be installed on the server used as the DHCP relay Proxy: eth0 and eth1.
IP Address Allocation is as follows:
Eth0: 192.168.10.1
Eth1: 192.168.20.1
Only one Nic is required for the DHCP server Server1, Which is eth0.
Eth0: 192.168.10.2 gateway pointing to: 192.168.10.1
The PC1 and PC2 that need to be used for testing are respectively mounted in two CIDR blocks. The result of the experiment is that the IP addresses of the CIDR blocks of both PCs are obtained.
DHCP Server Configuration:
# Vi/etc/dhcpd. conf
Reference:
Ddns-update-style interim;
Ignore client-updates;
Option subnet-mask limit 255.0;
Option domain-name "domain.org ";
Default-lease-time 259200;
Max-lease-time 777600;
Option domain-name-servers 202.96.134.loud, 202.96.128.68;
# Configure super scope below
Shared-network mynet {
Subnet 192.168.10.0 netmask 255.255.255.0 {
Option routers 192.168.10.1;
Range dynamic-bootp 192.168.10.1 192.168.10.254;
}
Subnet 192.168.20.0 netmask 255.255.255.0 {
Option routers 192.168.20.1;
Range dynamic-bootp 192.168.20.1 192.168.255.254;
}
}
Finally, run the following command to start the DHCP server: # service dhcpd restart
The DHCP server is successfully configured. Www.britepic.org
Next we will configure the relay Proxy Server Server2:
First, you must configure the/etc/sysconfig/dhcrealy file.
# Vi/etc/sysconfig/dhcrealy
Enter:
INTERFACES = "eth1 eth0 ″
DHCPSERVERS-"192.168.10.2" # pointing to DHCP server
Start dhcrelay
# Service dhcrely restart
# Echo "1">/proc/sys/net/ipv4/ip_forward
Use pc1 and pc2 to test and view the results.
Note:
When performing a virtual experiment, the network card sets the virtual network as follows:
Server1 Nic eth0 points to VMnet2
Server2 Nic eth0 points to VMnet2, eth1 points to VMnet5
The NIC of PC1 points to VMnet2
The NIC of PC2 points to VMnet5