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
|