UFW is the default firewall configuration tool for Ubuntu. It was developed to ease iptables configuration.
By default the ufw is disabled, so the first thing we need to do is to enable it:
Then we can start adding rules and opening ports
Similarly, to close an open port
After opening some ports and adding rules we can check the ufw’s status
More details: Ubutnu Server Guide
The purpose of this post is to configure UFW to prevent flood traffic or DoS.
The easy way to configure our firewall is modifying the rules with a text editor:
Then add the following lines near to the *filter at the beginning:
Add these lines before COMMIT
With the above rules we are limiting the connections per IP at 20 connections / 10 seconds / IP and
the packets to 20 packets / second / IP.
Finally we need to reload our firewall