A dual-stack VPN carries both IPv4 and IPv6 traffic inside one tunnel. Modern clients and many backend services prefer IPv6 when available; a v4-only VPN forces them to either bypass the tunnel for v6 (a leak) or fail v6 connections entirely (broken UX). This article covers running OpenVPN, WireGuard, and strongSwan in dual-stack mode — addressing schemes, route push, DNS, and the operational gotchas that make IPv6 inside a tunnel feel different from IPv4.
How to verify
Before reconfiguring, see what your current VPN actually carries.
ss -lntp | grep -E ':1194|:51820|:500|:4500'
ip -6 addr show
ip -6 route show
sysctl net.ipv6.conf.all.forwarding
curl -s -4 https://ifconfig.me
curl -s -6 https://ifconfig.me
If net.ipv6.conf.all.forwarding is 0, the gateway will accept the tunnel but refuse to route IPv6. If ip -6 addr show lists nothing useful on wg0 / tun0 after the tunnel is up, the kernel never installed an IPv6 address there.
What’s happening
Inside a dual-stack VPN you allocate two separate address pools:
- IPv4 pool — typically a
/24or/16from RFC1918 (10.x,172.16-31.x,192.168.x). - IPv6 pool — typically a
/64(or smaller subnet from a/48) from RFC4193 ULA (fd00::/8) or routable space if your provider gives you a/56or/48.
Each connected client gets one address from each pool. The tunnel interface holds both, and the kernel routes packets toward the right peer based on destination. The gateway NATs IPv4 outbound (because RFC1918 is not routable) and either NATs IPv6 (ugly but common with ULA) or routes IPv6 natively (clean, if you have routable IPv6 from your provider).
The big difference from IPv4-only: clients now have a v6 default route that goes through the tunnel. Any application that prefers v6 will use it. This is a feature (matching what the user expects on a native dual-stack network) and a hazard (DNS leaks, MTU surprises, IPv6 ACLs you forgot to write).
The procedure
Walking through each engine.
OpenVPN
In server.conf:
proto udp6 # listen on v4 AND v6 dual-stack socket
server 10.8.0.0 255.255.255.0
server-ipv6 fd00:dead:beef::/64
push "redirect-gateway def1 bypass-dhcp"
push "redirect-gateway-ipv6 def1 bypass-dhcp"
push "route-ipv6 ::/0"
push "dhcp-option DNS 1.1.1.1"
push "dhcp-option DNS6 2606:4700:4700::1111"
tun-ipv6
NAT for v4, route for v6:
sysctl -w net.ipv4.ip_forward=1
sysctl -w net.ipv6.conf.all.forwarding=1
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
ip6tables -t nat -A POSTROUTING -s fd00:dead:beef::/64 -o eth0 -j MASQUERADE
(For routable IPv6, drop the ip6tables NAT line and add a route via the upstream router.)
WireGuard
/etc/wireguard/wg0.conf on the server:
[Interface]
PrivateKey = <key>
Address = 10.8.0.1/24, fd00:dead:beef::1/64
ListenPort = 51820
PostUp = sysctl -w net.ipv4.ip_forward=1; sysctl -w net.ipv6.conf.all.forwarding=1
PostUp = iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostUp = ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
[Peer]
PublicKey = <client-pub>
AllowedIPs = 10.8.0.2/32, fd00:dead:beef::2/128
Client side — push both families through the tunnel:
[Interface]
PrivateKey = <client-key>
Address = 10.8.0.2/32, fd00:dead:beef::2/128
DNS = 1.1.1.1, 2606:4700:4700::1111
[Peer]
PublicKey = <server-pub>
Endpoint = vpn.example.org:51820
AllowedIPs = 0.0.0.0/0, ::/0
PersistentKeepalive = 25
strongSwan
swanctl.conf — add a v6 pool and push both:
connections {
roadwarrior {
version = 2
pools = pool4, pool6
local {
auth = pubkey
certs = server.crt
id = vpn.example.org
}
remote {
auth = eap-mschapv2
eap_id = %any
}
children {
net {
local_ts = 0.0.0.0/0, ::/0
}
}
}
}
pools {
pool4 { addrs = 10.30.0.0/24; dns = 1.1.1.1 }
pool6 { addrs = fd00:dead:beef::/64; dns = 2606:4700:4700::1111 }
}
Operational notes
- DNS resolution must work for both families inside the tunnel. If you push only an IPv4 DNS, IPv6 AAAA lookups still happen but the resolver may not be reachable over the v6 route the client now prefers. Push both v4 and v6 resolvers.
- MTU is more painful with dual-stack. IPv6 minimum MTU is 1280; WireGuard’s overhead leaves you at roughly 1380 inside the tunnel. Set client
MTU = 1280to be safe, especially for IPsec/strongSwan. - Reverse DNS for the v6 pool matters for some applications (mail, logging). If you are using ULA, reverse will fail; set up internal reverse zones if your apps care.
- IPv6 firewall rules are not magically inherited from IPv4. Every
iptablesrule needs anip6tablescounterpart. We have lost hours to this — aDROP all incoming on the WAN interfaceIPv4 rule with no v6 sibling lets v6 traffic in unrestricted. - Hosts that have IPv6 but no IPv6 default route (common on certain VPS providers) will accept the v6 push and then black-hole all v6 traffic. Test outbound v6 from the gateway itself before promising clients v6 connectivity.
- For NAT64/DNS64 deployments where the client has only IPv6 outside the tunnel, you need the gateway to translate. Standard
iptablesMASQUERADE does not do v6-to-v4; installtaygaor useJoolfor that translation layer.
In the engagements we run, dual-stack VPN is the default for new builds — the only reason to do v4-only today is “the client has no IPv6 anywhere yet, and we cannot fix that this quarter.” When IPv6 is in scope, our Managed Operations practice tests both families at onboarding and includes them both in the audit log pipeline. A leak in v6 is no less of a leak than a leak in v4.