3.1 问题
如图配置IPv6地址
R1是DHCPv6服务器
确保 PC1和PC2自动获取IPv6地址
确保PC1和PC2互通
3.2 方案
实现此案例需要按照如下步骤进行。
1)设置PC1和PC2的IPv6地址为“自动获取”
2)设置 SW1,确保 DHCPv6 客户端与服务器可以互通
undo terminal monitor
system-view
[Huawei]sysname SW1
[SW1]vlan 12 //创建 VLAN 12
[SW1-vlan12]quit
[SW1]interface gi0/0/1 //连接 PC1所用的接口
[SW1-GigabitEthernet0/0/1]port link-type access
[SW1-GigabitEthernet0/0/1]port default vlan 12
[SW1-GigabitEthernet0/0/1]quit
[SW1]interface GigabitEthernet 0/0/2 //连接 PC2所用的接口
[SW1-GigabitEthernet0/0/2]port link-type access
[SW1-GigabitEthernet0/0/2]port default vlan 12
[SW1-GigabitEthernet0/0/2]quit
[SW1]interface GigabitEthernet 0/0/24 //连接 R1所用的接口
[SW1-GigabitEthernet0/0/24]port link-type access
[SW1-GigabitEthernet0/0/24]port default vlan 12
[SW1-GigabitEthernet0/0/24]quit
3)配置R1为DHCPv6服务器
undo terminal monitor
[Huawei]sysname R1
[R1]ipv6 enable //开启IPv6功能
[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ipv6 enable
[R1-GigabitEthernet0/0/0]ipv6 address 2001:1::254/64
[R1-GigabitEthernet0/0/0]quit
[R1]dhcp enable //开启 DHCP 功能
[R1]dhcpv6 pool VLAN12 //配置IPv6 的 DHCP 地址池
[R1-dhcpv6-pool-VLAN12]address prefix 2001:1::/64 //指定IPv6的网段
[R1-dhcpv6-pool-VLAN12]excluded-address 2001:1::254 //排除IPv6地址
[R1-dhcpv6-pool-VLAN12]quit
[R1]interface gi0/0/0
[R1-GigabitEthernet0/0/0]dhcpv6 server VLAN12 //在接口上关联IPv6地址池
[R1-GigabitEthernet0/0/0]quit
4)验证PC1与PC2之间的互通性
PC1>ping 2001:1::1 //在 PC1 上访问 PC2 的IPv6地址
Ping 2001:1::1: 32 data bytes, Press Ctrl_C to break
From 2001:1::1: bytes=32 seq=1 hop limit=254 time=141 ms
From 2001:1::1: bytes=32 seq=2 hop limit=254 time=78 ms
From 2001:1::1: bytes=32 seq=3 hop limit=254 time=78 ms
From 2001:1::1: bytes=32 seq=4 hop limit=254 time=78 ms
From 2001:1::1: bytes=32 seq=5 hop limit=254 time=62 ms
--- 2001:1::1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 62/87/141 ms