Server Fades Away From Server List

35 replies [Last post]
STARLESS )NWC(
Starless's picture
Offline
Joined: Jan 2005
Posts:
Re: LoL
TC HEADTRIP wrote:


anyway, back to the real topic of this thread. the "fading" effect can be quite simple to solve with an iptables gateway. the trick is to make the master browser THINK your server has changed ports, all the while redirecting incomming traffic to the same port on the internal server. this can be acheived with some DNAT rules.

If you have access to iptables, then its easier to do what I said in an earlier post. Basically, block outgoing heartbeats most of the time (e.g. for 3.5 hours, then let them through for .5 hours. This tricks the master server into thinking your servers are new and lists them on top. It will cache the server info during the time that the heartbeats are blocked. Here's a little script:

[code:1]#!/bin/bash

# Script to block outgoing heartbeats to 192.246.40.56
#
#
if [ "$1" = "-u" ]
then
iptables -D OUTPUT -d 192.246.40.56 -j REJECT
else
iptables -A OUTPUT -d 192.246.40.56 -j REJECT
fi
[/code:1]

Then just run it out of cron like so
[code:1]
30 0,4,8,12,16,20 * * * /path/to/q3block
0 0,4,8,12,16,20 * * * /path/to/q3block -u
[/code:1]

Thats somewhat easier and more efficient than packet mangling...

TC HEADTRIP
Offline
Joined: Sep 2005
Posts:
Re: LoL
STARLESS )NWC( wrote:

TC HEADTRIP wrote:

anyway, back to the real topic of this thread. the "fading" effect can be quite simple to solve with an iptables gateway. the trick is to make the master browser THINK your server has changed ports, all the while redirecting incomming traffic to the same port on the internal server. this can be acheived with some DNAT rules.

If you have access to iptables, then its easier to do what I said in an earlier post. Basically, block outgoing heartbeats most of the time (e.g. for 3.5 hours, then let them through for .5 hours. This tricks the master server into thinking your servers are new and lists them on top. It will cache the server info during the time that the heartbeats are blocked. Here's a little script:

[code:1]#!/bin/bash

# Script to block outgoing heartbeats to 192.246.40.56
#
#
if [ "$1" = "-u" ]
then
iptables -D OUTPUT -d 192.246.40.56 -j REJECT
else
iptables -A OUTPUT -d 192.246.40.56 -j REJECT
fi
[/code:1]

Then just run it out of cron like so
[code:1]
30 0,4,8,12,16,20 * * * /path/to/q3block
0 0,4,8,12,16,20 * * * /path/to/q3block -u
[/code:1]

Thats somewhat easier and more efficient than packet mangling...

I do agree that it is an eaiser way to go about it. Unfortunatly I had only some luck with that method. My server would be near the top for the first hour or so then it would drop rapidly, some times after as little as 10 min. which is why I started using this solution. None the less there are always more than one way to kill a bird. It really comes down to what works better for you and your specific configuration, possibly even your ISP's configuration. there are probably 10 other ways it can be done. Again, thats not to say any one way is per say better than the other. As well it seems you are putting those rules into the OUTPUT chain in the default table, So it does look as if our setups are vastly diffrent, I was running my server inside of a NATed network 192.168.1.0/23, for me blocking things in that table did jack, I had to do the same block in my nat table on the POSTROUTING chain. Considering the setup that was in question was running the Q3 server on a windows box, iptables would not be an option for the localhost, and the method I detailed is a method I tested extensively and know to work in that situation. additionaly your method would work with some minor modification.. ie changing the script to

[code:1]#!/bin/bash

# Script to block outgoing heartbeats to 192.246.40.56
#
#
if [ "$1" = "-u" ]
then
iptables -t nat -D POSTROUTING -d 192.246.40.56 -j DROP
else
iptables -t nat -A POSTROUTING -d 192.246.40.56 -j DROP
fi
[/code:1]

and then running the same thing from the gateway box
-HeadTrip

Kal
Offline
Joined: Sep 2006
Posts:
Server Fades Away From Server List

[code:1]Code:
#!/bin/bash

# Script to block outgoing heartbeats to 192.246.40.56
#
#
if [ "$1" = "-u" ]
then
iptables -D OUTPUT -d 192.246.40.56 -j REJECT
else
iptables -A OUTPUT -d 192.246.40.56 -j REJECT
fi

Then just run it out of cron like so
Code:

30 0,4,8,12,16,20 * * * /path/to/q3block
0 0,4,8,12,16,20 * * * /path/to/q3block -u [/code:1]

I am curious if anyone ever created or found a working script that works on a q3 linux server like escapedturkey uses to keep their servers on top of the listings. Thanks!

Kal

escapedturkey
Offline
Joined: Mar 2008
Posts:
Server Fades Away From Server List

crontab (for root)

0 0,4,8,12,16,20 * * * /usr/bin/popular.sh drop & >/dev/null 2>&1
30 3,7,11,15,19,23 * * * /usr/bin/popular.sh clear & >/dev/null 2>&1

[root@ga1 bin]# cat popular.sh
#!/bin/sh
#hide_from_id.sh
#ID_SOFT1=192.246.40.0/24

ID_SOFT1=monster.idsoftware.com

case "$1" in
"drop") /sbin/iptables -A INPUT -s $ID_SOFT1 -j DROP
/sbin/iptables -A OUTPUT -d $ID_SOFT1 -j DROP
;;
*) /sbin/iptables -D INPUT -s $ID_SOFT1 -j DROP
/sbin/iptables -D OUTPUT -d $ID_SOFT1 -j DROP
;;
esac

exit 0
[root@ga1 bin]#

Also, here's a version if you want some servers to do that and others not:

#!/bin/sh
#hide_from_id.sh
#ID_SOFT1=192.246.40.0/24

ID_SOFT1=monster.idsoftware.com
EXCEPT=some.host.com or IP

case "$1" in
"drop") /sbin/iptables -I INPUT -s $EXCEPT -j ACCEPT
/sbin/iptables -A INPUT -s $ID_SOFT1 -j DROP
/sbin/iptables -A OUTPUT -d $ID_SOFT1 -j DROP
;;
*) /sbin/iptables -I INPUT -s $EXP -j ACCEPT
/sbin/iptables -D INPUT -s $ID_SOFT1 -j DROP
/sbin/iptables -D OUTPUT -d $ID_SOFT1 -j DROP
;;
esac
exit 0

BTW: I'm escapedturkey -- I registered but for some reason never got a registration e-mail so I am using this new name "turkey123".

Cool

(HK) GoddaM
goddam's picture
Offline
Joined: Aug 2004
Posts:
Server Fades Away From Server List

ET in the house!!
welcome aboard and enjoy your stay.
thanks for info BTW.