DHCP relay setup
Experiment introduction: Start a PC with a Linux system in the virtual machine, and Linux is used as a DHCP server. In GNS3, two VPCs are used. These three machines are all under the switch sw2. Linux belongs to VLAN 100, and the IP address is 192.168. 1.16, the two VPCs are VLAN 10, 192.168.10.0 and VLAN 20, 192.168.20.0 network segment, and then use a three-layer switch sw1 as a DHCP relay, so that the two VPCs can be automatically assigned to IP addresses (layer three The main function of the switch is to enable DHCP broadcasts to cross the VLAN).
1. Start the Linux virtual machine and install the DHCP service. Mount the Red Hat CD image, the DHCP installation package is in the Packages directory in the image file, and use the rpm command to install it directly.
2. After installation, modify the DHCP configuration file, you can copy the /usr/share/doc/dhcp-4.4.1/dhcpd.conf.sample configuration template to the /etc/dhcp directory, overwriting the original dhcpd.conf file.
3. Modify the configuration file (note: do not forget the semicolon at the end of the code)
① Modify the domain name and domain name server (you can modify it according to the format), the following pictures are before and after modification
②Add 192.168.1.0, 192.168.10.0, 192.168.20.0 three network segments, gateway and IP address pool to the configuration file.
4. Start the DHCP service and confirm that the corresponding port is open (port 67 under the udp protocol is the port of the DHCP service server, and 68 is the port of the client)
5. Draw a topology map in GNS3
6. First configure sw2, create VLAN 10, 20, 100 and put each port into the corresponding VLAN and configure the trunk of port f1/0.
7. Configure sw1, mainly configure the IP address of each VLAN port and the trunk of the f1/0 port.
8. Configure the DHCP server addresses of VLAN10 and VLAN20 in sw1, that is, the IP address of the linux host
9. Finally, open VPCS and check whether the two hosts can automatically obtain IP addresses. As shown in the figure below, the IP addresses are successfully obtained.