How to limit 1 connection per 5 seconds? (IPTABLES)

firewalliptables

I want to limit 1 connect per 5 seconds using IPTABLES for people, which are connecting to port "12871/12881". I was trying to find rule for it, but ineffectively.
It must be like a "queue" of connects – for example 1 connect per 5 seconds.

I had here discussion:
How to limit 1 connect per 5 seconds? (IPTABLES) but Im not able to reply on this account, previous was unregistered and logged me out.

Best Answer

Example: Limit Connections Per Second

The following example will drop incoming connections if IP make more than 3 connection attempts to port 12871:12881 within 5 seconds.

iptables -A INPUT -p tcp --dport 12871:12881 -i eth0 -m state --state NEW -m recent --set
iptables -A INPUT -p tcp --dport 12871:12881 -i eth0 -m state --state NEW -m recent --update --seconds 5 --hitcount 3 -j DROP

Just change eth0 to your interface id...

The hitcount and seconds can be tailored to your needs.

I don't know, but it seems like your hardware is just not up to running a HurtWorld server.

Try running it with these options:

  - batchmode
  - nographics
  - exec "host 12871;queryport 12881"
  - servername whateveryouwant
  - addadmin "<My Steam ID>" 
  - logfile "gamelog.txt"

Ref:
https://hurtworld.gamepedia.com/Hosting_A_Server
https://linuxgsm.com/lgsm/hwserver/
https://docs.linuxgsm.com/configuration/linuxgsm-config

Related Question