Raised This Month: $51 Target: $400
 12% 

Use iptables to redirect players to new IP


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
live4net
AlliedModders Donor
Join Date: Jul 2014
Old 01-27-2019 , 11:49   Use iptables to redirect players to new IP
Reply With Quote #1

How to redirect players to new dedicated server (CS:GO) using iptables? I try this iptables rule:


Code:
#!/bin/sh

echo 1 > /proc/sys/net/ipv4/ip_forward

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

iptables -t nat -A PREROUTING -d 1.1.1.1 -p tcp --dport 27015 -j DNAT --to-destination 2.2.2.2:27015
iptables -t nat -A PREROUTING -d 1.1.1.1 -p udp --dport 27015 -j DNAT --to-destination 2.2.2.2:27015
iptables -t nat -A POSTROUTING -j MASQUERADE
1.1.1.1 is old IP, 2.2.2.2 is new IP.

When I add old IP (1.1.1.1) to favorities, then I see new server status (2.2.2.2). But when I try to connect to old IP, I get errors:

Code:
Connecting to public(1.1.1.1:27015) ...
Server using 'public' lobbies, requiring pw no, lobby id ffffffffffffffff
ChangeGameUIState: CSGO_GAME_UI_STATE_LOADINGSCREEN -> CSGO_GAME_UI_STATE_INGAME
**** Unable to localize '#GenericConfirmText_Label' on panel descendant of 'MMStatus'
ChangeGameUIState: CSGO_GAME_UI_STATE_INGAME -> CSGO_GAME_UI_STATE_MAINMENU
__________________

live4net is offline
detc
Junior Member
Join Date: May 2016
Old 01-29-2019 , 09:26   Re: Use iptables to redirect players to new IP
Reply With Quote #2

Not sure the "-d 1.1.1.1" argument is necessary, try it without that.
detc is offline
Maxximou5
AlliedModders Donor
Join Date: Feb 2013
Old 01-29-2019 , 13:22   Re: Use iptables to redirect players to new IP
Reply With Quote #3

If that doesn't work you may also need to do the same for the client port.
Maxximou5 is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 01-29-2019 , 13:33   Re: Use iptables to redirect players to new IP
Reply With Quote #4

Why though? This is why the tokens are made so you can migrate servers to a different IP/Port.
But guessing that you're trying to do the complicated route that means you probably run weapon skins etc and don't have stable tokens.

Last edited by Mitchell; 01-29-2019 at 13:33.
Mitchell is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 01-29-2019 , 15:50   Re: Use iptables to redirect players to new IP
Reply With Quote #5

There has been no GSLT banwaves for the few months.
__________________
Neuro Toxin is offline
abdulsami34
Member
Join Date: Oct 2017
Old 02-01-2019 , 12:20   Re: Use iptables to redirect players to new IP
Reply With Quote #6

I'm also looking for a solution for this. It does not work.

@Mitchell, He might be doing it for some DDoS Attacks? I do it on my teamspeak3 it works great?
abdulsami34 is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 02-01-2019 , 14:15   Re: Use iptables to redirect players to new IP
Reply With Quote #7

Quote:
Originally Posted by abdulsami34 View Post
@Mitchell, He might be doing it for some DDoS Attacks? I do it on my teamspeak3 it works great?
I get that iptables can be used for DDoS attacked, however his question was how to redirect players to a new IP. I'm sure if he wanted help how to redirect a DDoS attack he would have mentioned it instead.

Either which way I'd assume when you connect to the server you need to get a reply back from the server that contains the same IP (or metadata) you're trying to connect to.

Last edited by Mitchell; 02-01-2019 at 14:17.
Mitchell is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:37.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode