I have a bunch of docker services in my homelab, but since moving to a new place - I have no public IP.I've came to idea that I could use VPS as source of public IP and route traffic via Wireguard tunnel to homelab.Connection between VPS and homelab works as intended:
My default/public IP on VPS: 111.111.78.121
Homelab address on wireguard: 10.222.0.2
UFW is disabled
interface: wireguard public key: F7AsGVC6EFCWiQcgQWn145/gZfctEYgwOfNUe/ySJl4= private key: (hidden) listening port: 51820peer: 5kZyP9lsH8niZ4dlSzsskaHg3Oy/a1HNu2f0fMXbSAs= endpoint: <endpointip>:8020 allowed ips: 10.222.0.2/32 latest handshake: 1 minute, 26 seconds ago transfer: 4.05 KiB received, 1.92 KiB sent persistent keepalive: every 25 secondsroot@localhost:~#
And I can access remote service on homelab from VPS
root@localhost:~# curl 10.222.0.2:8080<!DOCTYPE html><html><head><title>Welcome to nginx!</title>(...)
But I have no idea how to setup ufw and port forwarding to access homelab service via VPS public address.
iptables -t nat -D PREROUTING -p tcp --dport 8080 -j DNAT --to-destination 10.222.0.2:8080root@localhost:~# curl 111.111.78.121:8080curl: (7) Failed to connect to 111.111.78.121 port 8080 after 0 ms: Couldn't connect to server
Wireguard.conf on Server/VPS side:
[Interface]Address = 10.222.0.1/24ListenPort = 51820PrivateKey = <server_key>[Peer]PublicKey = <peer_key>AllowedIPs = 10.222.0.2/32PersistentKeepalive = 25