6to4机制的特点是:
1、 自动隧道机制
2、在站点边缘启用,6to4的路由器通过IPv4网络到达对方。
3、自动前缀分配,所有前缀均使用2002::/16,IPv4的地址转换为16进制附在2002::/16后面.最终表现形式是2002:ipv4-address::/48。
4、没有IPv6路由传播,每个前缀都是基于IPv4地址,因此IPv4的路由域已经足够使用。
本实验目的:通过6to4隧道连接2个IPv6网络:
实验拓扑如下:
R4路由器连接的IPv6网络所属网段为2002:0202:0202::/48(可划分出65535个子网);
R5路由器连接的IPv6网络所属网段为2002:0303:0303::/48(可划分出65535个子网);
这两个IPv6网络之间要通信,可通过穿透IPv4 Internet建立6to4隧道。
R1、R2、R3运行OSPFv2来完成整个IPv4网络的可达性;而IPv6网络分别运行OSPFv3来完成各自内部的可达性。
以下为每个路由器完整配置:
配置R2:
ipv6 unicast-routing
interface Tunnel0
ipv6 enable
tunnel source Loopback0
tunnel mode ipv6ip 6to4
!
interface Loopback0
ip address 2.2.2.2 255.255.255.0
!
interface Serial1/0
ip address 12.1.1.2 255.255.255.0
!
interface Serial1/1
ip ospf 1 area 0
ipv6 enable
ipv6 ospf 1 area 0
router ospf 1
log-adjacency-changes
network 0.0.0.0 255.255.255.255 area 0
ipv6 route 2002:303:303::/48 Tunnel0
ipv6 router ospf 1
log-adjacency-changes
redistribute static //将静态路由重发布进OSPF,以使网络内部(R4)获得对端路由
配置R3:
ipv6 unicast-routing
interface Tunnel0
ipv6 enable
tunnel source Loopback0
tunnel mode ipv6ip 6to4
!
interface Loopback0
ip address 3.3.3.3 255.255.255.0
!
interface Serial1/0
ip address 13.1.1.3 255.255.255.0
!
interface Serial1/1
ipv6 enable
ipv6 ospf 1 area 0
!
router ospf 1
log-adjacency-changes
network 0.0.0.0 255.255.255.255 area 0
ipv6 route 2002:202:202::/48 Tunnel0
ipv6 router ospf 1
log-adjacency-changes
redistribute static //将静态路由重发布进OSPF,以使网络内部(R5)获得对端路由
配置R4:
ipv6 unicast-routing
interface Loopback0
ip address 4.4.4.4 255.255.255.0
!
interface Ethernet0/0
ipv6 address 2002:202:202:4::4/64
ipv6 enable
ipv6 ospf 1 area 0
no keepalive
!
interface Serial1/0
ipv6 enable
ipv6 ospf 1 area 0
ipv6 router ospf 1
router-id 4.4.4.4
配置R5:
ipv6 unicast-routing
interface Loopback0
ip address 5.5.5.5 255.255.255.0
!
interface Ethernet0/0
ipv6 address 2002:303:303:5::5/64
ipv6 ospf 1 area 0
no keepalive
!
interface Serial1/0
ipv6 enable
ipv6 ospf 1 area 0
!
ipv6 router ospf 1
router-id 5.5.5.5
查看R4,R5的路由表:
r4#show ipv6 route
IPv6 Routing Table - 5 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
U - Per-user Static route
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
C 2002:202:202:4::/64 [0/0]
via ::, Ethernet0/0
L 2002:202:202:4::4/128 [0/0]
via ::, Ethernet0/0
OE2 2002:303:303::/48 [110/20]
via FE80::CE00:FFF:FE88:0, Serial1/0
L FE80::/10 [0/0]
via ::, Null0
L FF00::/8 [0/0]
via ::, Null0
r5#show ipv6 route
IPv6 Routing Table - 5 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
U - Per-user Static route
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
OE2 2002:202:202::/48 [110/20]
via FE80::CE00:FFF:FE34:0, Serial1/0
C 2002:303:303:5::/64 [0/0]
via ::, Ethernet0/0
L 2002:303:303:5::5/128 [0/0]
via ::, Ethernet0/0
L FE80::/10 [0/0]
via ::, Null0
L FF00::/8 [0/0]
via ::, Null0
检查R4、R5的路由表,可见均已经有对应网络的路由信息:
用PING命令测试网络连通性:
r4#ping 2002:303:303:5::5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2002:303:303:5::5, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 240/410/504 ms
r4#
r5#ping 2002:202:202:4::4
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2002:202:202:4::4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 280/432/632 ms
r5#