Iptables - Internal/Public forwarding

Iptables - Internal/Public forwarding

FlorinMarianFlorinMarian Member
edited August 6 in Help

Hi guys 1 I try to hide my gameserver IP behind another VPS with an IP-IP tunnel. Everything it's set up but still have a issue. I don't know why but with this IP tables configuration I cannot play game because after first packet, each player it's sent to 192.168.168.2 (Gameserver internal IP). I cannot figure why with POSTROUTING commented below all ports give connection time out like there they fly.

188.212.100.109 - exposed IP address from tunnel 192.168.168.2 - Gameserver IP 192.168.168.1 - internal IP of 188.212.100.109

Hope someone will manage this for me. Best regards, Florin. iptables -P INPUT ACCEPT iptables -P OUTPUT ACCEPT iptables -P FORWARD ACCEPT

iptables -F
iptables -F -t nat
iptables -X
iptables -X -t nat

iptables -t nat -A PREROUTING -d 188.212.100.109 -p tcp --dport 30001:30011 -j DNAT --to-destination 192.168.168.2
iptables -A FORWARD -d 192.168.168.2 -p tcp --dport 30001:30011 -m state --state ESTABLISH -j ACCEPT
iptables -t nat -A POSTROUTING -d 192.168.168.0/30 -j MASQUERADE
#iptables -t nat -A POSTROUTING -d 192.168.168.0/30 -j SNAT --to-source 188.212.100.109
sysctl -w net.ipv4.ip_forward=1
iptables -vL

Comments

Sign In or Register to comment.