这个小实验的要求很简单,实现的原理也很清晰。
6to4
通道相比之于配置隧道的有点就是自动建立隧道。通过特殊的编址,他能够从
ipv6
目的地址中提取出
ipv4
地址作为目的地址然后在
ipv4
网络上进行路由,这样就不用静态设置通道的目的地址了,确实节省了很多管理开销。
需要注意的地方:
(1)
ipv6
网络里的使用的地址必须是
2002
::
/16
的前缀,这是寻址的需要,因为建立
6to4
通道的路由器之间没有运行
Ipv6 IGP
路由协议,所有路由还是要靠静态,那么,前缀编编制就必须是
2002
::
/16
的形式,否则无法路由。
Ipv6
网络里的前缀要一致,要不然是肯定要出问题的。
(2)
tunnel
口无需设置目的地址,这是因为通道是一对多的形式,寻址是依靠特殊的编制地址来实现的,
2002
:
xxxx:xxxx::/48
内嵌的
ipv4
地址能够提取自动提取出来然后通过
Ipv4
域来路由到另一个通道终点。因此编制很重要,必须与通道的源地址对应起来,此外还留有
16
位的子网位,因此地址分配的空间还是很充足的。
(3)
关于
tunnel
的源地址,我个人觉得用环回口地址是比较好的,这样还可以提供一定的线路冗余
(
联想
bgp
对等体建立
)
。但是一定要跟
ipv6
地址做好映射,形成该ipv6
网络的/48
的前缀,这是6to4
能否成功的关键!
(4)
Tunnel
可以不需要
Ipv6
的地址的,但是必须支持
Ipv6
地址。
(5)
通道建立之后,在
6to4
路由器上建立一个静态路由指向
tunnel
,然后重发布此路由到自己的
ipv6
网络。(
ipv6 route 2002
::
/16 tunnel x
)
下面给出了配置。
R1:
ipv6 unicast-routing
!
interface Loopback0
ip address 12.1.1.1 255.255.255.0
ip ospf network point-to-point
!
interface Tunnel0
no ip address
no ip redirects
ipv6 unnumbered Serial1/0
ipv6 enable
tunnel source Loopback0
tunnel mode ipv6ip 6to4
!
interface Serial1/0
no ip address
ipv6 address 2002:C01:101:1::1/128
ipv6 ospf 10 area 0
serial restart-delay 0
! !
router ospf 10
router-id 1.1.1.1
log-adjacency-changes
passive-interface Loopback0
network 1.1.1.0 0.0.0.255 area 0
network 12.1.1.0 0.0.0.255 area 0
network 13.1.1.0 0.0.0.255 area 0
!
ipv6 route 2002:2301:101::/48 Tunnel0
ipv6 router ospf 10
router-id 1.1.1.1
log-adjacency-changes
redistribute static
!
R2:
ipv6 unicast-routing
!
interface Loopback0
no ip address
ipv6 address 2002:C01:101:2::1/128
ipv6 ospf network point-to-point
ipv6 ospf 10 area 0
!
interface FastEthernet0/1
no ip address
shutdown
duplex auto
speed auto
!
interface Serial1/0
no ip address
ipv6 address 2002:C01:101:1::2/128
ipv6 ospf 10 area 0
serial restart-delay 0
!
ipv6 router ospf 10
router-id 2.2.2.2
log-adjacency-changes
R3:
ipv6 unicast-routing
!
interface Loopback0
ip address 35.1.1.1 255.255.255.0
ip ospf network point-to-point
!
interface Tunnel0
no ip address
no ip redirects
ipv6 unnumbered Serial1/2
ipv6 enable
tunnel source Loopback0
tunnel mode ipv6ip 6to4
!
interface Serial1/1
ip address 13.1.1.3 255.255.255.0
serial restart-delay 0
!
interface Serial1/2
no ip address
ipv6 address 2002:2301:101:1::3/128
ipv6 ospf 10 area 0
serial restart-delay 0
!
router ospf 10
router-id 3.3.3.3
log-adjacency-changes
passive-interface Loopback0
network 3.3.3.0 0.0.0.255 area 0
network 13.1.1.0 0.0.0.255 area 0
network 35.1.1.0 0.0.0.255 area 0
!
ip classless
!
ip http server
no ip http secure-server
!
ipv6 route 2002:C01:101::/48 Tunnel0
ipv6 router ospf 10
router-id 3.3.3.3
log-adjacency-changes
redistribute static
!
R5:
ipv6 unicast-routing
!
interface Loopback0
no ip address
ipv6 address 2002:2301:101:2::1/128
ipv6 ospf network point-to-point
ipv6 ospf 10 area 0
!
interface Serial1/2
no ip address
ipv6 address 2002:2301:101:1::5/128
ipv6 ospf 10 area 0
serial restart-delay 0
!!
ip http server
no ip http secure-server
!
ipv6 router ospf 10
router-id 5.5.5.5
log-adjacency-changes
passive-interface Loopback0