Configuration example
Network requirements
As shown in Figure 89, two 6to4 networks are connected to an IPv4 network through two 6to4 switches (Switch A and Switch B). Configure a 6to4 tunnel to make Host A and Host B reachable to each other.
Figure 89: Network diagram
Configuration consideration
To enable communication between 6to4 networks, configure 6to4 addresses for 6to4 switches and hosts in the 6to4 networks.
The IPv4 address of VLAN-interface 100 on Switch A is 2.1.1.1/24, and the corresponding 6to4 prefix is 2002:0201:0101::/48 after it is translated to an IPv6 address. Assign interface Tunnel 0 to subnet 2002:0201:0101::/64 and VLAN-interface 101 to subnet 2002:0201:0101:1::/64.
The IPv4 address of VLAN-interface 100 on Switch B is 5.1.1.1/24, and the corresponding 6to4 prefix is 2002:0501:0101::/48 after it is translated to an IPv6 address. Assign interface Tunnel 0 to subnet 2002:0501:0101::/64 and VLAN-interface 101 to subnet 2002:0501:0101:1::/64.
Configuration procedure
Before configuring a 6to4 tunnel, make sure Switch A and Switch B have the corresponding VLAN interfaces created and are reachable to each other.
Configure Switch A:
# Enable IPv6.
<SwitchA> system-view [SwitchA] ipv6
# Specify an IPv4 address for VLAN-interface 100.
[SwitchA] interface vlan-interface 100 [SwitchA-Vlan-interface100] ip address 2.1.1.1 24 [SwitchA-Vlan-interface100] quit
# Specify an IPv6 address for VLAN-interface 101.
[SwitchA] interface vlan-interface 101 [SwitchA-Vlan-interface101] ipv6 address 2002:0201:0101:1::1/64 [SwitchA-Vlan-interface101] quit
# Create service loopback group 1 to support the tunnel service.
[SwitchA] service-loopback group 1 type tunnel
# Assign GigabitEthernet 1/0/3 to service loopback group 1, and disable STP, NDP, and LLDP on the interface.
[SwitchA] interface GigabitEthernet 1/0/3 [SwitchA-GigabitEthernet1/0/3] undo stp enable [SwitchA-GigabitEthernet1/0/3] undo ndp enable [SwitchA-GigabitEthernet1/0/3] undo lldp enable [SwitchA-GigabitEthernet1/0/3] port service-loopback group 1 [SwitchA-GigabitEthernet1/0/3] quit
# Configure a 6to4 tunnel.
[SwitchA] interface tunnel 0 [SwitchA-Tunnel0] ipv6 address 2002:201:101::1/64 [SwitchA-Tunnel0] source vlan-interface 100 [SwitchA-Tunnel0] tunnel-protocol ipv6-ipv4 6to4
# Reference service loopback group 1 on the tunnel.
[SwitchA-Tunnel0] service-loopback-group 1 [SwitchA-Tunnel0] quit
# Configure a static route whose destination address is 2002::/16 and next-hop is the tunnel interface.
[SwitchA] ipv6 route-static 2002:: 16 tunnel 0
Configure Switch B:
# Enable IPv6.
<SwitchB> system-view [SwitchB] ipv6
# Specify an IPv4 address for VLAN-interface 100.
[SwitchB] interface vlan-interface 100 [SwitchB-Vlan-interface100] ip address 5.1.1.1 24 [SwitchB-Vlan-interface100] quit
# Specify an IPv6 address for VLAN-interface 101.
[SwitchB] interface vlan-interface 101 [SwitchB-Vlan-interface101] ipv6 address 2002:0501:0101:1::1/64 [SwitchB-Vlan-interface101] quit
# Create service loopback group 1 to support the tunnel service.
[SwitchB] service-loopback group 1 type tunnel
# Assign GigabitEthernet 1/0/3 to service loopback group 1, and disable STP, NDP, and LLDP on the interface.
[SwitchB] interface GigabitEthernet 1/0/3 [SwitchB-GigabitEthernet1/0/3] undo stp enable [SwitchB-GigabitEthernet1/0/3] undo ndp enable [SwitchB-GigabitEthernet1/0/3] undo lldp enable [SwitchB-GigabitEthernet1/0/3] port service-loopback group 1 [SwitchB-GigabitEthernet1/0/3] quit
# Configure the 6to4 tunnel.
[SwitchB] interface tunnel 0 [SwitchB-Tunnel0] ipv6 address 2002:0501:0101::1/64 [SwitchB-Tunnel0] source vlan-interface 100 [SwitchB-Tunnel0] tunnel-protocol ipv6-ipv4 6to4
# Reference service loopback group 1 on the tunnel.
[SwitchB-Tunnel0] service-loopback-group 1 [SwitchB-Tunnel0] quit
# Configure a static route whose destination address is 2002::/16 and the next hop is the tunnel interface.
[SwitchB] ipv6 route-static 2002:: 16 tunnel 0
Verifying the configuration
# Ping Host B from Host A or ping Host A from Host B.
D:\>ping6 -s 2002:201:101:1::2 2002:501:101:1::2 Pinging 2002:501:101:1::2 from 2002:201:101:1::2 with 32 bytes of data: Reply from 2002:501:101:1::2: bytes=32 time=13ms Reply from 2002:501:101:1::2: bytes=32 time=1ms Reply from 2002:501:101:1::2: bytes=32 time=1ms Reply from 2002:501:101:1::2: bytes=32 time<1ms Ping statistics for 2002:501:101:1::2: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 13ms, Average = 3ms