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#