đ SYSTEM INFORMATION | |
---|---|
OS type and version | Ubuntu 20.04 |
Webmin version | 1.984 |
Virtualmin version | 6.17-3 Pro |
Related packages | Wireguard |
Does anyone know of any Virtualmin related aspects that can interfere / block a wireguard connection? My best guess is that FirewallD doesnât like the routing used for wireguard, but I could be absolutely wrong.
I have verified that the port is available and can be accessed through FirewallD GUI and by running:
(server side)
nc -lu 51820
(client side)
echo Test message | nc -4u -w1 {host-ip} 51820
And seeing âTest messageâ output on remote server.
Under Webmin >> Webmin Configuration >> IP Access Control⊠I have added both the wireguard client and serverâs addresses (i.e. 10.0.0.1 , 10.0.0.2)
I have generated fresh key pairs on client and server. Putting clientâs pub key on the server and the Serverâs pub key on the client.
I am asking here because I have literally the -identical same- setup on a Debian Server without Virtualmin and it works perfectly.
There seems to be something related to Vmin and/or Ubuntu that is simply blocking the connection and I canât find any errors in /var/log
My /etc/wireguard/wg0.conf
contains:
[Interface]
Address = 10.0.0.1/24
SaveConfig = true
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
ListenPort = 51820
PrivateKey = server-private-key
[Peer]
PublicKey = client-public-key
AllowedIPs = 10.0.0.2/32
And I edited /etc/sysctl.conf
to have:
net.ipv4.ip_forward = 1
From the client side when I connect, I get:
[#] ip link add wg0 type wireguard
[#] wg setconf wg0 /dev/fd/63
[#] ip -4 address add 10.0.0.2/32 dev wg0
[#] ip link set mtu 1420 up dev wg-client1
[#] resolvconf -a tun.wg0 -m 0 -x
[#] wg set wg0 fwmark 51820
[#] ip -4 route add 0.0.0.0/0 dev wg0 table 51820
[#] ip -4 rule add not fwmark 51820 table 51820
[#] ip -4 rule add table main suppress_prefixlength 0
[#] sysctl -q net.ipv4.conf.all.src_valid_mark=1
[#] iptables-restore -n
And on the server I get this out put when I start wireguard:
# wg-quick up wg0
[#] ip link add wg0 type wireguard
[#] wg setconf wg0 /dev/fd/63
[#] ip -4 address add 10.0.0.1/24 dev wg0
[#] ip link set mtu 1420 up dev wg0
[#] iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
Everything is correct⊠the client just canât connect.