配置IPv6邻居发现示例
本举例介绍IPv6邻居发现的配置过程。
操作步骤
- 配置接口的链路本地单播地址,在接口下执行ipv6 enable命令后,系统会自动为该接口生成一个链路本地地址。
<HUAWEI> system-view
[~HUAWEI] sysname DeviceA
[*HUAWEI] commit
[~DeviceA] interface gigabitethernet 0/1/0 [~DeviceA-GigabitEthernet0/1/0] undo shutdown [*DeviceA-GigabitEthernet0/1/0] ipv6 enable [*DeviceA-GigabitEthernet0/1/0] commit
- 配置接口的EUI-64单播地址和RA消息中的前缀
在DeviceA上配置需要发布的RA前缀消息并打开RA消息的发布开关后,PC才能自动获得路由器RA报文的地址前缀消息。
[~DeviceA-GigabitEthernet0/1/0] ipv6 address 2001:db8::/32 eui-64 [*DeviceA-GigabitEthernet0/1/0] ipv6 nd ra prefix 2001:db8::/32 1000 1000 [*DeviceA-GigabitEthernet0/1/0] undo ipv6 nd ra halt [*DeviceA-GigabitEthernet0/1/0] commit [~DeviceA-GigabitEthernet0/1/0] quit
- 验证配置结果
如果配置成功,可以查看配置的链路本地单播地址和EUI-64全球单播地址,以及接口状态为Up,IPv6协议状态为Up。
# 显示路由器的接口信息。
[~DeviceA-GigabitEthernet0/1/0] display this ipv6 interface GigabitEthernet0/1/0 current state : UP IPv6 protocol current state : UP IPv6 is enabled, link-local address is FE80::2E0:FCFF:FE7D:A497 Global unicast address(es): 2001:db8::2E0:FCFF:FE7D:A497, subnet is 2001:db8::/64 Joined group address(es): FF02::1:FF7D:A497 FF02::2 FF02::1 MTU is 1500 bytes ND DAD is enabled, number of DAD attempts: 1 ND reachable time is 1200000 milliseconds ND retransmit interval is 1000 milliseconds ND advertised reachable time is 0 milliseconds ND advertised retransmit interval is 0 milliseconds ND router advertisement max interval 600 seconds, min interval 200 seconds ND router advertisements live for 1800 seconds Hosts use stateless autoconfig for addresses
# 显示PC的信息。
GigabitEthernet adapter 1: Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Realtek RTL8139 Family PCI Fast Ethe rnet NIC #2 Physical Address. . . . . . . . . : 00-E0-FC-77-A1-B6 Dhcp Enabled. . . . . . . . . . . : No IP Address. . . . . . . . . . . . : 10.1.1.33 Subnet Mask . . . . . . . . . . . : 255.0.0.0 IP Address. . . . . . . . . . . . : 2001:db8::78b3:4397:c0c4:f078 IP Address. . . . . . . . . . . . : 2001:db8::2e0:4cff:fe77:a1b6 IP Address. . . . . . . . . . . . : fe80::2e0:4cff:fe77:a1b6%6 Default Gateway . . . . . . . . . : fe80::288:ff:fe10:b%6 DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1 fec0:0:0:ffff::2%1 fec0:0:0:ffff::3%1
# 从路由器Ping PC的链路本地地址,注意需要使用-i参数,来指定链路本地地址的接口。
[~DeviceA-GigabitEthernet0/1/0] ping ipv6 fe80::2e0:4cff:fe77:a1b6 -i gigabitethernet0/1/0 PING FE80::2E0:4CFF:FE77:A1B6: 56 data bytes, press CTRL_C to break Reply from FE80::2E0:4CFF:FE77:A1B6 bytes=56 Sequence=1 hop limit=64 time = 60 ms Reply from FE80::2E0:4CFF:FE77:A1B6 bytes=56 Sequence=2 hop limit=64 time = 50 ms Reply from FE80::2E0:4CFF:FE77:A1B6 bytes=56 Sequence=3 hop limit=64 time = 50 ms Reply from FE80::2E0:4CFF:FE77:A1B6 bytes=56 Sequence=4 hop limit=64 time = 30 ms Reply from FE80::2E0:4CFF:FE77:A1B6 bytes=56 Sequence=5 hop limit=64 time = 1 ms --- FE80::2E0:4CFF:FE77:A1B6 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 1/38/60 ms
# 从路由器Ping PC的EUI-64全球单播地址。
[~DeviceA-GigabitEthernet0/1/0] ping ipv6 2001:db8::78b3:4397:c0c4:f078 PING 2001:db8::78B3:4397:C0C4:F078 : 56 data bytes, press CTRL_C to break Reply from 2001:db8::78B3:4397:C0C4:F078 bytes=56 Sequence=1 hop limit=64 time = 30 ms Reply from 2001:db8::78B3:4397:C0C4:F078 bytes=56 Sequence=2 hop limit=64 time = 50 ms Reply from 2001:db8::78B3:4397:C0C4:F078 bytes=56 Sequence=3 hop limit=64 time = 50 ms Reply from 2001:db8::78B3:4397:C0C4:F078 bytes=56 Sequence=4 hop limit=64 time = 20 ms Reply from 2001:db8::78B3:4397:C0C4:F078 bytes=56 Sequence=5 hop limit=64 time = 40 ms --- 2001:db8::78B3:4397:C0C4:F078 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 20/38/50 ms