Yes and no, my favourite answer, because it heavily depends on what you consider "working".adripillo said:If I have DDoS attacks can I add a list of allowed IPs to connect to the server and set the firewall to reject "the rest"? Can this work?
ShelLuser said:Yes and no, my favourite answer, because it heavily depends on what you consider "working".
It will most certainly stop the attacking processes from connecting to any of your services, but unfortunately it will not "nullify" the effects of the DDoS itself. Your server will remain to be hardly reachable, or worse.
Because even though you may now block the incoming packets it doesn't make those packets suddenly go away. Even if you tell the firewall to ignore them they still need to be processed, thus will also continue to gobble up precious resources. With all the nasty and unwanted side effects.
Hope this helps shed some light on this.
The best way is to contact the "upper layer". So if we're talking about a home server then you should contact your Service Provider ("ISP"), if this is a hosted server then it's time to talk to the hosting provider, and so on.adripillo said:Any other idea of how to stop it or at least get the connection more stable for the IPs that are allowed?
I think I may have been a little unclear above.. When talking IPv6 I'm merely reflecting on that as a valid option to easily avoid nastiness as a client. If we're talking about hosting a (web)server which provides several features for clients or customers then IPv6 obviously is not a feasible solution just yet, because at this time the best option is to provide both (IPv4 and IPv6).gkontos said:Unfortunalty in this case IPv6 will not help if you are using DNS for your service. Also, most consumer ISP's still don't provide IPv6 yet.
And that's where I don't fully agree.gkontos said:Your best defense is to block the attackers at the firewall level. This can be done either static or dynamic.
kpa said:I also disagree about using only a firewall to block attackers. A firewall will not stop the packets arriving at the firewall, all it does is to deny access to any further. In case of a large DDoS a firewall isn't a solution at all, only the upstream that is your ISP can do anything about it.
gkontos said:You don't always have the luxury of having an upstream that is willing to do that for you. In most cases they will shut you down until you "fix" the problem.
Blocking the attacker in the firewall level might increase your CPU but this is nothing compared to the usage that an DOS attack can bring to a web server in regards to CPU & Bandwidth.
kpa said:The firewall is useful only when your connection can take the brunt of the attack, when it starts to choke under the load the firewall becomes irrelevant.
I'm not sure what you're trying to say here. Especially considering that the firewalls provided by FreeBSD are basically application firewalls, thus spanning the application layer with the network and transport layer.gkontos said:Just FYI, a network firewall works in layers 3-4. Most DOS attacks are aimed at services running at layer 7
And now you completely lost me.gkontos said:There are many ways to examine the logs of a service that is being attacked and use scripts that can extract the offending IP addresses. Those IP addresses can then be added dynamically to a table.
ShelLuser said:I'm not sure what you're trying to say here. Especially considering that the firewalls provided by FreeBSD are basically application firewalls, thus spanning the application layer with the network and transport layer.
ShelLuser said:And now you completely lost me.
Because such a setup is just as bad as having to let a webserver (or any other application) handle the load of the problems. I dare to argue that it's even worse because this process is two folded; one process to extract the information and another to apply this to the firewall. Taken a "common" DDoS onslaught into account I can only shudder at the sheer idea.
ShelLuser said:Also; you now mention DOS but the OP mentioned DDoS, there is a significant difference because the latter will have a lot more magnitude. Easily surpassing the abilities of one single server.
ShelLuser said:Once again I don't agree here. In fact; I think in comparison the OP's initial suggestion of following the concept "Allow some, deny the rest" would actually be a more preferable approach.
throAU said:Bear in mind: firewall rules increase processing overhead and can not do anything about the traffic "on the wire" being sent to you. Hence, blocking traffic on your firewall may not help - the traffic already arrived, and consumed your bandwidth.
Additionally, having your firewall inspect and process all those packets may lead to other performance issues due to processing overhead. So whilst you may prevent an intrusion (which your rule-set should already try to do DDOS or not), you'll still be under DDOS. Even if you drop ALL traffic from the IP ranges in question on your firewall and you have the processing resources available to process every incoming packet, the traffic already filled your uplink's bandwidth. You are still denied service.
As above, the only real solution is to get the traffic blocked upstream at the network backbone if necessary, before the point where the network connectivity fans out to low bandwidth circuits.
I.e., if you are getting hit with 1-10 gigabit worth of DDOS, whatever filtering or shaping you try to do on the end of your 10 or 100 megabit customer connection is going to have little effect on the actual availability of your link.