您的位置:首页 > 理论基础 > 计算机网络

隧道模式下IPv6穿越IPv4网络的技术分析与实现

2009-03-14 20:36 726 查看




IPv6/IPv4 隧道技术的目的是利用现有的IPv4设施来为IPv6主机服务,使得各个分散的IPv6“孤岛”可以跨越IPv4网络相互通信。在IPv6封包通过 IPv4网络时,无论哪种隧道机制都是使用了一个“封包——拆包”过程,即处于发送端的隧道端点将该IPv6封包封装在IPv4包中,将此IPv6包视为 IPv4的负载数据,并将该IPv4包头的协议字段设置为41,以说明该IPv4封包的负载是一个IPv6封装包,然后在IPv4网络上传送该封装包。当协议字段标为41的IPv4封装包到达处于接收端的Tunnel端点时,该端点拆掉封装包的IPv4包头,取出IPv6封装包继续处理。

试验目的:验证隧道模式下IPv6穿越IPv4(R3)网络
试验拓扑:就是上边那个了 呵呵! 标明的很清楚。
过程如下……..

首先在R2、R3、R4之间建立ipv4网络

router2(config)#interface e0/1
router2(config-if)#ip address <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />2.2.2.1 255.255.255.0
router2(config-if)#no shut
router2(config-if)#

router3(config)#interface e0/1
router3(config-if)#ip address 2.2.2.2 255.255.255.0
router3(config-if)#no shu
router3(config-if)#no shutdown
router3(config-if)#exit
router3(config)#inter
router3(config)#interface e0/0
router3(config-if)#ip address 3.3.3.2 255.255.255.0
router3(config-if)#no shut
router3(config-if)#

router4(config)#interface e0/0
router4(config-if)#ip address 3.3.3.1 255.255.255.0
router4(config-if)#no shut
router4(config-if)#no shut
router4(config-if)#no shutdown

在R2、R4上启用静态路由,使网络连同
router2(config)#ip route 3.3.3.0 255.255.255.0 2.2.2.2
router4(config)#ip route 2.2.2.0 255.255.255.0 3.3.3.2

ping一下
router2#ping 3.3.3.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.1, timeout is 2 seconds:
!!!!!
router4#ping 2.2.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.1, timeout is 2 seconds:
!!!!!
呵呵 都通了!

好了,现在开始打隧道了
分别在R2、R4上
router2(config)#interface tunnel 0
router2(config-if)#no ip address
router2(config-if)#ipv6 address 2001:250:803:1::1/64
router2(config-if)#tunnel source 2.2.2.1 (R2 e0/1)
router2(config-if)#tunnel destination 3.3.3.1 (R4 e0/0)
router2(config-if)#tunnel mode ipv6ip

router4(config)#interface tunnel 1
router4(config-if)#no ip address
router4(config-if)#ipv6 address 2001:250:803:1::2/64
router4(config-if)#tunnel source 3.3.3.1 (R4 e0/0)
router4(config-if)#tunnel destination 2.2.2.1 (R2 e0/1)
router4(config-if)#tunnel mode ipv6ip

验证一下
router2#ping 2001:250:803:1::2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:250:803:1::2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 52/223/376 ms
router4#ping 2001:250:803:1::1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:250:803:1::1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 52/205/396 ms
Ok 了

接着在R1、R2、R4、R5上配上ipv6地址
roueter1(config)#ipv6 unicast-routing
roueter1(config)#interface e0/0
roueter1(config-if)#ipv6 address 2001:250:803:11::1/64
roueter1(config-if)#no shut

router2(config)#ipv6 unicast-routing
router2(config)#interface e0/0
router2(config-if)#ipv6 address 2001:250:803:11::2/64
router2(config-if)#no shut

router4(config)#ipv6 unicast-routing
router4(config)#interface e0/1
router4(config-if)#ipv6 address 2001:250:803:12::1/64
router4(config-if)#no shut

router5(config)#ipv6 unicast-routing
router5(config)#interface e0/1
router5(config-if)#ipv6 address 2001:250:803:12::2/64
router5(config-if)#no shut

然后配置静态路由,没几条很简单,和ipv4的思想几乎一样。
注意:在配的时候我们可以把R3忽略,就当R2、R4之间没有路由器,
这样配起来会很顺啊!

