As shown in Figure 1, SwitchA and SwitchB connect to a 6to4 network, respectively. SwitchA and SwitchB are 6to4 switches and connect to SwitchC deployed on an IPv4 backbone network. A 6to4 tunnel needs to be set up between SwitchA and SwitchB so that the two IPv6 hosts connected to SwitchA and SwitchB can communicate with each other over the IPv4 backbone network.
The configuration roadmap is as follows:
Configure the IPv4 network. Configure IPv4 addresses and static routes for interfaces so that SwitchA, SwitchB, and SwitchC can communicate with each other.
Configure IPv6 networks. Configure IPv6 addresses of SwitchA and SwitchB to ensure that SwitchA and SwitchB can communicate with the connected IPv6 hosts.
Configure a 6to4 tunnel. Configure IPv6 addresses, protocol types, source interfaces, and destination addresses for tunnel interfaces so that IPv6 packets can be forwarded on the IPv4 backbone network.
Configure a static route for forwarding IPv6 packets to the 6to4 tunnel.
# Configure SwitchA.
<HUAWEI> system-view [HUAWEI] sysname SwitchA [SwitchA] vlan batch 100 [SwitchA] interface gigabitethernet 0/0/1 [SwitchA-GigabitEthernet0/0/1] port link-type hybrid [SwitchA-GigabitEthernet0/0/1] port hybrid pvid vlan 100 [SwitchA-GigabitEthernet0/0/1] port hybrid untagged vlan 100 [SwitchA-GigabitEthernet0/0/1] quit [SwitchA] interface vlanif 100 [SwitchA-Vlanif100] ip address 10.1.1.1 24 [SwitchA-Vlanif100] quit [SwitchA] ip route-static 10.3.1.2 255.255.255.0 10.1.1.2
# Configure SwitchB.
<HUAWEI> system-view [HUAWEI] sysname SwitchB [SwitchB] vlan batch 300 [SwitchB] interface gigabitethernet0/0/1 [SwitchB-GigabitEthernet0/0/1] port link-type hybrid [SwitchB-GigabitEthernet0/0/1] port hybrid pvid vlan 300 [SwitchB-GigabitEthernet0/0/1] port hybrid untagged vlan 300 [SwitchB-GigabitEthernet0/0/1] quit [SwitchB] interface vlanif 300 [SwitchB-Vlanif300] ip address 10.3.1.2 24 [SwitchB-Vlanif300] quit [SwitchB] ip route-static 10.1.1.1 255.255.255.0 10.3.1.1
# Configure SwitchC.
<HUAWEI> system-view [HUAWEI] sysname SwitchC [SwitchC] vlan batch 100 300 [SwitchC] interface vlanif 100 [SwitchC-Vlanif100] ip address 10.1.1.2 24 [SwitchC-Vlanif100] quit [SwitchC] interface vlanif 300 [SwitchC-Vlanif300] ip address 10.3.1.1 24 [SwitchC-Vlanif300] quit [SwitchC] interface gigabitethernet0/0/1 [SwitchC-GigabitEthernet0/0/1] port link-type hybrid [SwitchC-GigabitEthernet0/0/1] port hybrid pvid vlan 100 [SwitchC-GigabitEthernet0/0/1] port hybrid untagged vlan 100 [SwitchC-GigabitEthernet0/0/1] quit [SwitchC] interface gigabitethernet0/0/2 [SwitchC-GigabitEthernet0/0/2] port link-type hybrid [SwitchC-GigabitEthernet0/0/2] port hybrid pvid vlan 300 [SwitchC-GigabitEthernet0/0/2] port hybrid untagged vlan 300 [SwitchC-GigabitEthernet0/0/2] quit
# Configure SwitchA.
[SwitchA] ipv6 [SwitchA] vlan batch 200 [SwitchA] interface gigabitethernet 0/0/2 [SwitchA-GigabitEthernet0/0/2] port link-type hybrid [SwitchA-GigabitEthernet0/0/2] port hybrid pvid vlan 200 [SwitchA-GigabitEthernet0/0/2] port hybrid untagged vlan 200 [SwitchA-GigabitEthernet0/0/2] quit [SwitchA] interface vlanif 200 [SwitchA-Vlanif200] ipv6 enable [SwitchA-Vlanif200] ipv6 address 2002:0a01:0101:1::1/64 [SwitchA-Vlanif200] quit
# Configure SwitchB.
[SwitchB] ipv6 [SwitchB] vlan batch 200 [SwitchB] interface gigabitethernet0/0/2 [SwitchB-GigabitEthernet0/0/2] port link-type hybrid [SwitchB-GigabitEthernet0/0/2] port hybrid pvid vlan 200 [SwitchB-GigabitEthernet0/0/2] port hybrid untagged vlan 200 [SwitchB-GigabitEthernet0/0/2] quit [SwitchB] interface vlanif 200 [SwitchB-Vlanif200] ipv6 enable [SwitchB-Vlanif200] ipv6 address 2002:0a03:0102:1::1/64 [SwitchB-Vlanif200] quit
# Configure the IPv6 hosts.
Set the IPv6 addresses of PC1 and PC2 to 2002:A01:101:1::2/64 and 2002:A03:102:1::2/64, respectively. Set the gateway IPv6 addresses of PC1 and PC2 to 2002:A01:101:1::1 and 2002:A03:102:1::1, respectively.
The interface must be idle and not transmitting services.
After the service loopback function is enabled on the Eth-Trunk, the physical interfaces added to the Eth-Trunk must be in the Up state. Otherwise, the link layer protocol of the tunnel interface cannot run properly.
# Configure SwitchA.
[SwitchA] interface eth-trunk 1 [SwitchA-Eth-Trunk1] service type tunnel [SwitchA-Eth-Trunk1] quit [SwitchA] interface gigabitethernet 0/0/3 [SwitchA-GigabitEthernet0/0/3] eth-trunk 1 [SwitchA-GigabitEthernet0/0/3] quit
# Configure SwitchB.
[SwitchB] interface eth-trunk 1 [SwitchB-Eth-Trunk1] service type tunnel [SwitchB-Eth-Trunk1] quit [SwitchB] interface gigabitethernet 0/0/3 [SwitchB-GigabitEthernet0/0/3] eth-trunk 1 [SwitchB-GigabitEthernet0/0/3] quit
You only need to specify the source address of the tunnel when a 6to4 tunnel is configured. The destination address of the tunnel is the destination address of the original IPv6 packet.
# Configure SwitchA.
[SwitchA] interface tunnel 1 [SwitchA-Tunnel1] tunnel-protocol ipv6-ipv4 6to4 [SwitchA-Tunnel1] eth-trunk 1 [SwitchA-Tunnel1] ipv6 enable [SwitchA-Tunnel1] ipv6 address 2002:0a01:0101::1/64 [SwitchA-Tunnel1] source vlanif 100 [SwitchA-Tunnel1] quit
# Configure SwitchB.
[SwitchB] interface tunnel 1 [SwitchB-Tunnel1] eth-trunk 1 [SwitchB-Tunnel1] tunnel-protocol ipv6-ipv4 6to4 [SwitchB-Tunnel1] ipv6 enable [SwitchB-Tunnel1] ipv6 address 2002:0a03:0102::1/64 [SwitchB-Tunnel1] source vlanif 300 [SwitchB-Tunnel1] quit
# Configure SwitchA.
[SwitchA] ipv6 route-static 2002:: 16 tunnel 1
# Configure SwitchB.
[SwitchB] ipv6 route-static 2002:: 16 tunnel 1
# Check the IPv6 status of Tunnel1 on SwitchA.
[SwitchA] display ipv6 interface tunnel 1 Tunnel1 current state : UP IPv6 protocol current state : UP IPv6 is enabled, link-local address is FE80::244:1FF:FE41:5410 Global unicast address(es): 2002:A01:101::1, subnet is 2002:A01:101::/64 Joined group address(es): FF02::1:FF00:1 FF02::1:FF41:5410 FF02::2 FF02::1 MTU is 1500 bytes ND reachable time is 30000 milliseconds ND retransmit interval is 1000 milliseconds ND stale time is 1200 seconds
You can see that the tunnel status is UP.
# Ping the 6to4 address of the tunnel interface on SwitchB from SwitchA.
[SwitchA] ping ipv6 2002:0a03:0102::1 PING 2002:0a03:0102::1 : 56 data bytes, press CTRL_C to break Reply from 2002:A03:102::1 bytes=56 Sequence=1 hop limit=64 time = 8 ms Reply from 2002:A03:102::1 bytes=56 Sequence=2 hop limit=64 time = 25 ms Reply from 2002:A03:102::1 bytes=56 Sequence=3 hop limit=64 time = 4 ms Reply from 2002:A03:102::1 bytes=56 Sequence=4 hop limit=64 time = 5 ms Reply from 2002:A03:102::1 bytes=56 Sequence=5 hop limit=64 time = 5 ms --- 2002:0a03:0102::1 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 4/9/25 ms
The 6to4 address can be pinged successfully.
# PC1 and PC2 can ping each other.
SwitchA configuration file
# sysname SwitchA # ipv6 # vlan batch 100 200 # interface Vlanif100 ip address 10.1.1.1 255.255.255.0 # interface Vlanif200 ipv6 enable ipv6 address 2002:A01:101:1::1/64 # interface Eth-Trunk1 service type tunnel # interface GigabitEthernet0/0/1 port link-type hybrid port hybrid pvid vlan 100 port hybrid untagged vlan 100 # interface GigabitEthernet0/0/2 port link-type hybrid port hybrid pvid vlan 200 port hybrid untagged vlan 200 # interface GigabitEthernet0/0/3 eth-trunk 1 # interface Tunnel1 ipv6 enable ipv6 address 2002:A01:101::1/64 tunnel-protocol ipv6-ipv4 6to4 source Vlanif100 eth-trunk 1 # ip route-static 10.3.1.0 255.255.255.0 10.1.1.2 # ipv6 route-static 2002:: 16 Tunnel1 # return
SwitchB configuration file
# sysname SwitchB # ipv6 # vlan batch 200 300 # interface Vlanif200 ipv6 enable ipv6 address 2002:A03:102:1::1/64 # interface Vlanif300 ip address 10.3.1.2 255.255.255.0 # interface Eth-Trunk1 service type tunnel # interface GigabitEthernet0/0/1 port link-type hybrid port hybrid pvid vlan 300 port hybrid untagged vlan 300 # interface GigabitEthernet0/0/2 port link-type hybrid port hybrid pvid vlan 200 port hybrid untagged vlan 200 # interface GigabitEthernet0/0/3 eth-trunk 1 # interface Tunnel1 ipv6 enable ipv6 address 2002:A03:102::1/64 tunnel-protocol ipv6-ipv4 6to4 source Vlanif300 eth-trunk 1 # ip route-static 10.1.1.0 255.255.255.0 10.3.1.1 # ipv6 route-static 2002:: 16 Tunnel1 # return
SwitchC configuration file
# sysname SwitchC # vlan batch 100 300 # interface Vlanif100 ip address 10.1.1.2 255.255.255.0 # interface Vlanif300 ip address 10.3.1.1 255.255.255.0 # interface GigabitEthernet0/0/1 port link-type hybrid port hybrid pvid vlan 100 port hybrid untagged vlan 100 # interface GigabitEthernet0/0/2 port link-type hybrid port hybrid pvid vlan 300 port hybrid untagged vlan 300 # return