H|H ~ The Hampshire Heavies Community : Forum
http://www.thehh.eu/forum/

iptables - ip masquerading
http://www.thehh.eu/forum/viewtopic.php?f=30&t=8480
Page 1 of 1

Author:  frog [ Sun Apr 15, 2012 3:19 pm ]
Post subject:  iptables - ip masquerading

Getting people to join the test server at 188.165.220.57:27015 needs a technical helping hand.

Using iptables, I'm trying to redirect all traffic to HH1 at 31.132.2.140:27015 to the HH1 test server at 188.165.220.57:27015. So when people try to join HH1, they end up connecting to the test server.

net.ipv4.ip_forward is enabled, and the following rules having been set

Code:
iptables -t nat -A PREROUTING -d 31.132.2.140 -p tcp --dport 27015 -j DNAT --to-destination 188.165.220.57:27015

iptables -t nat -A POSTROUTING -j MASQUERADE


But it doesn't seem to be working.

Anyone with any experience in this?

Author:  henchling [ Sun Apr 15, 2012 5:53 pm ]
Post subject:  Re: iptables - ip masquerading

Code:
iptables -t nat -A PREROUTING -s 31.132.2.140 -p tcp --dport 27015 -j DNAT --to-destination 188.165.220.57:27015

iptables -t nat -A POSTROUTING -j MASQUERADE


I swapped the first instance of -d (destination) for an -s (source).

I don't have much experience with linux, nor iptables, so, please, mock my gibberings if I've done something silly :)

Author:  frog [ Sun Apr 15, 2012 5:59 pm ]
Post subject:  Re: iptables - ip masquerading

Thanks for looking, but I'm trying to do prerouting, i.e. all incoming packets that are destined for the ip and port that HH1 is running on, rather than packets that are coming from a particular source.

http://linux-ip.net/html/nat-dnat.html

Author:  frog [ Sun Apr 15, 2012 6:40 pm ]
Post subject:  Re: iptables - ip masquerading

Got it working. Needed to add a rule for UDP.

Not sure if it gives the desired result, maybe hl2.exe maintains connection to the old HH1 address sending via that route, hopefully not.

Please let me know of any weirdness.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/