[Question] Traffic Balancing from Server

10/12/2011 20:12 ryuchetval#1
Hello everybody.

Recently I've been having some trouble with laggs, multiple connections etc, DDoS....
Somebody told me to distribute the server to run on more ip's at once (traffic balancing) so that the lagg could get diminuated.
However this thing could sound easy I find it impossible to add as it's in a packet...

Code:
        public static COPacket SendAuthentication(string ip, byte[] IV)
        {
            byte[] Packet = new byte[32];
            COPacket P = new COPacket(Packet);
            P.WriteInt16((ushort)Packet.Length);
            P.WriteInt16(0x41f);
            P.WriteBytes(IV);
            P.WriteString(ip);
            P.Move(16 - ip.Length);
            P.WriteInt16(5816);
            return P;
        }
Let's say I have 3 ip's...they log on 1 ip but they are sent on 3 ips (this would mean turning ip into an array (string[] ip)

Theoretically there should be a random to pick from 1 of the 3 ip's

This is how it would look (my stupid point of view)

Code:
       [COLOR="DarkOrange"] public static COPacket SendAuthentication(string[] ip, byte[] IV)[/COLOR]
        {
            byte[] Packet = new byte[32];
            COPacket P = new COPacket(Packet);
            P.WriteInt16((ushort)Packet.Length);
            P.WriteInt16(0x41f);
            P.WriteBytes(IV);
[COLOR="DarkOrange"]            Random Rnd = new Random();
            int x = Rnd.Next(1,4);
            P.WriteString(ip[x]);
            P.Move(16 - ip[x].Length);[/COLOR]
            P.WriteInt16(5816);
            return P;
        }
I doubt this would work so I am asking if there is such thing in Conquer PServers to distribute the traffic to different IPs.
10/12/2011 21:45 BaussHacker#2
It doesn't matter. The packets are send to same host either way. You can only protect against ddos with firewalls and it's just a question about the size when it can get through the firewall.
10/13/2011 01:48 pro4never#3
What you're talking about makes no sense and in my mind would make things LESS efficient.

You need to be more strict about error handling and blacklisting if you're experiencing serious problems like you're talking about.


When receiving connections and packets be sure to verify all the information (no zero buffer packets, invalid packets, multiple spammed connections coming from same ip, etc). Make sure you're completely disposing all connection and user information when they dc and that if someone is trying to attack your server (depends on methods obviously) that you blacklist them on SOME level.

Obviously a proper firewall solution would be the best but I've had users test out a simple packet spammer on my server and it was causing issues (cause my game server handles invalid packets well, login wasn't at the time though. Easy fixes!).

It adds a BIT of overhead to your socket system but what you can do is keep some sort of dictionary of

ip Key connections Value

When you receive a connection request (does not interfere with your packet receiving so the additional overhead won't effect other areas of server much) you check if this ip is allowed to connect (ip blacklisting permanently or temporarily) and then check how many current connections it has (mutli client removal and certain ddos protection of connection large amounts of fake connections and spamming your server with invalid packets).

Simple changes like that can make your server HARDER to attack. People can and will always find a way if they have a reason to but taking simple steps to help secure it will go a long way to deal with idiots who just want to piss you off.
10/13/2011 08:35 BaussHacker#4
Quote:
Originally Posted by pro4never View Post
What you're talking about makes no sense and in my mind would make things LESS efficient.

You need to be more strict about error handling and blacklisting if you're experiencing serious problems like you're talking about.


When receiving connections and packets be sure to verify all the information (no zero buffer packets, invalid packets, multiple spammed connections coming from same ip, etc). Make sure you're completely disposing all connection and user information when they dc and that if someone is trying to attack your server (depends on methods obviously) that you blacklist them on SOME level.

Obviously a proper firewall solution would be the best but I've had users test out a simple packet spammer on my server and it was causing issues (cause my game server handles invalid packets well, login wasn't at the time though. Easy fixes!).

It adds a BIT of overhead to your socket system but what you can do is keep some sort of dictionary of

ip Key connections Value

When you receive a connection request (does not interfere with your packet receiving so the additional overhead won't effect other areas of server much) you check if this ip is allowed to connect (ip blacklisting permanently or temporarily) and then check how many current connections it has (mutli client removal and certain ddos protection of connection large amounts of fake connections and spamming your server with invalid packets).

Simple changes like that can make your server HARDER to attack. People can and will always find a way if they have a reason to but taking simple steps to help secure it will go a long way to deal with idiots who just want to piss you off.
And if it's port 80, both the authserver, gameserver and webserver will be down. :rolleyes:
There is not really anything you can do against ddos attacks other than deal with it.
If soemthing like Cloud existed not only for webservers, then it would be smaller attacks you would have to deal with, but in this case it's not a webserver only, so nothing you can do about a ddos attack.
10/13/2011 11:26 Korvacs#5
Yeah this definitely wont help again DDOS, it wont help with lag either, it all goes to the same application, load balancing would be splitting the game server into a node based topology where each node contains a certain number of users and then more nodes are created as numbers of people increase.