IPv6背景介绍:
拓扑如下:
1、IPv6自动分配
1. 1 指定端口配置IPv6服务器为自动模式:
自动获取本地链路地址,本地链路地址可以自动可以手动,这里以自动为例。
[R1]interface g0/0
[R1-GigabitEthernet0/0]
[R1-GigabitEthernet0/0]ipv6 address auto
[R1]display ipv6 interface brief //自定产生一个FE80开头的本地链路地址
*down: administratively down
(s): spoofing
Interface Physical Protocol IPv6 Address
GigabitEthernet0/0 up up FE80::32D8:C0FF:FE4F:105
GigabitEthernet0/1 down down Unassigned
GigabitEthernet0/2 down down Unassigned
GigabitEthernet5/0 down down Unassigned
GigabitEthernet5/1 down down Unassigned
GigabitEthernet6/0 down down Unassigned
GigabitEthernet6/1 down down Unassigned
Serial1/0 down down Unassigned
Serial2/0 down down Unassigned
Serial3/0 down down Unassigned
Serial4/0 down down Unassigned
PC3和PC4与上述操作一致。
1.2 模拟PC通信测试
ping测试一定要加接口。
PC3 ping PC4:
[PC3]ping ipv6 -i GigabitEthernet 0/0 FE80::32D8:C8FF:FEB4:305
Ping6(56 data bytes) FE80::32D8:C5FF:FE6D:205 --> FE80::32D8:C8FF:FEB4:305, press CTRL+C to break
56 bytes from FE80::32D8:C8FF:FEB4:305, icmp_seq=0 hlim=64 time=12.000 ms
56 bytes from FE80::32D8:C8FF:FEB4:305, icmp_seq=1 hlim=64 time=7.000 ms
56 bytes from FE80::32D8:C8FF:FEB4:305, icmp_seq=2 hlim=64 time=5.000 ms
56 bytes from FE80::32D8:C8FF:FEB4:305, icmp_seq=3 hlim=64 time=5.000 ms
56 bytes from FE80::32D8:C8FF:FEB4:305, icmp_seq=4 hlim=64 time=5.000 ms
--- Ping6 statistics for FE80::32D8:C8FF:FEB4:305 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 5.000/6.800/12.000/2.713 ms
[PC3]%Nov 8 20:51:15:722 2023 PC3 PING/6/PING_STATISTICS: Ping6 statistics for FE80::32D8:C8FF:FEB4:305: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 5.000/6.800/12.000/2.713 ms.
PC4 ping IPv6服务器:
[PC4]ping ipv6 -i GigabitEthernet 0/0 FE80::32D8:C0FF:FE4F:105
Ping6(56 data bytes) FE80::32D8:C8FF:FEB4:305 --> FE80::32D8:C0FF:FE4F:105, press CTRL+C to break
56 bytes from FE80::32D8:C0FF:FE4F:105, icmp_seq=0 hlim=64 time=10.000 ms
56 bytes from FE80::32D8:C0FF:FE4F:105, icmp_seq=1 hlim=64 time=4.000 ms
56 bytes from FE80::32D8:C0FF:FE4F:105, icmp_seq=2 hlim=64 time=4.000 ms
56 bytes from FE80::32D8:C0FF:FE4F:105, icmp_seq=3 hlim=64 time=3.000 ms
56 bytes from FE80::32D8:C0FF:FE4F:105, icmp_seq=4 hlim=64 time=4.000 ms
--- Ping6 statistics for FE80::32D8:C0FF:FE4F:105 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 3.000/5.000/10.000/2.530 ms
%Nov 8 20:51:18:108 2023 PC4 PING/6/PING_STATISTICS: Ping6 statistics for FE80::32D8:C0FF:FE4F:105: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 3.000/5.000/10.000/2.530 ms.
2、IPv6手动分配
2.1 手动指定端口配置IPv6网段
[R1-GigabitEthernet0/0]ipv6 address 2001::1 64
[R1-GigabitEthernet0/0]display ipv6 int bri
*down: administratively down
(s): spoofing
Interface Physical Protocol IPv6 Address
GigabitEthernet0/0 up up 2001::1
GigabitEthernet0/1 down down Unassigned
GigabitEthernet0/2 down down Unassigned
GigabitEthernet5/0 down down Unassigned
GigabitEthernet5/1 down down Unassigned
GigabitEthernet6/0 down down Unassigned
GigabitEthernet6/1 down down Unassigned
Serial1/0 down down Unassigned
Serial2/0 down down Unassigned
Serial3/0 down down Unassigned
Serial4/0 down down Unassigned
此时加上我们已经自动获取的本地链路地址有2个IP,两个地址同时有效:
[R1-GigabitEthernet0/0]display ipv6 interface g0/0
GigabitEthernet0/0 current state: UP
Line protocol current state: UP
IPv6 is enabled, link-local address is FE80::32D8:C0FF:FE4F:105
Global unicast address(es):
2001::1, subnet is 2001::/64
Joined group address(es):
FF02::1
FF02::2
FF02::1:FF00:1
FF02::1:FF4F:105
MTU is 1500 bytes
ND DAD is enabled, number of DAD attempts: 1
ND reachable time is 30000 milliseconds
ND retransmit interval is 1000 milliseconds
Hosts use stateless autoconfig for addresses
IPv6 Packet statistics:
InReceives: 18
InTooShorts: 0
InTruncatedPkts: 0
InHopLimitExceeds: 0
InBadHeaders: 0
InBadOptions: 0
ReasmReqds: 0
---- More ----
[R1-GigabitEthernet0/0]undo ipv6 nd ra halt
//解除RA报文限制,H3C默认禁止nd协议ra报文传输本地链路地址的前缀报文和长度
2.2 模拟PC通信测试
进入PC3查询:
已生成我们在R1上配置的2001网段的IPv6地址,而且是全球唯一单播地址,
[PC3]int g0/0
[PC3-GigabitEthernet0/0]display ipv6 int bri
*down: administratively down
(s): spoofing
Interface Physical Protocol IPv6 Address
GigabitEthernet0/0 up up 2001::32D8:C5FF:FE6D:205
GigabitEthernet0/1 down down Unassigned
GigabitEthernet0/2 down down Unassigned
GigabitEthernet5/0 down down Unassigned
GigabitEthernet5/1 down down Unassigned
GigabitEthernet6/0 down down Unassigned
GigabitEthernet6/1 down down Unassigned
Serial1/0 down down Unassigned
Serial2/0 down down Unassigned
Serial3/0 down down Unassigned
Serial4/0 down down Unassigned
PC4同理查询:
[PC4]interface g0/0
[PC4-GigabitEthernet0/0]display ipv6 interface brief
*down: administratively down
(s): spoofing
Interface Physical Protocol IPv6 Address
GigabitEthernet0/0 up up 2001::32D8:C8FF:FEB4:305
GigabitEthernet0/1 down down Unassigned
GigabitEthernet0/2 down down Unassigned
GigabitEthernet5/0 down down Unassigned
GigabitEthernet5/1 down down Unassigned
GigabitEthernet6/0 down down Unassigned
GigabitEthernet6/1 down down Unassigned
Serial1/0 down down Unassigned
Serial2/0 down down Unassigned
Serial3/0 down down Unassigned
Serial4/0 down down Unassigned
PC3 ping PC4:PC之间不需要指定端口。
[PC3-GigabitEthernet0/0]ping ipv6 2001::32D8:C8FF:FEB4:305
Ping6(56 data bytes) 2001::32D8:C5FF:FE6D:205 --> 2001::32D8:C8FF:FEB4:305, press CTRL+C to break
56 bytes from 2001::32D8:C8FF:FEB4:305, icmp_seq=0 hlim=64 time=11.000 ms
56 bytes from 2001::32D8:C8FF:FEB4:305, icmp_seq=1 hlim=64 time=5.000 ms
56 bytes from 2001::32D8:C8FF:FEB4:305, icmp_seq=2 hlim=64 time=6.000 ms
56 bytes from 2001::32D8:C8FF:FEB4:305, icmp_seq=3 hlim=64 time=5.000 ms
56 bytes from 2001::32D8:C8FF:FEB4:305, icmp_seq=4 hlim=64 time=6.000 ms
--- Ping6 statistics for 2001::32D8:C8FF:FEB4:305 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 5.000/6.600/11.000/2.245 ms
[PC3-GigabitEthernet0/0]%Nov 8 21:14:16:616 2023 PC3 PING/6/PING_STATISTICS: Ping6 statistics for 2001::32D8:C8FF:FEB4:305: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 5.000/6.600/11.000/2.245 ms.
PC3 ping R1:需要对应端口
[PC3-GigabitEthernet0/0]ping ipv6 -i g0/0 2001::1
Ping6(56 data bytes) 2001::32D8:C5FF:FE6D:205 --> 2001::1, press CTRL+C to break
56 bytes from 2001::1, icmp_seq=0 hlim=64 time=12.000 ms
56 bytes from 2001::1, icmp_seq=1 hlim=64 time=6.000 ms
56 bytes from 2001::1, icmp_seq=2 hlim=64 time=5.000 ms
56 bytes from 2001::1, icmp_seq=3 hlim=64 time=6.000 ms
56 bytes from 2001::1, icmp_seq=4 hlim=64 time=6.000 ms
--- Ping6 statistics for 2001::1 ---
3、自动分配与手动分配的互通
3.1 手动分配PC3的IPv6,保持PC4的自动分配IPv6
[PC3-GigabitEthernet0/0]ipv6 address 2001::2 24
[PC3-GigabitEthernet0/0]display ipv6 interface brief
*down: administratively down
(s): spoofing
Interface Physical Protocol IPv6 Address
GigabitEthernet0/0 up up 2001::2
GigabitEthernet0/1 down down Unassigned
GigabitEthernet0/2 down down Unassigned
GigabitEthernet5/0 down down Unassigned
GigabitEthernet5/1 down down Unassigned
GigabitEthernet6/0 down down Unassigned
GigabitEthernet6/1 down down Unassigned
Serial1/0 down down Unassigned
Serial2/0 down down Unassigned
Serial3/0 down down Unassigned
Serial4/0 down down Unassigned
3.2 测试与自动分配IPv6的PC4的连通性
[PC3-GigabitEthernet0/0]ping ipv6 2001::32D8:C8FF:FEB4:305
Ping6(56 data bytes) 2001::32D8:C5FF:FE6D:205 --> 2001::32D8:C8FF:FEB4:305, press CTRL+C to break
56 bytes from 2001::32D8:C8FF:FEB4:305, icmp_seq=0 hlim=64 time=8.000 ms
56 bytes from 2001::32D8:C8FF:FEB4:305, icmp_seq=1 hlim=64 time=6.000 ms
56 bytes from 2001::32D8:C8FF:FEB4:305, icmp_seq=2 hlim=64 time=5.000 ms
56 bytes from 2001::32D8:C8FF:FEB4:305, icmp_seq=3 hlim=64 time=5.000 ms
56 bytes from 2001::32D8:C8FF:FEB4:305, icmp_seq=4 hlim=64 time=5.000 ms
--- Ping6 statistics for 2001::32D8:C8FF:FEB4:305 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 5.000/5.800/8.000/1.166 ms
[PC3-GigabitEthernet0/0]%Nov 8 21:32:39:612 2023 PC3 PING/6/PING_STATISTICS: Ping6 statistics for 2001::32D8:C8FF:FEB4:305: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 5.000/5.800/8.000/1.166 ms.
基本配置结束。