实验拓扑
- R1-R3-R2之间的网络为IPv4环境;
- PC1及PC2处于IPv6孤岛。
实验需求
- R1及R2为IPv6/IPv4双栈设备;
- 在R1及R2上部署IPv6 over IPv4手工隧道使得PC1及PC2能够互相访问。
配置及实现
R3的配置如下
[R3] interface GigabitEthernet0/0/0
[R3-GigabitEthernet0/0/0] ip address 10.1.1.2 24
[R3] interface GigabitEthernet0/0/1
[R3-GigabitEthernet0/0/1] ip address 10.2.2.1 24
R1的配置如下:
完成IPv4接口部分的配置:
[R1] interface GigabitEthernet0/0/0
[R1-GigabitEthernet0/0/0] ip address 10.1.1.1 24
[R1] ip route-static 0.0.0.0 0 10.1.1.2 #配置IPv4默认路由
完成IPv6接口部分的配置
[R1] ipv6 #全局激活IPv6
[R1] interface GigabitEthernet0/0/1
[R1-GigabitEthernet0/0/1] ipv6 enable #激活接口的IPv6功能
[R1-GigabitEthernet0/0/1] ipv6 address 2001:1111::FFFF 64 #配置IPv6全局单播地址
配置Tunnel:
[R1] Interface tunnel 0/0/0
[R1-Tunnel0/0/0] tunnel-protocol ipv6-ipv4 #隧道类型为IPv6overIPv4
[R1-Tunnel0/0/0] ipv6 enable
[R1-Tunnel0/0/0] source 10.1.1.1 #隧道的源IPv4地址
[R1-Tunnel0/0/0] destination 10.2.2.2 #隧道的目的IPv4地址
[R1-Tunnel0/0/0] ipv6 address auto link-local #注意如果不为tunnel口配置全局单播地址则必须为接口配置linklocal地址,否则接口的ipv6协议状态为down,如果配置了全局单播地址则系统将自动配置linklocal地址,因此无需再配置这条命令。
[R1] Ipv6 route-static 2001:2222:: 64 tunnel 0/0/0
R2的配置如下:
完成IPv4接口部分的配置:
[R2] interface GigabitEthernet0/0/0
[R2-GigabitEthernet0/0/0] ip address 10.2.2.2 24
[R2] ip route-static 0.0.0.0 0 10.2.2.1
完成IPv6接口部分的配置
[R2] ipv6
[R2] interface GigabitEthernet0/0/1
[R2-GigabitEthernet0/0/1] ipv6 enable
[R2-GigabitEthernet0/0/1] ipv6 address 2001:2222::FFFF 64
开始配置Tunnel:
[R2 Interface tunnel 0/0/0
[R2-Tunnel0/0/0] tunnel-protocol ipv6-ipv4
[R2-Tunnel0/0/0] ipv6 enable
[R2-Tunnel0/0/0] source 10.2.2.2
[R2-Tunnel0/0/0] destination 10.1.1.1
[R2-Tunnel0/0/0] ipv6 address auto link-local
[R2] Ipv6 route-static 2001:1111:: 64 tunnel 0/0/0
完成配置后,做一些基本的验证及查看:
<R1>display ipv6 interface brief
*down: administratively down
(l): loopback
(s): spoofing
Interface Physical Protocol
GigabitEthernet0/0/1 up up
[IPv6 Address] 2001:1111::FFFF
Tunnel0/0/0 up up
[IPv6 Address] FE80::A01:C01
以上输出的是R1上接口IPv6摘要信息,可以看到为GE0/0/0口配置的IPv6地址,以及Tunnel0/0/0口的链路本地地址。
PC1>ping 2001:2222::1
Ping 2001:2222::1 32 data bytes, Press Ctrl_C to break
From 2001:2222::1 bytes=32 seq=1 hop limit=64 time<2 ms
From 2001:2222::1: bytes=32 seq=2 hop limit=64 time=2 ms
From 2001:2222::1: bytes=32 seq=3 hop limit=64 time=2 ms
From 2001:2222::1: bytes=32 seq=4 hop limit=64 time<2 ms
From 2001:2222::1: bytes=32 seq=5 hop limit=64 time<2 ms
报文的传输如下图所示: