Skip to content

6to4 Tunneling

Configuration Guidemd-9dn1h
DateFebruary 13, 2026
RouterOS Version7.x
Sub-menu/interface 6to4

6to4 is a mechanism that allows IPv6 packets to be transmitted over IPv4 networks without the need for explicitly configured tunnel interfaces. It is especially useful for connecting IPv6 networks over IPv4-only infrastructure.

There are two modes of 6to4 operation:

  1. Automatic mode (no remote-address configured): The router encapsulates IPv6 packets directly over IPv4 if the first 16 bits are 2002::/16, using the next 32 bits as the destination (IPv4 address converted to hex)

  2. Manual mode (remote-address configured): IPv6 packets are sent directly to the specified IPv4 remote address

Important: All 6to4 nodes must have publicly reachable IPv4 addresses when operating over the Internet.


PropertyDescription
clamp-tcp-mssControls MSS size adjustment for TCP SYN packets. When enabled, MSS is changed if it exceeds tunnel MTU.
commentShort description of the interface.
disabledWhether the interface is disabled.
dont-fragmentControls DF bit in packets: no (fragment if needed), inherit (use original packet’s DF flag).
dscpDSCP value for encapsulated packets. Default is inherited from the original packet.
ipsec-secretWhen specified, enables dynamic IPsec peer with pre-shared key.
keepaliveTunnel keepalive in format interval,retries. Default is 10,10 (10 seconds, 10 retries).
local-addressSource IPv4 address for the tunnel.
mtuLayer3 Maximum Transmission Unit. Default is auto.
nameInterface name.
remote-addressIPv4 address of remote 6to4 endpoint. If unspecified, derived from 2002::/16 prefix.

6to4 uses the 2002::/16 prefix. The IPv6 address is constructed as:

2002:<IPv4-hex>:::<prefix-length>

IPv4 to Hex Conversion Example:

IPv4 AddressHex Conversion6to4 Prefix
10.0.1.10A00:01012002:0A00:0101::/48
192.168.1.1C0A8:01012002:C0A8:0101::/48
194.105.56.170C269:38AA2002:C269:38AA::/48

This example shows connecting two MikroTik routers over an IPv4 network using 6to4.

Network diagram showing simple 6to4 tunnel encapsulation between two routers R1 and R2, with IPv4 addresses 10.0.1.1 and 10.0.2.1 converting to IPv6 addresses 2002:A00:101:: and 2002:A00:201:: respectively

Requirements:

  • Both routers must have publicly reachable IPv4 addresses
  • IPv4 connectivity between both sites

R1 Configuration:

Create the 6to4 tunnel interface:

/interface 6to4
add name=6to4-tunnel1

Assign an IPv6 address using the 2002 prefix with IPv4 in hex (10.0.1.1 → 2002:A00:101::):

/ipv6 address
add address=2002:a00:101::/128 advertise=no interface=6to4-tunnel1

Add a route for the 6to4 prefix:

/ipv6 route
add dst-address=2002::/16 gateway=6to4-tunnel1

R2 Configuration:

Create the 6to4 tunnel interface:

/interface 6to4
add name=6to4-tunnel1

Assign IPv6 address (10.0.2.1 → 2002:A00:201::):

/ipv6 address
add address=2002:a00:201::/128 advertise=no interface=6to4-tunnel1

Add the 6to4 route:

/ipv6 route
add dst-address=2002::/16 gateway=6to4-tunnel1

Verification:

Test connectivity from R1:

/ping 2002:a00:201::

Note: The simple 6to4 tunnel configuration may not work in all environments due to NAT and firewall restrictions on IPv4 networks.


This example demonstrates getting IPv6 connectivity through an IPv4 network using Hurricane Electric’s Tunnel Broker service.

Prerequisites:

Step 1: Create Tunnel

Log into Tunnel Broker and create a new tunnel. You’ll receive:

  • Server IPv4 address (e.g., 216.66.80.90)
  • Client IPv4 address (your public IP)
  • Routed /64 IPv6 prefix
  • DNS servers

Step 2: Configure RouterOS

Replace the following values with your Tunnel Broker details:

  • 194.105.56.170 = Your public IPv4 address
  • 216.66.80.90 = Tunnel server IPv4 address
  • 2001:470:27:37e:: = Your routed IPv6 prefix
# Create the 6to4 interface
/interface 6to4
add comment="Hurricane Electric IPv6 Tunnel Broker" \
disabled=no \
local-address=194.105.56.170 \
mtu=1280 \
name=sit1 \
remote-address=216.66.80.90
# Add default IPv6 route via tunnel
/ipv6 route
add comment="" disabled=no distance=1 \
dst-address=2000::/3 \
gateway=2001:470:27:37e::1 \
scope=30 \
target-scope=10
# Assign IPv6 address to tunnel interface
/ipv6 address
add address=2001:470:27:37e::2/64 \
advertise=no \
disabled=no \
eui-64=no \
interface=sit1

Step 3: Enable IPv6 for LAN Clients

Add the routed prefix to your LAN bridge:

/ipv6 address add address=2001:470:28:37e::/64 interface=bridge-local advertise=yes

Enable DNS advertisement:

/ipv6 nd set [ find interface=bridge-local ] advertise-dns=yes

Configure DNS servers (Google public DNS shown, or use Hurricane Electric’s 2001:470:20::2):

/ip dns set allow-remote-requests=yes servers=2001:4860:4860::8888,2001:4860:4860::8844

Step 4: Verify IPv6 Connectivity

# Test IPv6 connectivity
/ping 2001:4860:4860::8888
# Check IPv6 address
/ipv6 address print

Visit https://ipv6-test.com to verify IPv6 connectivity.


  1. Verify IPv4 connectivity:

    /ping 216.66.80.90
  2. Check firewall rules: Ensure IPv4 protocol 41 (GRE) is allowed:

    /ip firewall filter add chain=input protocol=41 action=accept
  3. Verify local-address is reachable:

    /ip address print
  1. Check 6to4 interface status:

    /interface 6to4 print
  2. Verify IPv6 routes:

    /ipv6 route print
  3. Check MTU settings:

    /interface 6to4 print detail
    # Try reducing MTU if experiencing fragmentation issues
    /interface 6to4 set sit1 mtu=1280

If the tunnel goes down but doesn’t recover:

/interface 6to4 set sit1 keepalive=10,5