router5(config)#ipv6 route 2001:250:803:1::/64 2001:250:803:12::1
router5(config)#ipv6 route 2001:250:803:11::/64 2001:250:803:12::1
router2(config)#ipv6 route 2001:250:803:12::/64 2001:250:803:1::2
roueter1(config)#ipv6 route 2001:250:803:1::/64 2001:250:803:11::2
roueter1(config)#ipv6 route 2001:250:803:12::/64 2001:250:803:11::2
router4(config)#ipv6 route 2001:250:803:11::/64 2001:250:803:1::1

好了,验证一下吧
R1 ping R5

router1#ping 2001:250:803:12::2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:250:803:12::2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 48/110/216 ms

R1 ping R4的TUNNEL1

router1#ping 2001:250:803:1::2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:250:803:1::2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 36/86/216 ms

通了
router5#show ipv6 route
IPv6 Routing Table - 6 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
S 2001:250:803:1::/64 [1/0]
via 2001:250:803:12::1
S 2001:250:803:11::/64 [1/0]
via 2001:250:803:12::1
C 2001:250:803:12::/64 [0/0]
via ::, Ethernet0/1
L 2001:250:803:12::2/128 [0/0]
via ::, Ethernet0/1
L FE80::/10 [0/0]
via ::, Null0
L FF00::/8 [0/0]
via ::, Null0

router4#show 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, 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 2001:250:803:1::/64 [0/0]
via ::, Tunnel1
L 2001:250:803:1::2/128 [0/0]
via ::, Tunnel1
S 2001:250:803:11::/64 [1/0]
via 2001:250:803:1::1
C 2001:250:803:12::/64 [0/0]
via ::, Ethernet0/1
L 2001:250:803:12::1/128 [0/0]
via ::, Ethernet0/1
L FE80::/10 [0/0]
via ::, Null0
L FF00::/8 [0/0]
via ::, Null0

上面的静态路由也可以用动态路由,如下:
router1(config)#ipv6 router rip qq
router1(config-rtr)#exit
router1(config)#interface e0/0
router1(config-if)#ipv6 rip qq enable

router2(config)#ipv6 router rip qq
router2(config-rtr)#exit
router2(config)#interface e0/0
router2(config-if)#ipv6 rip qq enable

router4(config)#ipv6 router ospf 1
router4(config-rtr)#ex
router4(config)#interface e0/1
router4(config-if)#ipv6 ospf 1 area 0

router5(config)#ipv6 router ospf 1
router5(config-rtr)#ex
router5(config)#interface e0/1
router5(config-if)#ipv6 ospf 1 area 0

但是还是需要几条静态路由才能打通
router5(config)#ipv6 route 2001:250:803:11::/64 2001:250:803:12::1
router2(config)#ipv6 route 2001:250:803:12::/64 2001:250:803:1::2
roueter1(config)#ipv6 route 2001:250:803:1::/64 2001:250:803:11::2
router4(config)#ipv6 route 2001:250:803:11::/64 2001:250:803:1::1

最后还要在动态路由协议下重分发一下
router2(config)#ipv6 router rip qq
router2(config-rtr)#redistribute static

router5(config)#ipv6 router ospf 1
router5(config-rtr)#redistribute static

验证得
router1#show ipv6 ro
IPv6 Routing Table - 6 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
S 2001:250:803:1::/64 [1/0]
via 2001:250:803:11::2
C 2001:250:803:11::/64 [0/0]
via ::, Ethernet0/0
L 2001:250:803:11::1/128 [0/0]
via ::, Ethernet0/0
R 2001:250:803:12::/64 [120/2]
via FE80::CE00:FFF:FEB8:0, Ethernet0/0
L FE80::/10 [0/0]
via ::, Null0
L FF00::/8 [0/0]
via ::, Null0

router5#show ipv6 route
IPv6 Routing Table - 6 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
S 2001:250:803:1::/64 [1/0]
via 2001:250:803:12::1
OE2 2001:250:803:11::/64 [110/20]
via FE80::CE00:DFF:FEF0:0, Ethernet0/1

C 2001:250:803:12::/64 [0/0]
via ::, Ethernet0/1
L 2001:250:803:12::2/128 [0/0]
via ::, Ethernet0/1
L FE80::/10 [0/0]
via ::, Null0
L FF00::/8 [0/0]
via ::, Null0
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: