Configure WireGuard for Roaming Between IPv4, IPv6

Lane Russell lanerussell at protonmail.com
Sun Sep 16 18:40:36 CEST 2018


Thanks so much for setting me straight. I've gotten IPv6 working over my IPv4 tunnels to ensure that IPv6 traffic can't leak out while I'm using Wireguard. Since my ISP uses SLAAC to hand out /56s, I have a /64 pointed at the local subnet where my VPN server is. From there, the VPN clients use my ULA prefix to talk to the server. The server masquerades these ULA addresses to its global address.

For anyone interested in the config I'm using, please look below. I had to enable IPv6 forwarding on the wireguard server. In Ubuntu (and probably other distros), this disables Stateless Address Autoconfiguration based on Router Advertisements on the server, which would have prevented the server from getting a global IPv6 address from my ISP. To enable IPv6 forwarding and SLAAC, I also had to add the following to my /etc/network/interfaces file to accept router advertisements even with IPv6 forwarding turned on:

iface ens3 inet6 auto
        accept_ra 2

SERVER:
-----------------------------------------------------------------------------------
[Interface]
Address = X.X.X.X/24, fdXX:XXXX:XXXX:XXXX::1/64
ListenPort = PORT
PrivateKey = KEY

[Peer]
# PEER NAME
PublicKey = KEY
AllowedIPs = X.X.X.X/32, fdXX:XXXX:XXXX:XXXX::2/128
-----------------------------------------------------------------------------------

CLIENT:
-----------------------------------------------------------------------------------
[Interface]
Address = X.X.X.2/32, fdXX:XXXX:XXXX:XXXX::2/128
PrivateKey = KEY
DNS = X.X.X.X, X.X.X.X

[Peer]
PublicKey = KEY
AllowedIPs = 0.0.0.0/0, ::/0
Endpoint = SERVER:PORT
PersistentKeepalive = 21
-----------------------------------------------------------------------------------

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Saturday, September 15, 2018 5:41 PM, David Cowden <david.w.cowden at gmail.com> wrote:

> I haven't actually tried that specific scenario but I don't see why the tunnel wouldn't "come up". I mean really it's up when the interface is up and the tunnel "connection" (it's UDP) isn't actually "established" (in a NAT/firewall sense) unless data is sent. You can have an interface configured for IPv6 on an "IPv4 only" network, it just won't get responses to its router solicitations so the kernel (Linux, at least--BSDs do this in userspace) won't configure routes for IPv6 traffic. If you look at your physical interfaces, you'll probably notice they all have IPv6 link-local addresses unless you've actually turned off IPv6 support in the kernel
>
> The reason your IPv6 traffic goes out unencrypted on dual stack networks is because the default route for IPv6 traffic is not the Wireguard interface, but rather one of the physical ones. All you need to do to send your IPv6 traffic through the tunnel is configure the interface to be part of the IPv6 network you're trying to reach, and of course allow an IPv6 address from the client in the server config. In fact, if you configure your interface with IPv6 address(s) and a route pointing at the wg interface, you can even send IPv6 traffic on an IPv4 only tunnel provided your server can route IPv6 traffic. If you're using wg-quick, simply adding an IPv6 address to the interface and allowing all IPv6 traffic from the server peer would suffice.
>
> On Sat, Sep 15, 2018 at 11:01 AM Lane Russell <lanerussell at protonmail.com> wrote:
>
>> What is the best practice for configuring Wireguard to work over diverse networks, including IPv4-only, IPv6-only, and dual-stack?
>>
>> For example, my current configuration only deals with IPv4. When I roam from an IPv4-only network to a dual-stack, my device routes IPv4 traffic over the WireGuard interface, but IPv6 traffic goes out unencrypted.
>>
>> My VPN server is IPv6-capable, so I could enable it. However, will the client tunnel fail to come up on an IPv4-only network if the config contains IPv6 addresses?
>> _______________________________________________
>> WireGuard mailing list
>> WireGuard at lists.zx2c4.com
>> https://lists.zx2c4.com/mailman/listinfo/wireguard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/wireguard/attachments/20180916/dd6e00cf/attachment.html>


More information about the WireGuard mailing list