Why?
As described in the Privacy Project, I use my own Domain Name Server. It works great in the local network, but I am not able to access it from outside.
That’s why I need my own VPN server.
Other possible solutions
Port Forwarding on my home router – impossible, because I don’t have access to the admin’s configuration. Besides, I don’t have static IP. There are solutions like Dynamic DNS, but they are not reliable on the long run,
Tailscale (or other similar commercial solution) – it would work, but it’s not so much fun.
The VPN server configuration
The configuration is simple:
[root@vps-dc91297d fedora]# cat /etc/wireguard/wg0.conf
[Interface]
Address = 10.8.0.1/24
ListenPort = 51820
PrivateKey = (redacted)
PostUp = firewall-cmd --direct --add-rule ipv4 filter FORWARD 0 -i wg0 -j ACCEPT
PostDown = firewall-cmd --direct --remove-rule ipv4 filter FORWARD 0 -i wg0 -j ACCEPT
# Example peer (add one per client)
[Peer]
PublicKey = (redacted)
AllowedIPs = 10.8.0.2/32
[Peer]
PublicKey = (redacted)
AllowedIPs = 10.8.0.3/32
The VPN Clients’ configuration
root@komputer01:/etc/wireguard# cat wg0.conf
[Interface]
PrivateKey = (redacted)
Address = 10.8.0.3/24
[Peer]
PublicKey = (redacted)
Endpoint = vpn.tomasz-avila.pl:51820
AllowedIPs = 10.8.0.0/24 # route all VPN traffic through the server
PersistentKeepalive = 25
The results
[root@vps-dc91297d fedora]# wg show
interface: wg0
public key: (redacted)
private key: (hidden)
listening port: 51820
peer: c2dz9nLrd7bYfyTFj7fMQHBMkHaIz7GFoH1bRK+ermY=
endpoint: 46.205.194.178:60080
allowed ips: 10.8.0.3/32
latest handshake: 15 seconds ago
transfer: 10.89 MiB received, 3.80 MiB sent
peer: XoOt5kWRfvUSFf8I+SGUHcDcC9TeNloifDspq9uw0BI=
endpoint: 185.246.208.88:39392
allowed ips: 10.8.0.2/32
latest handshake: 1 minute, 5 seconds ago
transfer: 4.07 MiB received, 11.15 MiB sent
Now, I am able to connect to all my devices from all around the world.
Leave a Reply