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.

1 Answer 1


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"


  • @Michale Prokopec If there will be at specific time more than 3 connects all the time no one will connect - they will try to connect until they won't do it.
    – onStyle
    Nov 23, 2018 at 17:58
  • After 3 connection attempts in 5 seconds by the same IP that IP is ignored. You can change it so after 2 connection attempts within 2 seconds that IP is ignored. Nov 23, 2018 at 18:15
  • "wll drop incoming connections if IP make more than 3 connection". Server have 100 slots for players. In one time connects 100+ different IPs, so these connections are not making one user, but 100 different users. I must do something like: 1 player -> 5 seconds -> 2 player -> 5 seconds
    – onStyle
    Nov 23, 2018 at 18:20
  • If the above will not work, the're are resource or other config issues if you're still having issues. Nov 23, 2018 at 18:28
  • Yeah it don't work. If one connect, it must stop other connects for 5 seconds.
    – onStyle
    Nov 23, 2018 at 18:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.