组网需求
如图1,两个IPv6网络分别通过SwitchA和SwitchC与IPv4公网中的SwitchB连接,客户希望两个IPv6网络中的PC1和PC2实现互通。
其中PC1和PC2上分别指定SwitchA和SwitchC为自己的缺省网关。
配置思路
要实现IPv6协议中的PC1和PC2通过IPv4公网互通。需要在SwitchA和SwitchC之间建立直连链路,部署GRE隧道,通过静态路由指定到达对端的报文通过Tunnel接口转发,PC1和PC2就可以互相通信了。
配置GRE隧道实现IPv6协议互通的思路如下:
-
配置物理接口的IP地址,并配置IPv4静态路由,实现设备可以通过IPv4网络通信。
操作步骤
#
sysname SwitchA
#
ipv6
#
vlan batch 10 30
#
interface Vlanif10
ip address 20.1.1.1 255.255.255.0
#
interface Vlanif30
ipv6 enable
ipv6 address FC00:1::1/64
#
interface Eth-Trunk1
service type tunnel
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 30
#
interface GigabitEthernet0/0/3
eth-trunk 1
#
interface Tunnel 0/0/0
ipv6 enable
ipv6 address 2001:db8:1::1/64
tunnel-protocol gre
source 20.1.1.1
destination 30.1.1.2
eth-trunk 1
#
ip route-static 30.1.1.0 255.255.255.0 20.1.1.2
#
ipv6 route-static FC00:2:: 64 Tunnel0/0/0
#
return
#
sysname SwitchB
#
vlan batch 10 20
#
interface Vlanif10
ip address 20.1.1.2 255.255.255.0
#
interface Vlanif20
ip address 30.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 20
#
return
#
sysname SwitchC
#
ipv6
#
vlan batch 20 30
#
interface Vlanif20
ip address 30.1.1.2 255.255.255.0
#
interface Vlanif30
ipv6 enable
ipv6 address FC00:2::1/64
#
interface Eth-Trunk1
service type tunnel
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 20
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 30
#
interface GigabitEthernet0/0/3
eth-trunk 1
#
interface Tunnel0/0/0
ipv6 enable
ipv6 address 2001:db8:1::2/64
tunnel-protocol gre
source 30.1.1.2
destination 20.1.1.1
eth-trunk 1
#
ip route-static 20.1.1.0 255.255.255.0 30.1.1.1
#
ipv6 route-static FC00:1:: 64 Tunnel0/0/0
#
return