组网需求
PC直连Router的接口后可通过协议自动获取IPv6地址,并自动生成默认网关,从而使PC与路由器可以自动连通。具体到该试验中,在路由器使能RA(Router Advertisement,路由器通告)后,PC能够根据接收到的RA报文自动配置地址,且能生成指向该路由器的默认路由。
图1 配置路由器IPv6无状态地址自动配置功能
1、Router上的配置
- ipv6 //使能IPv6功能
-
- #
-
- interface GigabitEthernet0/0/0
-
- ipv6 enable
-
- ipv6 address fc01::1/64
-
- undo ipv6 nd ra halt
2、验证配置结果
- # 进入PC A的CMD命令窗口,通过ipconfig命令查看当前PC的地址状态,显示如下:
-
- C:\> ipconfig
-
- Windows IP Configuration
-
- Ethernet adapter 本地连接:
-
- Connection-specific DNS Suffix . :
-
- IP Address. . . . . . . . . . . . : 0.0.0.0
-
- Subnet Mask . . . . . . . . . . . : 0.0.0.0
-
- IP Address. . . . . . . . . . . . : fc01::bdc5:2448:dc6b:bbe0 - ①
-
- IP Address. . . . . . . . . . . . : fc01::215:e9ff:feac:2df2 - ②
-
- IP Address. . . . . . . . . . . . : fe80::215:e9ff:feac:2df2%5 - ③
-
- Default Gateway . . . . . . . . . : fe80::a19:a6ff:fecd:a896%5 - ④
说明:
① IPv6自动配置的本地IP地址,前缀与GE0/0/0接口的IPv6地址相同;
② 用本地Mac地址生成的EUI-64地址;
③ 链路本地地址;
④ 自动生成的默认网关,此处为直连路由器接口的链路层地址。
通过CMD命令窗口,ping Router的GE0/0/0接口,可以ping通。
- C:\> ping fc01::1
-
- Pinging fc01::1 with 32 bytes of data:
-
- Reply from fc01::1: time<1ms
-
- Reply from fc01::1: time<1ms
-
- Reply from fc01::1: time<1ms
-
- Reply from fc01::1: time<1ms
-
- Ping statistics for fc01::1:
-
- Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
-
- Approximate round trip times in milli-seconds:
-
- Minimum = 0ms, Maximum = 0ms, Average = 0ms
从以上信息可以看出路由自动通告成功,地址自动配置完成。