1、掌握 6to4 隧道的配置方法(GRE)
拓扑图:
配置各路由器的IPv4地址和IPv6地址,测试IPv4地址互连可达。
同时为IPv4网络配置RIP协议或者其它路由协议,保证IPv4网络可路由性,自行决定协议,能用就行,我这里用的是默认路由。
在R1上ping R3的S1/0接口:
R1#ping 192.168.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/52/140 ms
在R1和R3上配置GRE隧道,用于解决IPv6网络相互访问需求:
R1(config)#int tunnel 1 ---->启用GRE隧道接口1
R1(config-if)#ipv6 add 2001:ab1:0:2::1/64 ---->配置隧道的IPv6地址
R1(config-if)#tunnel source 192.168.1.1 ---->配置隧道源端口
R1(config-if)#tunnel destination 192.168.2.2 ---->配置隧道目标地址,必须可达,必须存在于IPv4路由表中
R1(config-if)#tunnel mode ipv6ip ----->配置隧道模式为IPv6 over ip模式,可选配置
R1(config-if)#no sh
R1(config-if)#exit
R3(config)#int tunnel 1
R3(config-if)#ipv6 add 2001:ab1:0:2::2/64
R3(config-if)#tunnel source s1/0 ---->可以使用本地端口号描述隧道源
R3(config-if)#tunnel destination 192.168.1.1
R3(config-if)#tunnel mode ipv6ip
R3(config-if)#no sh
R3(config-if)#exit
在R1或R3上使用ping命令测试隧道配置:
R1#ping 2001:ab1:0:2::2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:AB1:0:2::2, timeout is 2 seconds:
!!!!! ----->通~~~
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/63/112 ms
查看R3的IPv6路由表:
R3#show ipv6 rout
IPv6 Routing Table - 5 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
U - Per-user Static route, M - MIPv6
I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
D - EIGRP, EX - EIGRP external
C 2001:AB1:0:2::/64 [0/0]
via ::, Tunnel1
L 2001:AB1:0:2::2/128 [0/0]
via ::, Tunnel1 ----->指出可以通过隧道直接到达R1
C 2001:AB1:0:3::/64 [0/0]
via ::, Loopback0
L 2001:AB1:0:3::1/128 [0/0]
via ::, Loopback0
L FF00::/8 [0/0]
via ::, Null0
添加IPv6的静态路由:
R1(config)#ipv6 route 2001:ab1:0:3::/64 2001:ab1:0:2::2 ---->下一跳指定为隧道的对端地址
R3(config)#ipv6 route ::/0 2001:ab1:0:2::1 ---->默认路由
测试IPv6网络连通性:
R3#ping 2001:ab1:0:c::1 so 2001:ab1:0:3::1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:AB1:0:C::1, timeout is 2 seconds:
Packet sent with a source address of 2001:AB1:0:3::1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/52/96 ms
R3#ping 2001:ab1:0:9::1 so 2001:ab1:0:3::1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:AB1:0:9::1, timeout is 2 seconds:
Packet sent with a source address of 2001:AB1:0:3::1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/96/168 ms
R3#ping 2001:ab1:0:b::1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:AB1:0:B::1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/78/176 ms
R3#ping 2001:ab1:0:a::1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:AB1:0:A::1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/60/144 ms
一切正常。