To configure a 6to4 tunnel, configure the source IPv4 address of the tunnel on the routers at both ends of the tunnel. Hosts on different IPv6 networks can communicate through the 6to4 tunnel.
As shown in Figure 1, both FW_A and FW_B support the IPv6/IPv4 dual stack and connect to the IPv4 and IPv6 networks. FW_A and FW_B are 6to4 routers, and their connected IPv6 networks are 6to4 networks. A 6to4 tunnel is required between FW_A and FW_B to enable hosts on the two IPv6 networks to communicate.
The configuration roadmap is as follows:
To establish a 6to4 tunnel, set a source address and an IPv6 address for the 6to4 tunnel on the 6to4 routers.
Because FW_A and FW_B are border devices of the 6to4 networks, the IPv6 address prefix of each interface connected to the IPv6 networks is 6to4 prefix. Similarly, the IPv6 address prefixes of connected PC1 and PC2 are 6to4 ones.
Based on the 6to4 prefix, set the address to 2002:0201:0101:1::2/64 for PC1. This address is on the same network segment as that of GigabitEthernet0/0/1 on FW_A. (The method for setting IPv6 addresses is determined by the operating system of PC1.)
Based on the 6to4 prefix, set the address to 2002:0201:0201:1::2/64 for PC2. This address is on the same network segment as that of GigabitEthernet0/0/1 on FW_B. (The method for setting IPv6 addresses is determined by the operating system of PC1.)
After you complete the preceding configurations, run the display interface tunnel command in any view to check the status and configuration of Tunnel0. The command output on FW_A is as follows:
[FW_A] display interface Tunnel 0 Tunnel0 current state : UP Line protocol current state : up Description:Huawei, Tunnel0 Interface Route Port,The Maximum Transmit Unit is 1500 Internet protocol processing : disabled Encapsulation is TUNNEL, loopback not set Tunnel source 2.1.1.1 (GigabitEthernet 0/0/2), destination auto Tunnel protocol/transport IPv6 over IPv4(6to4)
# FW_A can ping the 6to4 address of GigabitEthernet0/0/1 on FW_B.
[FW_A] ping ipv6 2002:0201:0201:1::1
PING 2002:201:201:1::1 : 56 data bytes, press CTRL_C to break
Reply from 2002:201:201:1::1
bytes=56 Sequence=1 hop limit=255 time = 8 ms
Reply from 2002:201:201:1::1
bytes=56 Sequence=2 hop limit=255 time = 25 ms
Reply from 2002:201:201:1::1
bytes=56 Sequence=3 hop limit=255 time = 4 ms
Reply from 2002:201:201:1::1
bytes=56 Sequence=4 hop limit=255 time = 5 ms
Reply from 2002:201:201:1::1
bytes=56 Sequence=5 hop limit=255 time = 5 ms
--- 2002:0201:201:1::1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 4/9/25 ms
PC1 can ping PC2.
Configuration script of FW_A:
# sysname FW_A # ipv6 # interface GigabitEthernet0/0/2 ip address 2.1.1.1 255.255.255.0 # interface GigabitEthernet0/0/1 ipv6 enable ipv6 address 2002:0201:0101:1::1 64 # interface Tunnel 0 tunnel-protocol ipv6-ipv4 6to4 ipv6 enable source GigabitEthernet0/0/2 ipv6 address 2002:0201:0101::1 64 # firewall zone trust add interface GigabitEthernet0/0/1 # firewall zone untrust add interface GigabitEthernet0/0/2 add interface tunnel0 # ipv6 route-static 2002:: 16 Tunnel 0 ip route-static 0.0.0.0 2.1.1.2 # security-policy rule name policy1 source-zone trust source-zone untrust destination-zone trust destination-zone untrust action permit rule name policy2 source-zone local source-zone untrust destination-zone local destination-zone untrust action permit # return
Configuration script of FW_B:
# sysname FW_B # ipv6 # interface GigabitEthernet0/0/2 ip address 2.1.2.1 255.255.255.0 # interface GigabitEthernet0/0/1 ipv6 enable ipv6 address 2002:0201:0201:1::1 64 # interface Tunnel 0 tunnel-protocol ipv6-ipv4 6to4 ipv6 enable source GigabitEthernet0/0/2 ipv6 address 2002:0201:0201::1 64 # firewall zone trust add interface GigabitEthernet0/0/1 # firewall zone untrust add interface GigabitEthernet0/0/2 add interface tunnel0 # ipv6 route-static 2002:: 16 Tunnel 0 ip route-static 0.0.0.0 2.1.2.2 # security-policy rule name policy1 source-zone trust source-zone untrust destination-zone trust destination-zone untrust action permit rule name policy2 source-zone local source-zone untrust destination-zone local destination-zone untrust action permit # return