Automatic allocation of DHCP dynamic IP across network segments (DHCP relay)

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

Automatic allocation of DHCP dynamic IP across network segments (DHCP relay)
Experiment preparation:

  1. Equipment: router, one layer 3 switch, one three PCs belong to different VLANs
  2. The switch creates VLAN 20 30 40 88 and adds the port to the VLAN to which it belongs
  3. 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
Automatic allocation of DHCP dynamic IP across network segments (DHCP relay)
Automatic allocation of DHCP dynamic IP across network segments (DHCP relay)
Automatic allocation of DHCP dynamic IP across network segments (DHCP relay)

Experimental verification 2: Verify communication between hosts
Automatic allocation of DHCP dynamic IP across network segments (DHCP relay)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325982019&siteId=291194637