组网需求
- R1与R2之间使用静态IPv6地址互联
- R2作为DHCPv6服务器给R3的GE 0/0/0分配全球单播地址
- R4的GE0/0/0接口通过R2的RA进行无状态地址自动配置
- 配置静态路由,实现各设备之前互访
组网拓扑
配置思路
- 在R1、R2、R3、R4全局和相关接口使能IPv6功能,同时自动生成链路本地地址(Link-Local LLA)
- 在R1、R2相应接口配置静态IPv6全球单播地址
- 在R2上配置DHCPv6服务器功能,R3接口通过DHCPv6方式获取全球单播地址
- 在R2上使能发布RA报文的功能,R4通过无状态地址配置的方式获取地址
- 配置静态路由,实现各个路由器之间互访
配置命令
在全部路由器上使能IPv6,并自动生成本地链路地址
R1配置
1
2
3
4
5
6
7
8sys
sys R1
# 全局使能IPv6
ipv6
int g0/0/0
ipv6 enable
ipv6 address auto link-local
R2配置
1
2
3
4
5
6
7
8
9
10
11
12
13
14sys
sys R2
# 全局使能IPv6
ipv6
int g0/0/0
ipv6 enable
ipv6 address auto link-local
int g0/0/1
ipv6 enable
ipv6 address auto link-local
int g0/0/2
ipv6 enable
ipv6 address auto link-local
R3配置
1
2
3
4
5
6
7
8sys
sys R3
# 全局使能IPv6
ipv6
int g0/0/1
ipv6 enable
ipv6 address auto link-local
R4配置
1
2
3
4
5
6
7
8sys
sys R4
# 全局使能IPv6
ipv6
int g0/0/2
ipv6 enable
ipv6 address auto link-local
在R1、R2上配置静态IPv6全球单播地址
R1配置
1
2
3
4sys
int g0/0/0
ipv6 address 2001::1/64
R2配置
1
2
3
4sys
int g0/0/0
ipv6 address 2001::2/64
在R2上配置DHCPv6服务器,R3上配置DHCP Client
R2配置
1
2
3
4
5
6
7
8sys
dhcp
dhcpv6 pool ipv6_pool
address prefix 2002::
int g0/0/1
dhcpv6 server ipv6_pool
R3配置
1
2
3
4
5
6sys
dhcp
int g0/0/1
ipv6 address auto dhcp
在R2上配置NDP协议的RA,R4上配置自动全球单播
R2配置
1
2
3sys
int g0/0/2
undo ipv6 nd ra halt
R4配置
1
2
3sys
int g0/0/2
ipv6 address auto global
配置静态路由,实现路由器之间互联互通
R1配置
1
2
3sys
// 配置静态路由,聚合后的地址
ipv6 route-static 2002:: 15 2001::2CR3配置
1
2
3sys
// 配置默认路由
ipv6 route-static :: 0 2002::1
R4配置
1
2
3sys
ipv6 route-static 2001:: 64 2003::1
ipv6 route-static 2002:: 64 2003::1
结果查看
查看接口
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18display ipv6 interface g0/0/0
<R1>dis ipv6 interface g0/0/0
GigabitEthernet0/0/0 current state : UP
IPv6 protocol current state : UP
IPv6 is enabled, link-local address is FE80::2E0:FCFF:FEB8:14E0
Global unicast address(es):
2001::1, subnet is 2001::/64
Joined group address(es):
FF02::1:FF00:1
FF02::2
FF02::1
FF02::1:FFB8:14E0
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
查看路由表
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77display ipv6 routing-table
// R1的路由表
<R1>dis ipv6 routing-table
Routing Table : Public
Destinations : 5 Routes : 5
Destination : ::1 PrefixLength : 128
NextHop : ::1 Preference : 0
Cost : 0 Protocol : Direct
RelayNextHop : :: TunnelID : 0x0
Interface : InLoopBack0 Flags : D
Destination : 2001:: PrefixLength : 64
NextHop : 2001::1 Preference : 0
Cost : 0 Protocol : Direct
RelayNextHop : :: TunnelID : 0x0
Interface : GigabitEthernet0/0/0 Flags : D
Destination : 2001::1 PrefixLength : 128
NextHop : ::1 Preference : 0
Cost : 0 Protocol : Direct
RelayNextHop : :: TunnelID : 0x0
Interface : GigabitEthernet0/0/0 Flags : D
Destination : 2002:: PrefixLength : 15
NextHop : 2001::2 Preference : 60
Cost : 0 Protocol : Static
RelayNextHop : :: TunnelID : 0x0
Interface : GigabitEthernet0/0/0 Flags : RD
Destination : FE80:: PrefixLength : 10
NextHop : :: Preference : 0
Cost : 0 Protocol : Direct
RelayNextHop : :: TunnelID : 0x0
Interface : NULL0 Flags : D
// R4的路由表
<R4>dis ipv6 routing-table
Routing Table : Public
Destinations : 6 Routes : 6
Destination : ::1 PrefixLength : 128
NextHop : ::1 Preference : 0
Cost : 0 Protocol : Direct
RelayNextHop : :: TunnelID : 0x0
Interface : InLoopBack0 Flags : D
Destination : 2001:: PrefixLength : 64
NextHop : 2003::1 Preference : 60
Cost : 0 Protocol : Static
RelayNextHop : :: TunnelID : 0x0
Interface : GigabitEthernet0/0/2 Flags : RD
Destination : 2002:: PrefixLength : 64
NextHop : 2003::1 Preference : 60
Cost : 0 Protocol : Static
RelayNextHop : :: TunnelID : 0x0
Interface : GigabitEthernet0/0/2 Flags : RD
Destination : 2003:: PrefixLength : 64
NextHop : 2003::2E0:FCFF:FE0B:6062 Preference : 0
Cost : 0 Protocol : Direct
RelayNextHop : :: TunnelID : 0x0
Interface : GigabitEthernet0/0/2 Flags : D
Destination : 2003::2E0:FCFF:FE0B:6062 PrefixLength : 128
NextHop : ::1 Preference : 0
Cost : 0 Protocol : Direct
RelayNextHop : :: TunnelID : 0x0
Interface : GigabitEthernet0/0/2 Flags : D
Destination : FE80:: PrefixLength : 10
NextHop : :: Preference : 0
Cost : 0 Protocol : Direct
RelayNextHop : :: TunnelID : 0x0
Interface : NULL0 Flags : D