SW2 配置 DHCPv4 和 DHCPv6,分别为 Vlan11、Vlan21、Vlan130、 Vlan140、Vlan150 分配地址。DHCPv4 地址池名称分别为 PC1、PC2、 AP1、POOLv4-VLAN11、POOLv4-VLAN21、POOLv4-VLAN130、POOLv4- VLAN140 、POOLv4-VLAN150 ,排 除 网关, DNS 为 10.4.210.101 和 10.4.220.101。DHCPv6 地址池名称分别为 POOLv6-VLAN11、POOLv6- VLAN21、 POOLv6-VLAN130、 POOLv6-VLAN140、 POOLv6-VLAN150, DHCPv6 地址池用网络前缀表示,排除网关, DNS 为 2400:3200::1。 PC1 保留地 址 10.4.11.9(DHCPv4 地址池名称为 PC1)和 2001:10:4:11::9,PC2 保留地址 10.4.21.9 ( DHCPv4 地址池名称为 PC2)和 2001:10:4:21::9, AP1 保 留 地 址 10.4.130.9 ( DHCPv4 地 址 池 名 称 为 AP1 ) 和 2001:10:4:130::9。SW1、AC1 中继地址为 SW2 Loopback1 地址。SW1 启用 DHCPv4 和 DHCPv6 snooping 功能,如果 E1/0/1 连接 DHCPv4 服 务器,则关闭端口,恢复时间为 10 分钟。

首先配置地址池 进入到SW3

SW3

!
service dhcp
!
ip dhcp excluded-address 10.4.130.1
ip dhcp excluded-address 10.4.11.1
ip dhcp excluded-address 10.4.21.1
ip dhcp excluded-address 10.4.140.1
ip dhcp excluded-address 10.4.150.1
!
ip dhcp pool POOLv4-VLAN11
 network-address 10.4.11.0 255.255.255.0
 default-router 10.4.11.1
 dns-server 10.4.210.101 10.4.220.101
!
ip dhcp pool POOLv4-VLAN21
 network-address 10.4.21.0 255.255.255.0
 default-router 10.4.21.1
 dns-server 10.4.210.101 10.4.220.101
!
ip dhcp pool POOLv4-VLAN130
 network-address 10.4.130.0 255.255.255.0
 default-router 10.4.130.1
!
ip dhcp pool POOLv4-VLAN140
 network-address 10.4.140.0 255.255.255.0
 default-router 10.4.140.1
 dns-server 10.4.210.101 10.4.220.101
!
ip dhcp pool POOLv4-VLAN150
 network-address 10.4.150.0 255.255.255.0
 default-router 10.4.150.1
 dns-server 10.4.210.101 10.4.220.101
!
ip dhcp pool AP1
 host 10.4.130.9 255.0.0.0
 hardware-address 00-03-0F-D9-C8-20
 default-router 10.4.130.1
!
ip dhcp pool PC1
 host 10.4.11.9 255.0.0.0
 hardware-address 00-03-0F-D9-C8-C9
 default-router 10.4.11.1
 dns-server 10.4.210.101 10.4.220.101
!
ip dhcp pool PC2
 host 10.4.21.9 255.0.0.0
 hardware-address 00-03-0F-D9-C8-C1
 default-router 10.4.21.1
 dns-server 10.4.220.101 10.4.210.101
!

IPV6_POOL

!
ipv6 dhcp pool POOLv6-VLAN150
 network-address 2001:10:4:150:: 64
 static-binding 2001:10:4:150::9 0a-03-af-a9-c8-c3
 excluded-address 2001:10:4:150::1
 dns-server 2400:3200::1
!
ipv6 dhcp pool POOLv6-VLAN140
 network-address 2001:10:4:140:: 64
 static-binding 2001:10:4:140::9 0a-03-0f-a9-c8-c3
 excluded-address 2001:10:4:140::1
 dns-server 2400:3200::1
!
ipv6 dhcp pool POOLv6-VLAN130
 network-address 2001:10:4:130:: 64
 static-binding 2001:10:4:130::9 00-03-0f-a9-a8-c3
 excluded-address 2001:10:4:130::1
!
ipv6 dhcp pool POOLv6-VLAN21
 network-address 2001:10:4:21:: 64
 static-binding 2001:10:4:21::9 00-03-0f-a9-c8-c3
 excluded-address 2001:10:4:21::1
 dns-server 2400:3200::1
!
ipv6 dhcp pool POOLv6-VLAN11
 network-address 2001:10:4:11:: 64
 static-binding 2001:10:4:11::9 00-03-0f-d9-c8-c3
 excluded-address 2001:10:4:11::1
 dns-server 2400:3200::1
!

LOOPBACK1配置

interface Loopback1
 ipv6 dhcp server POOLv6-VLAN11
 ipv6 dhcp server POOLv6-VLAN130
 ipv6 dhcp server POOLv6-VLAN140
 ipv6 dhcp server POOLv6-VLAN150
!

进入到VLAN21

!
interface Vlan21
 no ipv6 nd suppress-ra
 ipv6 nd managed-config-flag
 ipv6 nd other-config-flag
!

SW1

VLAN11



interface Vlan11
 no ipv6 nd suppress-ra
 ipv6 nd managed-config-flag
 ipv6 nd other-config-flag
  !forward protocol udp 67(active)!
 ip helper-address 10.4.2.1
 ipv6 dhcp relay destination 2001:10:4:2::1
!

E1/0/1设置 ip dhcp snooping action shutdown recovery 600

AC1

!
interface Vlan130
 no ipv6 nd suppress-ra
 ipv6 nd managed-config-flag.

 ipv6 nd other-config-flag
  !forward protocol udp 67(active)!
 ip helper-address 10.4.2.1
 ipv6 dhcp relay destination 2001:10:4:2::1
!
interface Vlan140
 no ipv6 nd suppress-ra
 ipv6 nd managed-config-flag
 ipv6 nd other-config-flag
  !forward protocol udp 67(active)!
 ip helper-address 10.4.2.1
 ipv6 dhcp relay destination 2001:10:4:2::1
!                                                                                                                                                             
interface Vlan150
 no ipv6 nd suppress-ra
 ipv6 nd managed-config-flag
 ipv6 nd other-config-flag
  !forward protocol udp 67(active)!
 ip helper-address 10.4.2.1
 ipv6 dhcp relay destination 2001:10:4:2::1



均有 service dhcp ip forward-protocol udp bootps ip dhcp snooping enable service dhcpv6 savi enable savi ipv6 dhcp-only enable