Some usage case that are worth reading :
6. Allow Multiple Ports on IPtables using Multiport
You can allow multiple ports at once, by using multiport, below you can find such rule for both incoming and outgoing connections:
# iptables -A INPUT -p tcp -m multiport --dports 22,80,443 -j ACCEPT
# iptables -A OUTPUT -p tcp -m multiport --sports 22,80,443 -j ACCEPT
10. Block Network Flood on Apache Port with IPtables
Sometimes IP addresses may requests too many connections towards web ports on your website. This can cause number of issues and to prevent such problems, you can use the following rule:
# iptables -A INPUT -p tcp --dport 80 -m limit --limit 100/minute --limit-burst 200 -j ACCEPT
The above command limits the incoming connections from per minute to 100 and sets a limit burst to 200. You can edit the limit and limit-burst to your own specific requirements.
13. Keep a Log of Dropped Network Packets on IPtables
If you want to log the dropped packets on network interface eth0, you can use the following command:
# iptables -A INPUT -i eth0 -j LOG --log-prefix "IPtables dropped packets:"
You can change the value after "--log-prefix" with something by your choice. The messages are logged in /var/log/messages and you can search for them with:
# grep "IPtables dropped packets:" /var/log/messages
15. Limit the Number of Concurrent Connections per IP Address
If you don’t want to have too many concurrent connection established from single IP address on given port you can use the command below:
# iptables -A INPUT -p tcp --syn --dport 22 -m connlimit --connlimit-above 3 -j REJECT
The above command allows no more than 3 connections per client. Of course, you can change the port number to match different service. Also the --connlimit-above should be changed to match your requirement.
(via : https://shaar.libox.fr/?Emb2-w