I am trying to connect a public ip (a vps) to a server running inside virtualbox via zerotier network (to avoid port forwarding).
Public VPS setup:
The public IP is a failover ip on a server with interface eth0:1 and ip 188.8.131.52.
The zerotier interface is ztc3q7oq2j with ip 172.29.206.201.
Virtualbox VPS setup:
The zerotier interface is ztc3q7oq2j with ip 172.29.8.138.
Is there a way to implement a transparent proxy so that when a request is made to the public IP it is forwarded through the zerotier network and back?
I tried adapting answers from this question and this tutorial but i can’t get it working. I also want this to apply for all ports. Both servers can ping each other on the zerotier network. This is as far as I got.
iptables -t nat -A PREROUTING -i eth0:1 -j DNAT --to 172.29.8.138 iptables -A FORWARD -d 172.29.8.138 -i eth0:1 -o ztc3q7oq2j -j ACCEPT iptables -t nat -A POSTROUTING -o ztc3q7oq2j -d 172.29.8.138 -j SNAT --to 184.108.40.206
Don’t recommend me other means of proxying the connection, I am trying to figure it out with iptables for educational purposes. 😀