While experimenting with ProtonVPN's Wireguard configs, I realized that my real IPv6 address was leaking while IPv4 was correctly going through the tunnel. How do I prevent this from happening?
I've already tried adding ::/0 to the AllowedIPs option and IPv6 is listed as disabled in the NetworkManager profile.
Haha, yeah that's what ProtonVPN support recommended to me and I am not sure if I want to disable IPv6 globally like that. I feel (with my inexperienced brain) that there's gotta be a way to do it on a per connection basis.
In this case, disabling IPv6 is actually the right move. If the VPN provider doesn't support IPv6, then there's no way to allow to allow IPv6 Internet traffic without causing a leak/VPN bypass. If you block IPv6 via firewall or routing it to a dead-end, it will add delays as things try IPv6, timeout, and fall back to IPv4. If you just remove the IPv6 address from the Internet interface, you have to also make sure it doesn't get re-added by SLAAC/DHCPv6 or other interface changes (switching wifi networks, etc). As dumb as it seems, disabling IPv6 or switching to a provider that supports it are probably the best options.
In this case, disabling IPv6 is actually the right move. If the VPN provider doesn’t support IPv6, then there’s no way to allow to allow IPv6 Internet traffic without causing a leak/VPN bypass.
The right move for the VPN provider is to support IPv6. The right move for the user is to take their business to a provider that does.
Unironically that's one thing we do to anonymize traffic at work. We could do NAT via IPV6 but what's the point when IPV4 already helps mask who is doing what in the office.
IPv4 and IPv6 are two different network stacks. Your IPv4 stack is hidden behind wireguard, but not the IPv6 one.
The correct way to fix your issue is to setup a second witeguard tunnel for IPv6, and route IPv6 traffic through it.
Edit: many comments advise to block outbound IPv6 traffic. Don't do that! It will add latency to all your requests as you will have to wait for them to timeout.
If you disable IPv6 at the kernel level there's no extra latency as nothing even tries to connect to an IPv6 address. It's a shame to have to do it, but does fix the issue.
The true enterprise solution is to disable IPv6, if you disable IPv4 you might be surprised to see how many sites and services, even those run by large companies require IPv4.
Wireguard easily supports dual stack configuration on a single interface, but the VPN server must also have IPv6 enabled. I use AirVPN and I get both IPv6 and IPv4 with a single wireguard tunnel. In addition to the ::/0 route you also need a static IPv6 address for the wireguard interface. This address must be provided to you by ProtonVPN.
If that's not possible, the only solution is to entirely disable IPv6.
You can either route IPv6 through the tunnel, or if the tunnel doesn't support it, you have to block it somehow if you don't want it going out to the Internet. You can do that by creating a firewall rule to block it on your host or network, or by disabling IPv6 entirely at the host or network level.
Add a dummy IPv6 on the WireGuard interface, like a completely random fd00::/128 address on it so it thinks it's IPv6 enabled. It'll then just go nowhere as the remote end won't accept it. You can then drop it at the firewall level before it goes into the tunnel to save some bandwidth.