It's the first time I'm trying to set up a wireguard server on a Ubuntu 22 machine and I don't understand what exactly am I doing wrong. I'm using https://github.com/angristan/wireguard-install as an installer for wg, specifying my IP address during the installation and leaving everything as is. It should automatically port-forward and it seems to do it. Here's the wg0.conf file that got generated (I changed AllowedIPs to no avail):
[Interface]
Address = 10.66.66.1/24,fd42:42:42::1/64
ListenPort = 50881
PrivateKey = [redacted]
PostUp = iptables -I INPUT -p udp --dport 50881 -j ACCEPT
PostUp = iptables -I FORWARD -i eth0 -o wg0 -j ACCEPT
PostUp = iptables -I FORWARD -i wg0 -j ACCEPT
PostUp = iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostUp = ip6tables -I FORWARD -i wg0 -j ACCEPT
PostUp = ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D INPUT -p udp --dport 50881 -j ACCEPT
PostDown = iptables -D FORWARD -i eth0 -o wg0 -j ACCEPT
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT
PostDown = iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
PostDown = ip6tables -D FORWARD -i wg0 -j ACCEPT
PostDown = ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
### Client portal
[Peer]
PublicKey = [redacted]
PresharedKey = [redacted]
AllowedIPs = 0.0.0.0/0, ::/0
And here is a client file I'm trying to use to connect:
[Interface]
PrivateKey = [redacted]
Address = 10.66.66.2/32,fd42:42:42::2/128
DNS = 1.1.1.1,1.0.0.1
[Peer]
PublicKey = [redacted]
PresharedKey = [redacted]
Endpoint = [ip of my server]:50881
AllowedIPs = 0.0.0.0/0,::/0
For some reason, the handshake just can't be established. And I just noticed that the second I complete the wireguard installation on server, something immediately happens to my connection, causing every ping to result in Temporary failure in name resolution
. I'm nowhere nearly as experienced in linux so I would really appreciate somebody pointing to what exactly am I doing wrong here.