组网拓扑:
pc1访问pc2,模拟企业分部ipv6网络通过公网ipv4访问企业总部ipv6网络
一、ipv6 over ipv4
1.配置各设备ip地址
2.配置ospf网络,使ar1的1.1.1.1与ar3的3.3.3.3 通
3.创建隧道
ar1:
interface Tunnel0/0/0
ipv6 enable
ipv6 address 8::8/64
tunnel-protocol ipv6-ipv4
source 1.1.1.1
destination 3.3.3.3
ar3:
interface Tunnel0/0/0
ipv6 enable
ipv6 address 9::9/64
tunnel-protocol ipv6-ipv4
source 3.3.3.3
destination 1.1.1.1
4.创建静态路由
ar1:
ipv6 route-static 2001:: 64 Tunnel 0/0/0
ar3:
ipv6 route-static 2000:: 64 Tunnel 0/0/0
5.测试
用pc1 ping pc2,在ar2上抓包,可以看到在ipv6报文之上封装了ipv4报文
二、ipv6 over ipv4 GRE
在实验一的基础上更改
1.更改隧道类型
ar1:
interface Tunnel0/0/0
ipv6 enable
ipv6 address 8::8/64
tunnel-protocol gre
source 1.1.1.1
destination 3.3.3.3
ar3:
interface Tunnel0/0/0
ipv6 enable
ipv6 address 9::9/64
tunnel-protocol gre
source 3.3.3.3
destination 1.1.1.1
##更改隧道类型,源和目的ip会丢失,需重新配置
2.测试
用pc1 ping pc2,在ar2上抓包,可以看到在ipv6报文之上封装了gre,gre上封装了ipv4报文
三、ipv6 over ipv4 ospf
在实验一的基础上更改
1.删除静态路由
ar1:
undo ipv6 route-static 2001:: 64 Tunnel0/0/0
ar3:
undo ipv6 route-static 2000:: 64 Tunnel0/0/0
2.启用ospfv3
ar1:
ospfv3 1
router-id 1.1.1.1
interface GigabitEthernet0/0/1
ipv6 enable
ipv6 address 2000::F/64
ospfv3 1 area 0.0.0.0
interface Tunnel0/0/0
ipv6 enable
ipv6 address 8::8/64
ospfv3 1 area 0.0.0.0
tunnel-protocol ipv6-ipv4
source 1.1.1.1
destination 3.3.3.3
ar3:
ospfv3 1
router-id 3.3.3.3
interface GigabitEthernet0/0/1
ipv6 enable
ipv6 address 2001::F/64
ospfv3 1 area 0.0.0.0
interface Tunnel0/0/0
ipv6 enable
ipv6 address 9::9/64
ospfv3 1 area 0.0.0.0
tunnel-protocol ipv6-ipv4
source 3.3.3.3
destination 1.1.1.1
3.查看ospfv3邻居
r1与r3同时运行了ospfv2、v3,隧道cost默认为1563,可以避免隧道环路
4.测试
用pc1 ping pc2,在ar2上抓包,可以看到ospfv3的hello报文