phpBB Forum
 
It is currently Wed Mar 25, 2020 4:13 pm




Post new topic Reply to topic  [ 4 posts ] 
iptables - ip masquerading 
Author Message
HH Donor
HH Donor
User avatar

Joined: Tue Dec 25, 2007 12:08 am
Posts: 6095
STEAM_0:0:16743808
MCID: frog
Post 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?


Sun Apr 15, 2012 3:19 pm
Profile E-mail
HH Donor
HH Donor
User avatar

Joined: Wed Jan 06, 2010 3:32 pm
Posts: 377
STEAM_0:1:24518594
Post 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 :)


Sun Apr 15, 2012 5:53 pm
Profile E-mail
HH Donor
HH Donor
User avatar

Joined: Tue Dec 25, 2007 12:08 am
Posts: 6095
STEAM_0:0:16743808
MCID: frog
Post 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


Sun Apr 15, 2012 5:59 pm
Profile E-mail
HH Donor
HH Donor
User avatar

Joined: Tue Dec 25, 2007 12:08 am
Posts: 6095
STEAM_0:0:16743808
MCID: frog
Post 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.


Sun Apr 15, 2012 6:40 pm
Profile E-mail
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © phpBB Group.
Designed by Vjacheslav Trushkin for Free Forum/DivisionCore.