1. DHCP: Dynamic Host Configuration Protocol
1. 作用:实现企业大量主机IP的动态配置和集中管理。减少工作量,减少人为配置错误。
2. DHCP工作原理:
a) 发现阶段---发送DHCP discover 报文
b) 提供阶段---服务器回应offer
c) 选择阶段----发送request请求 报文
d) 确认阶段---服务器回应 ack确认
2. DHCP relay: When the DHCP client and the DHCP server are not in the same network segment, we need to configure the DHCP relay
DHCP relay instance
Experiment preparation:
- Equipment: router, one layer 3 switch, one three PCs belong to different VLANs
- The switch creates VLAN 20 30 40 88 and adds the port to the VLAN to which it belongs
- The host ip is configured for the
purpose of DHCP experiment : to realize the host obtains an IP address through DHCP; at the same time, it realizes the communication of different VLAN hosts.
Implementation steps:
Create a switch VLAN and add the port to the corresponding VLAN at the same time
[H1]vlan batch 20 30 40 88
[H1]port-group group-member Gi 0/0/1 to gi 0/0/4
[H1- port-group]port link-type access
[H1-GigabitEthernet0/0/1]port default vlan 88
[H1-GigabitEthernet0/0/2]port default vlan 20
[H1-GigabitEthernet0/0/3]port default vlan 30
[H1 -GigabitEthernet0/0/4]port default vlan 40
Dhcp server enable dhcp, create three address pools
[R1]dhcp enable
[R1]ip pool 20
[R1-ip-pool-20]network 192.168.20.0 mask 255.255.255.0
[R1-ip-pool-20]gateway-list 192.168.20.254
[R1-ip-pool-20]dns-list 8.8.8.8
[R1]ip pool 30
[R1-ip-pool-30]network 192.168.30.0 mask 255.255.255.0
[R1-ip-pool-30]gateway-list 192.168.30.254
[R1-ip-pool-30]dns-list 8.8.8.8
[R1]ip pool 40
[R1-ip-pool-40]network 192.168.40.0 mask 255.255.255.0
[R1-ip-pool-40]gateway-list 192.168.40.254
[R1-ip-pool-40]dns-list 8.8.8.8
[R1-GigabitEthernet0/0/0]ip add 192.168.88.1 24
[R1-GigabitEthernet0/0/0]dhcp select global
把VLAN加IP,设置DHCP中继模式
[H1]int vlan 20
[H1-Vlanif20]ip add 192.168.20.254 24
[H1-Vlanif20]dhcp select relay
[H1-Vlanif20]dhcp relay server-ip 192.168.88.1
[H1-Vlanif30] ip add 192.168.30.254 24
[H1-Vlanif30]dhcp select relay
[H1-Vlanif30]dhcp relay server-ip 192.168.88.1
[H1-Vlanif40]ip address 192.168.40.254 24
[H1-Vlanif40]dhcp select relay
[H1-Vlanif40]dhcp relay server-ip 192.168.88.1
[H1-Vlanif88]ip add 192.168.88.254 24Experimental
verification one:
Open pc1 pc2 pc3 and run: ipconfig: check address acquisition
Experimental verification 2: Verify communication between hosts