6in4 Tunnel Example illustrates a 6in4 tunnel configured between two IPv6 regions across an IPv4 region.
Router A has an interface to an IPv4 region with the address 192.168.1.1 (for this example we are using private IPv4 addresses, but to tunnel across the Internet, you would use a public address). Router B has an IPv4 interface of 10.2.0.1. The IPv4 interface must be created before the tunnel is configured and cannot be deleted until the tunnel is deleted.
This example has one subnet in each IPv6 region, 2001:db8:1::/64 for Router A and 2001:db8:2::/64 for Router B. Hosts A and B are configured to use IPv6 addresses 2001:db8:1::101 and 2001:db8:2::101 respectively.
For traffic to move from one region to the other, there must be a route. In this example, a static route is created, but you could enable RIPng or OSPFv3 on the tunnel interface.
In this example, we assume that the IPv4 network can route from Router A to Router B (in other words, some IPv4 routing protocol is running on the public-ipv4 interfaces). For platforms on which hardware based tunneling is supported (See the following table), IPv4 forwarding needs to be enabled on the tunnel source VLAN. However, in platforms on which IPv6-in-IPv4 tunnels are supported in software only, you do not need to enable IPv4 forwarding on the public interfaces in this example unless you are also routing IPv4 traffic on them (in this example, it is assumed you are running no IPv4 traffic inside your respective IPv6 networks, although you could).
When Host A needs to send a packet to 2001:db8:2::101 (Host B), it forwards it to Router A. Router A receives an IPv6 packet from the IPv6 source address 2001:db8:1::101 to the destination 2001:db8:2::101. Router A has the static route, for the route 2001:db8:2::/64 with next hop 2001:db8:a::2 (Router B) through the tunnel interface. So Router A encapsulates the IPv6 packet inside an IPv4 header with the source address 192.168.1.1 and destination address 10.2.0.1. The encapsulated IPv6 packet passes through the IPv4 network and reaches the other end of the tunnel—Router B. Router B decapsulates the packet and removes the IPv4 header. Router B then forwards the IPv6 packet to the destination host—Host B.
Note
Each IPv6 packet is encapsulated inside an IPv4 header (20 bytes) before it is forwarded via a IPv6-in-IPv4 tunnel. For example, a 66-byte packet from Host A will be encapsulated and forwarded as a 86-byte packet by Router A.configure vlan default delete port all create vlan public-ipv4 configure vlan public-ipv4 add port 1 untagged configure vlan public-ipv4 ipaddress 192.168.1.1/24 create tunnel public6in4 ipv6-in-ipv4 destination 10.2.0.1 source 192.168.1.1 configure tunnel public6in4 ipaddress 2001:db8:a::1/64 enable ipforwarding ipv6 public6in4 create vlan private-ipv6 configure vlan private-ipv6 add port 2 untagged configure vlan private-ipv6 ipaddress 2001:db8:1::1/64 enable ipforwarding ipv6 private-ipv6 configure iproute add 2001:db8:2::/64 2001:db8:a::2 enable ipforwarding public-ipv4
configure vlan default delete port all create vlan public-ipv4 configure vlan public-ipv4 add port 1 untagged configure vlan public-ipv4 ipaddress 10.2.0.1/24 create tunnel public6in4 ipv6-in-ipv4 destination 192.168.1.1 source 10.2.0.1 configure tunnel public6in4 ipaddress 2001:db8:a::2/64 enable ipforwarding ipv6 public6in4 create vlan private-ipv6 configure vlan private-ipv6 add port 2 untagged configure vlan private-ipv6 ipaddress 2001:db8:2::1/64 enable ipforwarding ipv6 private-ipv6 configure iproute add 2001:db8:1::/64 2001:db8:a::1 enable ipforwarding public-ipv4