组网需求
- IPv6网络,通过静态路由实现IPv6网络的互联互通
- 实现R1和R2的LoopBack0 接口地址互通
组网拓扑
配置思路
- 配置路由器各个接口的IPv6地址
- 配置IPv6静态路由
配置命令
- 配置各个路由器各个接口的IPv6地址
- 配置IPv6静态路由
查看命令
配置各个路由器接口的IPv6地址
R1配置
1
2
3
4
5
6
7
8
9
10sys
sys R1
ipv6
int g0/0/0
ipv6 enable
ipv6 address 2001:db8:2345:12::1/64
int LoopBack 0
ipv6 enable
ipv6 address 2001:db8:2345:1::1/64
R2配置
1
2
3
4
5
6
7
8
9
10sys
sys R2
ipv6
int g0/0/0
ipv6 enable
ipv6 address 2001:db8:2345:12::2/64
int LoopBack 0
ipv6 enable
ipv6 address 2001:db8:2345:2::2/64
配置IPv6静态路由
R1配置
1
2sys
ipv6 route-static 2001:db8:2345:2:: 64 2001:db8:2345:12::2
R2配置
1
2sys
ipv6 route-static 2001:db8:2345:1:: 64 2001:db8:2345:12::1
数据包解析
ICMPv6请求/响应包(以R2的G0/0/0口为例)
数据包
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19Internet Protocol Version 6, Src: 2001:db8:2345:12::2, Dst: 2001:db8:2345:1::1
0110 .... = Version: 6
.... 0000 0000 .... .... .... .... .... = Traffic Class: 0x00 (DSCP: CS0, ECN: Not-ECT)
.... .... .... 0000 0000 0000 0000 0000 = Flow Label: 0x00000
Payload Length: 64
Next Header: ICMPv6 (58)
Hop Limit: 64
Source Address: 2001:db8:2345:12::2
Destination Address: 2001:db8:2345:1::1
Internet Control Message Protocol v6
Type: Echo (ping) request (128)
Code: 0
Checksum: 0xbfd6 [correct]
[Checksum Status: Good]
Identifier: 0xd0ab
Sequence: 256
[Response In: 2]
Data (56 bytes)
释义
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18IPv6数据包:
version 6 //代表IP协议的版本为V6版本
Traffic Class 0x00 //流类型 代表服务类型或者优先级,相当于IPv4报文中的ToS,用于QoS
Flow Label 0x000000 //流标签 用于区分不同数据流(源地址——流标签)
payload Length 64 //有效荷载
Next Header:ICMP(58) //代表扩展报文或者上层协议数据单元,此处为ICMP代表上层协议数据单元
Hop Limit 64 //相当于IPv4报文中的TTL
Source Address: 2001:db8:2345:12::2 //源地址为R2 G0/0/0接口地址
Destination Address: 2001:db8:2345:1::1 //目的地址为R1 LoopBack0的接口地址
ICMPv6数据包:
Type: Echo (ping) request (128) // 代表ICMP报文消息类型,此处为消息类型,且为Echo Rquest
Code: 0 // 细分消息类型
Checksum: 0xbfd6 [correct] // 校验和
[Checksum Status: Good]
Identifier: 0xd0ab
Sequence: 256
[Response In: 2]
Neighbor Solicitation(NS)包
数据包
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23Internet Protocol Version 6, Src: fe80::2e0:fcff:fe70:f1b, Dst: 2001:db8:2345:12::1
0110 .... = Version: 6
.... 1100 0000 .... .... .... .... .... = Traffic Class: 0xc0 (DSCP: CS6, ECN: Not-ECT)
.... .... .... 0000 0000 0000 0000 0000 = Flow Label: 0x00000
Payload Length: 32
Next Header: ICMPv6 (58)
Hop Limit: 255
Source Address: fe80::2e0:fcff:fe70:f1b
Destination Address: 2001:db8:2345:12::1
[Source SA MAC: HuaweiTe_70:0f:1b (00:e0:fc:70:0f:1b)]
Internet Control Message Protocol v6
Type: Neighbor Solicitation (135)
Code: 0
Checksum: 0xbd28 [correct]
[Checksum Status: Good]
Reserved: 00000000
Target Address: 2001:db8:2345:12::1
ICMPv6 Option (Source link-layer address : 00:e0:fc:70:0f:1b)
Type: Source link-layer address (1)
Length: 1 (8 bytes)
Link-layer address: HuaweiTe_70:0f:1b (00:e0:fc:70:0f:1b)
释义
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22IPv6数据包:
version 6 //代表IP协议的版本为V6版本
Traffic Class 0x00 //流类型 代表服务类型或者优先级,相当于IPv4报文中的ToS,用于QoS
Flow Label 0x000000 //流标签 用于区分不同数据流(源地址——流标签)
payload Length 32 //有效荷载
Next Header:ICMP(58) //代表扩展报文或者上层协议数据单元,此处为ICMP代表上层协议数据单元
Hop Limit 64 //相当于IPv4报文中的TTL
Source Address: fe80::2e0:fcff:fe70:f1b //源地址为R2 G0/0/0接口链路本地地址
Destination Address: 2001:db8:2345:12::1 //目的地址为R1 G0/0/0接口全局单播地址
[Source SA MAC: HuaweiTe_70:0f:1b (00:e0:fc:70:0f:1b)] //用于地址解析
ICMPv6数据包:
Type: Neighbor Solicitation (135) // 代表ICMP消息类型,此处代表NS报文
Code: 0 // 细分消息类型
Checksum: 0xbd28 [correct]
[Checksum Status: Good]
Reserved: 00000000
Target Address: 2001:db8:2345:12::1
ICMPv6 Option (Source link-layer address : 00:e0:fc:70:0f:1b)
Type: Source link-layer address (1) // 源链路层地址
Length: 1 (8 bytes)
Link-layer address: HuaweiTe_70:0f:1b (00:e0:fc:70:0f:1b)
Neighbor Advertisement(NA)包
数据包
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23Frame 12: 86 bytes on wire (688 bits), 86 bytes captured (688 bits) on interface -, id 0
Ethernet II, Src: HuaweiTe_c7:29:1e (00:e0:fc:c7:29:1e), Dst: HuaweiTe_70:0f:1b (00:e0:fc:70:0f:1b)
Internet Protocol Version 6, Src: 2001:db8:2345:12::1, Dst: fe80::2e0:fcff:fe70:f1b
0110 .... = Version: 6
.... 1100 0000 .... .... .... .... .... = Traffic Class: 0xc0 (DSCP: CS6, ECN: Not-ECT)
.... .... .... 0000 0000 0000 0000 0000 = Flow Label: 0x00000
Payload Length: 32
Next Header: ICMPv6 (58)
Hop Limit: 255
Source Address: 2001:db8:2345:12::1
Destination Address: fe80::2e0:fcff:fe70:f1b
[Destination SA MAC: HuaweiTe_70:0f:1b (00:e0:fc:70:0f:1b)]
Internet Control Message Protocol v6
Type: Neighbor Advertisement (136) // ICMP消息报文类型
Code: 0
Checksum: 0xc0cd [correct]
[Checksum Status: Good]
Flags: 0xe0000000, Router, Solicited, Override
Target Address: 2001:db8:2345:12::1
ICMPv6 Option (Target link-layer address : 00:e0:fc:c7:29:1e)
Type: Target link-layer address (2) //目的链路层地址
Length: 1 (8 bytes)
Link-layer address: HuaweiTe_c7:29:1e (00:e0:fc:c7:29:1e)
结果查看
R1 ping R2的回环地址
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20ping ipv6 2001:db8:2345:2::2
<R1>ping ipv6 2001:db8:2345:2::2
PING 2001:db8:2345:2::2 : 56 data bytes, press CTRL_C to break
Reply from 2001:DB8:2345:2::2
bytes=56 Sequence=1 hop limit=64 time = 70 ms
Reply from 2001:DB8:2345:2::2
bytes=56 Sequence=2 hop limit=64 time = 30 ms
Reply from 2001:DB8:2345:2::2
bytes=56 Sequence=3 hop limit=64 time = 30 ms
Reply from 2001:DB8:2345:2::2
bytes=56 Sequence=4 hop limit=64 time = 20 ms
Reply from 2001:DB8:2345:2::2
bytes=56 Sequence=5 hop limit=64 time = 20 ms
--- 2001:db8:2345:2::2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/34/70 ms
查看邻居信息
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18<R1>dis ipv6 neighbors
-----------------------------------------------------------------------------
IPv6 Address : 2001:DB8:2345:12::2
Link-layer : 00e0-fc70-0f1b State : REACH
Interface : GE0/0/0 Age : 0
VLAN : - CEVLAN: -
VPN name : Is Router: TRUE
Secure FLAG : UN-SECURE
IPv6 Address : FE80::2E0:FCFF:FE70:F1B
Link-layer : 00e0-fc70-0f1b State : REACH
Interface : GE0/0/0 Age : 0
VLAN : - CEVLAN: -
VPN name : Is Router: TRUE
Secure FLAG : UN-SECURE
-----------------------------------------------------------------------------
Total: 2 Dynamic: 2 Static: 0查看IPv6路由表
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45<R1>dis ipv6 routing-table
Routing Table : Public
Destinations : 7 Routes : 7
Destination : ::1 PrefixLength : 128
NextHop : ::1 Preference : 0
Cost : 0 Protocol : Direct
RelayNextHop : :: TunnelID : 0x0
Interface : InLoopBack0 Flags : D
Destination : 2001:DB8:2345:1:: PrefixLength : 64
NextHop : 2001:DB8:2345:1::1 Preference : 0
Cost : 0 Protocol : Direct
RelayNextHop : :: TunnelID : 0x0
Interface : LoopBack0 Flags : D
Destination : 2001:DB8:2345:1::1 PrefixLength : 128
NextHop : ::1 Preference : 0
Cost : 0 Protocol : Direct
RelayNextHop : :: TunnelID : 0x0
Interface : LoopBack0 Flags : D
Destination : 2001:DB8:2345:2:: PrefixLength : 64
NextHop : 2001:DB8:2345:12::2 Preference : 60
Cost : 0 Protocol : Static
RelayNextHop : :: TunnelID : 0x0
Interface : GigabitEthernet0/0/0 Flags : RD
Destination : 2001:DB8:2345:12:: PrefixLength : 64
NextHop : 2001:DB8:2345:12::1 Preference : 0
Cost : 0 Protocol : Direct
RelayNextHop : :: TunnelID : 0x0
Interface : GigabitEthernet0/0/0 Flags : D
Destination : 2001:DB8:2345:12::1 PrefixLength : 128
NextHop : ::1 Preference : 0
Cost : 0 Protocol : Direct
RelayNextHop : :: TunnelID : 0x0
Interface : GigabitEthernet0/0/0 Flags : D
Destination : FE80:: PrefixLength : 10
NextHop : :: Preference : 0
Cost : 0 Protocol : Direct
RelayNextHop : :: TunnelID : 0x0
Interface : NULL0 Flags : D