Network Complexity makes it necessary for us to use many protocols to manage the network. Next we will manage the network through the content allocated by the dhcp ip address. We know that all DHCP information is transmitted in the form of broadcast, so it is impossible to pass through the router, which 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.
Dhcp ip allocation Experiment Platform: two servers with LINUX system installed, one is DHCP server Server1, the other is dhcprelay relay Proxy Server Server2, and the other is PC1 and pc2.
Dhcp ip allocation experiment environment: three network segments are allocated:
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.
Configure the dhcp ip Address Allocation for the DHCP server:
# 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;
}
}
At the end of dhcp ip allocation, run the following command to start the DHCP server: # service dhcpd restart
The DHCP server is successfully configured.
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" & gt;/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