组网需求
- 配置R1、R2的接口IP地址
- 在R1、R2上分别配置OSPFv2和OSPFv3,实现PC1与PC2的双栈访问
组网拓扑
配置思路
- R1、R2全局和相关接口使能IPv6功能
- 在PC、R1、R2相应接口配置IPv4和IPv6全球单播地址
- 在R1、R2上配置OSPFv2,PC1、PC2可以通过IPv4网络通信
- 在R1、R2上配置OSPFv3,PC1、PC2可以通过IPv6网络通信
配置命令
配置R1、R2全局和接口使能IPv6功能
R1配置
1
2
3
4
5
6
7
8sys
sys R1
ipv6
int g0/0/0
ipv6 enable
int g0/0/1
ipv6 enable
R2配置
1
2
3
4
5
6
7
8sys
sys R2
ipv6
int g0/0/0
ipv6 enable
int g0/0/1
ipv6 enable
在PC1、R1、R2相应接口配置IPv4和IPv6全球单播地址
R1配置
1
2
3
4
5
6
7sys
int g0/0/0
ip add 10.0.12.1 30
ipv6 add 2001:db8:1::1/64
int g0/0/1
ip add 192.168.1.1 30
ipv6 add 2001:db8:2::1/64
R2配置
1
2
3
4
5
6
7sys
int g0/0/0
ip add 10.0.12.2 30
ipv6 add 2001:db8:1::2/64
int g0/0/1
ip add 192.168.2.1 30
ipv6 add 2001:db8:3::1/64
在R1、R2上配置OSPFv2、OSPFv3,使得网络互通
R1配置
1
2
3
4
5
6
7
8
9
10
11
12
13sys
ospf router-id 10.0.1.1
area 0
network 10.0.12.0 0.0.0.3
network 192.168.1.0 0.0.0.3
ospfv3
router-id 10.0.1.1
int g0/0/0
ospfv3 1 area 0
int g0/0/1
ospfv3 1 area 0
R2配置
1
2
3
4
5
6
7
8
9
10
11
12
13sys
ospf router-id 10.0.2.2
area 0
network 10.0.12.0 0.0.0.3
network 192.168.2.0 0.0.0.3
ospfv3
router-id 10.0.2.2
int g0/0/0
ospfv3 1 area 0
int g0/0/1
ospfv3 1 area 0
查看结果
PC1 ping PC2(IPv4网络)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16ping 192.168.2.2
PC>ping 192.168.2.2
Ping 192.168.2.2: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.2.2: bytes=32 seq=2 ttl=126 time=16 ms
From 192.168.2.2: bytes=32 seq=3 ttl=126 time=15 ms
From 192.168.2.2: bytes=32 seq=4 ttl=126 time=16 ms
From 192.168.2.2: bytes=32 seq=5 ttl=126 time=16 ms
--- 192.168.2.2 ping statistics ---
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 0/15/16 ms
PC1 ping PC2(IPv6网络)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16ping 2001:db8:3::2
PC>ping 2001:db8:3::2
Ping 2001:db8:3::2: 32 data bytes, Press Ctrl_C to break
From 2001:db8:3::2: bytes=32 seq=1 hop limit=253 time=31 ms
From 2001:db8:3::2: bytes=32 seq=2 hop limit=253 time=32 ms
From 2001:db8:3::2: bytes=32 seq=3 hop limit=253 time=15 ms
From 2001:db8:3::2: bytes=32 seq=4 hop limit=253 time=16 ms
From 2001:db8:3::2: bytes=32 seq=5 hop limit=253 time=16 ms
--- 2001:db8:3::2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 15/22/32 ms