组网需求
- 某公司通过部署OSPFv2实现IPv4网络的互联互通
- 为了保证业务的发展,同时部署IPv6网络,部署OSPFV3实现IPv6网络的互联互通
- 所有路由器运行OSPFv2和OSPFv3路由协议,整个自治系统分成3个区域
- 配置完成后,每台路由器都应该学到AS内所有网段的IPv4路由和IPv6路由
组网拓扑
配置思路
- 先配置IPv4网络
- 配置各个路由器基本功能以及接口IP地址
- 配置OSPFv2路由协议,Router-ID、区域号、宣告路由
- 再配置IPv6网络
- 配置全局使能IPv6功能,各个路由器接口配置IPv6链路本地地址和IPv6全球单播地址
- 配置OSPFv3路由协议,Router-ID
- 各个接口使能IPv6功能,配置OSPFv3进程和区域
配置命令
配置路由器基本功能以及接口IP地址
R1 配置
1
2
3
4
5sys
sys R1
int g0/0/0
ip add 10.1.12.1 30
R2 配置
1
2
3
4
5
6
7sys
sys R2
int g0/0/0
ip add 10.1.12.2 30
int g0/0/1
ip add 10.1.23.2 29
R3 配置
1
2
3
4
5
6
7sys
sys R3
int g0/0/0
ip add 10.1.23.3 29
int g0/0/1
ip add 10.1.35.3 29
R4 配置
1
2
3
4
5sys
sys R4
int g0/0/0
ip add 10.1.23.3 29R5配置
1
2
3
4
5sys
sys R5
int g0/0/1
ip add 10.1.35.5 29
配置OSPFv2路由器协议,Router-ID、区域号、宣告路由
R1配置
1
2
3
4
5sys
ospf 1 router-id 10.1.1.1
area 1
network 10.1.12.0 0.0.0.3
R2配置
1
2
3
4
5
6
7sys
ospf 1 router-id 10.1.2.2
area 1
network 10.1.12.0 0.0.0.3
area 0
network 10.1.23.0 0.0.0.7
R3配置
1
2
3
4
5
6
7sys
ospf 1 router-id 10.1.3.3
area 0
network 10.1.23.0 0.0.0.7
area 2
network 10.1.30.0 0.0.0.7
R4配置
1
2
3
4
5sys
ospf 1 router-id 10.1.4.4
area 0
network 10.1.23.0 0.0.0.7
R5配置
1
2
3
4
5sys
ospf 1 router-id 10.1.5.5
area 2
network 10.1.35.0 0.0.0.7
配置全局使能IPv6,接口使能,并配置接口地址
R1配置
1
2
3
4
5
6
7sys
ipv6
int g0/0/0
ipv6 enable
ipv6 address auto link-local
ipv6 address 2001:db8:2345:12::1/64
R2配置
1
2
3
4
5
6
7
8
9
10
11
12sys
ipv6
int g0/0/0
ipv6 enable
ipv6 addres auto link-local
ipv6 address 2001:db8:2345:12::2/64
int g0/0/1
ipv6 enable
ipv6 address auto link-local
ipv6 address 2001:db8:2345:23::2/64
R3配置
1
2
3
4
5
6
7
8
9
10
11
12sys
ipv6
int g0/0/0
ipv6 enable
ipv6 address auto link-local
ipv6 address 2001:db8:2345:23::3/64
int g0/0/1
ipv6 enable
ipv6 address auto link-local
ipv6 address 2001:db8:2345:35::3/64
R4配置
1
2
3
4
5
6
7sys
ipv6
int g0/0/0
ipv6 enable
ipv6 address auto link-local
ipv6 address 2001:db8:2345:23::4/64
R5配置
1
2
3
4
5
6
7sys
ipv6
int g0/0/1
ipv6 enable
ipv6 address auto link-local
ipv6 address 2001:db8:2345:35::5/64
配置OSPFv3路由协议
R1配置
1
2
3
4
5
6
7sys
ospfv3 1
router-id 10.1.1.1
quit
int g0/0/0
ospf 1 area 1
R2配置
1
2
3
4
5
6
7
8
9sys
ospfv3 1
router-id 10.1.2.2
quit
int g0/0/0
ospf 1 area 1
int g0/0/1
ospf 1 area 0
R3配置
1
2
3
4
5
6
7
8
9sys
ospfv3 1
router-id 10.1.3.3
quit
int g0/0/0
ospf 1 area 0
int g0/0/1
ospf 1 area 2
R4配置
1
2
3
4
5
6
7sys
ospf v3 1
router-id 10.1.4.4
quit
int g0/0/0
ospf 1 area 0
R5配置
1
2
3
4
5
6
7sys
ospfv3 1
router-id 10.1.5.5
quit
int g0/0/1
ospf 1 area 2
结果查看
查看OSPFv3网络邻居信息
1
2
3
4
5
6
7
8
9
10
11display ospfv3 peer
<R2>display ospfv3 peer
OSPFv3 Process (1)
OSPFv3 Area (0.0.0.0)
Neighbor ID Pri State Dead Time Interface Instance ID
10.1.3.3 1 Full/Backup 00:00:30 GE0/0/1 0
10.1.4.4 1 Full/DROther 00:00:39 GE0/0/1 0
OSPFv3 Area (0.0.0.1)
Neighbor ID Pri State Dead Time Interface Instance ID
10.1.1.1 1 Full/DR 00:00:36 GE0/0/0 0
查看OSPFv3的路由信息
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16display ospfv3 routing
<R2>display ospfv3 routing
Codes : E2 - Type 2 External, E1 - Type 1 External, IA - Inter-Area,
N - NSSA, U - Uninstalled
OSPFv3 Process (1)
Destination Metric
Next-hop
2001:DB8:2345:12::/64 1
directly connected, GigabitEthernet0/0/0
2001:DB8:2345:23::/64 1
directly connected, GigabitEthernet0/0/1
IA 2001:DB8:2345:35::/64 2
via FE80::2E0:FCFF:FE12:5C65, GigabitEthernet0/0/1
查看OSPFv3的LSDB信息
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
65display ospfv3 lsdb
<R2>display ospfv3 lsdb
* indicates STALE LSA
OSPFv3 Router with ID (10.1.2.2) (Process 1)
Link-LSA (Interface GigabitEthernet0/0/0)
Link State ID Origin Router Age Seq# CkSum Prefix
0.0.0.3 10.1.1.1 0985 0x80000005 0x771d 1
0.0.0.3 10.1.2.2 0933 0x80000005 0xefe0 1
Link-LSA (Interface GigabitEthernet0/0/1)
Link State ID Origin Router Age Seq# CkSum Prefix
0.0.0.4 10.1.2.2 0924 0x80000005 0x8439 1
0.0.0.3 10.1.3.3 0872 0x80000005 0xb675 1
0.0.0.3 10.1.4.4 0821 0x80000005 0x1bfc 1
Router-LSA (Area 0.0.0.0)
Link State ID Origin Router Age Seq# CkSum Link
0.0.0.0 10.1.2.2 0815 0x8000000a 0x846a 1
0.0.0.0 10.1.3.3 0822 0x8000000a 0x6984 1
0.0.0.0 10.1.4.4 0815 0x80000008 0x5d91 1
Network-LSA (Area 0.0.0.0)
Link State ID Origin Router Age Seq# CkSum
0.0.0.4 10.1.2.2 0815 0x80000006 0xfcdc
Inter-Area-Prefix-LSA (Area 0.0.0.0)
Link State ID Origin Router Age Seq# CkSum
0.0.0.1 10.1.2.2 0924 0x80000005 0xcab5
0.0.0.1 10.1.3.3 0790 0x80000005 0x3625
Intra-Area-Prefix-LSA (Area 0.0.0.0)
Link State ID Origin Router Age Seq# CkSum Prefix Reference
0.0.0.1 10.1.2.2 0814 0x8000000a 0xc85e 1 Network-LSA
Router-LSA (Area 0.0.0.1)
Link State ID Origin Router Age Seq# CkSum Link
0.0.0.0 10.1.1.1 0926 0x80000008 0x47b0 1
0.0.0.0 10.1.2.2 0922 0x80000009 0x3bb8 1
Network-LSA (Area 0.0.0.1)
Link State ID Origin Router Age Seq# CkSum
0.0.0.3 10.1.1.1 0926 0x80000005 0xac4c
Inter-Area-Prefix-LSA (Area 0.0.0.1)
Link State ID Origin Router Age Seq# CkSum
0.0.0.1 10.1.2.2 0864 0x80000005 0xfd71
0.0.0.2 10.1.2.2 0788 0x80000006 0x3d1d
Intra-Area-Prefix-LSA (Area 0.0.0.1)
Link State ID Origin Router Age Seq# CkSum Prefix Reference
0.0.0.1 10.1.1.1 0925 0x80000007 0xfa45 1 Network-LSA