Goal
I'm trying to set up a WireGuard VPN with IPv6 only through which I (a) want to route all traffic and (b) with a server that is accessible from the internet. Since I couldn't even get (a) to work, I'll just try to get that to work, (b) is just for context.
I have a VPS with a globally routable IPv6, 2a03:4000:xx:xx:18d7:b1ef:fe48:7d35/64
(that's what ip a
tells me) on eth0
. I'll refer to it with the hostname vps
. For testing purposes, the server has no firewall, and net.ipv6.conf.all.forwarding=1
and
net.ipv6.conf.all.accept_ra=2
.
Then I also have my device, which also has an IPv6 address, 2001:1715:yy:yy:db2d:ab24:ed3f:39d4/64
on wlan0
(this should not be relevant information, since this addr will change when I am on another WLAN). It carries the hostname laptop
.
I want to end up with something like this:
Internet <-> vps <-> laptop
With IPv4, I'd use NAT, however in IPv6 world, NAT is discouraged. It's hard to find out what to do instead, but if I've read correctly, then I should give another IP address from the 2a03:4000:xx:xx::/64
block the VPS got to the laptop.
Setup
So I write these two wireguard configs:
VPS:
[Interface]
Address = fc01::1/128 # Shouldn't really matter?
ListenPort = 1935 # This port is open to UDP on most networks
PrivateKey = uLxxxxxxxxxxxxxxxxxxxxxxxxEQ=
[Peer]
# laptop
PublicKey = swxxxxxxxxxxxxxxxxxxxxxxxxxmQ=
AllowedIPs = 2a03:4000:xx:xx:ffff::3/128 # Is inside the vps' /64 block
Laptop:
[Interface]
Address = 2a03:4000:xx:xx:ffff::3/128 # The globally routable IP addr of my laptop via the vps
ListenPort = 1935
PrivateKey = yMxxxxxxxxxxxxxxxxxxxxxxxxxxxxm8=
[Peer]
PublicKey = pCxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxzs=
AllowedIPs = ::/0 # Route all traffic through this peer
Endpoint = [2a03:4000:xx:xx:18d7:b1ef:fe48:7d35]:1935
I bring them up:
[root@vps ~]# wg-quick up wg0
[#] ip link add wg0 type wireguard
[#] wg setconf wg0 /dev/fd/63
[#] ip -6 address add fc01::1/128 dev wg0
[#] ip link set mtu 1420 up dev wg0
[#] ip -6 route add 2a03:4000:xx:xx:ffff::3/128 dev wg0
[root@laptop ~]# wg-quick up wg0
[#] ip link add wg0 type wireguard
[#] wg setconf wg0 /dev/fd/63
[#] ip -6 address add 2a03:4000:xx:xx:ffff::3/128 dev wg0
[#] ip link set mtu 1420 up dev wg0
[#] wg set wg0 fwmark 51820
[#] ip -6 route add ::/0 dev wg0 table 51820
[#] ip -6 rule add not fwmark 51820 table 51820
[#] ip -6 rule add table main suppress_prefixlength 0
[#] ip6tables-restore -n
... aaaand it doesn't work.
WireGuard doesn't seem to successfully connect. The Laptop shows a connection and counts sent traffic (but 0B received), but the VPS doesn't show a conection.
How does one set up a IPv6-only WireGuard VPN correctly? And if this is correct, why does traffic sent at one end not arrive at the other end of the tunnel?
If more information (pcaps, ip
outputs, etc.) would be useful, I'll happily amend the question.
2a03:4000:xx:xx::beef/128
withip addr add
toeth0
and I could ping it through the Internet. And also, I do receive many Router Solicitations oneth0
, which all are not in my/64
block.tcpdump -e -n -i eth0 icmp6
and then externally ping another address from your /64 (specifically, one that isn't actually assigned to eth0 – perhaps the laptop's WireGuard address or just some random address), what do you see on eth0 – do you get Neighbor Solicitation packets for that address or the actual ping/echo packets?15:21:04.875401 2c:6b:f5:a0:77:c0 > 33:33:ff:40:e9:24, ethertype IPv6 (0x86dd), length 86: fe80::22d8:b00:c3ee:ff4 > ff02::1:ff40:e924: ICMP6, neighbor solicitation, who has 2a03:4000:xx:xx::2340:e924, length 32
. `