Greetings,
I'm kind of new to this thing, but I will try to describe my problem as far as I understand it.
I want to connect to the home server through a VPS. However, some docker containers require an external network connection (WAN) to function correctly.
I use wireguard to tunnel the traffic between the VPS to the home server. Also, I added the following iptables rule to the VPS to route incoming external 443 traffic to the home server so I'll be able to connect to it from anywhere:
Code:
sudo iptables -t nat -A PREROUTING -p tcp --dport 443 -j DNAT --to-destination 10.0.0.2:4433
(the home server is using port 4433 instead of 443).
Now, when I want to access a container on the home server through the VPS, there's no problem, but if this container needs an external connection, it goes to the VPS, and the VPS returns 443 requests back to the home server, and the loop continues (I guess that is what's happening). The bottom line, these containers cannot access the internet.
How can I set up the iptables rules correctly, so the home server containers still have a connection to the WAN through the VPS?
Thanks for any bits of advice!