AR1:
[r1]ipv6 # 全局开启ipv6功能
[r1]interface LoopBack1
ip address 1.1.1.1 255.255.255.255
[r1]interface GigabitEthernet0/0/0
ip address 12.0.0.1 255.255.255.0
[r1]interface GigabitEthernet0/0/1
ipv6 enable
ipv6 address 2002:101:101:1::1/64
[r1]interface GigabitEthernet0/0/2
ipv6 enable
ipv6 address 1::1/64
[r1]ospf 1 router-id 1.1.1.1 # 原理上都是over ipv4所以要模拟公网都互通的情况下再行
area 0.0.0.0
network 1.1.1.1 0.0.0.0
network 12.0.0.1 0.0.0.0
[r1]interface Tunnel0/0/0 # 建立手动隧道gre
ipv6 enable
ipv6 address 11::1/64
tunnel-protocol gre
source 1.1.1.1
destination 3.3.3.3
[r1]interface Tunnel0/0/1 # 建立自动隧道6to4,地址规范要谨记,2002:固定前缀接32位ip地址
ipv6 enable
ipv6 address 2002:101:101::1/64
tunnel-protocol ipv6-ipv4 6to4
source 1.1.1.1 # 不需要对端地址自动隧道会根据报文推算出地址,也就是说如果对端不是一样的地址规范就需要中继
[r1]ipv6 route-static 3:: 64 Tunnel0/0/0 # 手动隧道路由 3:: 64地址范围过大具体按照项目要求规划
[r1]ipv6 route-static 2002:: 16 Tunnel0/0/1 # 自动隧道路由,2002:: 16地址范围过大具体按照项目要求规划
AR2:
[r2]interface GigabitEthernet0/0/0
ip address 12.0.0.2 255.255.255.0
[r2]interface GigabitEthernet0/0/1
ip address 23.0.0.1 255.255.255.0
[r2]interface GigabitEthernet0/0/2
ip address 24.0.0.1 255.255.255.0
[r2]interface LoopBack0
ip address 2.2.2.2 255.255.255.255
[r2]ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 12.0.0.2 0.0.0.0
network 23.0.0.1 0.0.0.0
network 24.0.0.1 0.0.0.0
AR3:
[r3]ipv6
[r3]interface GigabitEthernet0/0/0
ip address 23.0.0.2 255.255.255.0
[r3]interface GigabitEthernet0/0/1
ipv6 enable
ipv6 address 3::1/64
[r3]interface LoopBack0
ip address 3.3.3.3 255.255.255.255
[r3]ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 3.3.3.3 0.0.0.0
network 23.0.0.2 0.0.0.0
[r3]interface Tunnel0/0/0
ipv6 enable
ipv6 address 11::2/64
tunnel-protocol gre
source 3.3.3.3
destination 1.1.1.1
[r3]ipv6 route-static 1:: 64 Tunnel0/0/0
AR4:
[r4]ipv6
[r4]interface GigabitEthernet0/0/0
ip address 24.0.0.2 255.255.255.0
[r4]interface GigabitEthernet0/0/1
ipv6 enable
ipv6 address 2002:404:404:4::1/64
[r4]interface LoopBack0
ip address 4.4.4.4 255.255.255.255
[r4]ospf 1 router-id 4.4.4.4
area 0.0.0.0
network 4.4.4.4 0.0.0.0
network 24.0.0.2 0.0.0.0
[r4]interface Tunnel0/0/1
ipv6 enable
ipv6 address 2002:404:404::1/64
tunnel-protocol ipv6-ipv4 6to4
source 4.4.4.4
[r4]ipv6 route-static 1:: 16 2002:101:101::1 # 访问普通ipv6地址需要做中继,这条路由就是将下一跳指向中继路由也就是AR1,使用的依旧是自动隧道地址
[r4]ipv6 route-static 2002:: 16 Tunnel0/0/1
结果验证
作者:Zleoco,如若转载,请注明出处:https://www.zleoco.com/?p=2144