分类: 系统运维
2008-05-21 08:51:06
使用cisco路由器实现IPV6 tunnel
说明:此案例使用两台cisco2500路由器,IOS (tm) 2500 Software (C2500-IS-L), Version 12.2(15)T9,利用ip v4主干加ipv6的6to4 tunnel结合ipv6静态路由,就能实现两个远程ipv6子网的互连互通.
拓扑说明:使用两台路由器的e0接口互连仿真ipv4的 主干,使用loopback0仿真两个远程的ipv6子网,6to4tunnel必须在所有的ipv6子网使用标准的ipv6地址前缀(2002::/16)进行编址.
在两个端点建立tunnel时,必须使用本地路由器的ipv4接口的ip地址结合2002前缀来对本路由器的tunnel接口做编址.例如R1的e0:192.168.1.1,则R1的tunnel接口的ipv6地址一定要包含此地址的16进制格式,即2002:C0A8:101:…,其中C0A8:101即为e0接口ip地址的16进制.
配置和测试结果如下:
R1#sh run
hostname R1
ipv6 unicast-routing
interface Loopback0
no ip address
ipv6 address 2002:C0A8:101:1::1/64
interface Tunnel0
no ip address
no ip redirects
ipv6 address 2002:C0A8:101:13::1/64
tunnel source Ethernet0
tunnel mode ipv6ip 6to4
interface Ethernet0
ip address 192.168.1.1 255.255.255.0
ipv6 route 2002::/16 Tunnel0
R1#sh ipv6 int brief
Ethernet0 [up/up]
unassigned
Loopback0 [up/up]
FE80::210:7BFF:FE36:491
2002:C0A8:101:1::1
Tunnel0 [up/up]
FE80::C0A8:101
2002:C0A8:101:13::1
Virtual-Access1 [up/up]
unassigned
R1#sh ipv6 route
IPv6 Routing Table - 8 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
O - OSPF intra, OI - OSPF inter, OE1 - OSPF
ext 1, OE2 - OSPF ext 2
S 2002::/16 [1/0]
via ::, Tunnel0
C 2002:C0A8:101:1::/64 [0/0]
via ::, Loopback0
L 2002:C0A8:101:1::1/128 [0/0]
via ::, Loopback0
C 2002:C0A8:101:13::/64 [0/0]
via ::, Tunnel0
L 2002:C0A8:101:13::1/128 [0/0]
via ::, Tunnel0
L FE80::/10 [0/0]
via ::, Null0
L FF00::/8 [0/0]
via ::, Null0
r3#sh run
hostname r3
ipv6 unicast-routing
interface Loopback0
no ip address
ipv6 address 2002:C0A8:103:3::3/64
interface Tunnel0
no ip address
no ip redirects
ipv6 address 2002:C0A8:103:13::3/64
tunnel source Ethernet0
tunnel mode ipv6ip 6to4
interface Ethernet0
ip address 192.168.1.3 255.255.255.0
ipv6 route 2002::/16 Tunnel0
r3#sh ipv6 int brief
Ethernet0 [up/up]
unassigned
Loopback0 [up/up]
FE80::200:CFF:FE0A:26BC
2002:C0A8:103:3::3
Serial0 [administratively
down/down]
unassigned
Serial1 [administratively
down/down]
unassigned
Tunnel0 [up/up]
FE80::C0A8:103
2002:C0A8:103:13::3
Virtual-Access1 [up/up]
unassigned
r3#sh ipv6 route
IPv6 Routing Table - 7 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
O - OSPF intra, OI - OSPF inter, OE1 - OSPF
ext 1, OE2 - OSPF ext 2
S 2002::/16 [1/0]
via ::, Tunnel0
C 2002:C0A8:103:3::/64 [0/0]
via ::, Loopback0
L 2002:C0A8:103:3::3/128 [0/0]
via ::, Loopback0
C 2002:C0A8:103:13::/64 [0/0]
via ::, Tunnel0
L 2002:C0A8:103:13::3/128 [0/0]
via ::, Tunnel0
L FE80::/10 [0/0]
via ::, Null0
L FF00::/8 [0/0]
via ::, Null0
在R1上测试直连的ipv6 tunnel接口:
R1#ping ipv6 2002:c0a8:103:13::3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to
2002:C0A8:103:13::3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip
min/avg/max = 8/10/16 ms
在R1上测试到R3的ipv6 loopback0接口(非直连):
R1#ping ipv6 2002:c0a8:103:3::3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to
2002:C0A8:103:3::3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip
min/avg/max = 8/12/16 ms