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











up vote
0
down vote

favorite












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.










share|improve this question







New contributor




onStyle is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
























    up vote
    0
    down vote

    favorite












    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.










    share|improve this question







    New contributor




    onStyle is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      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.










      share|improve this question







      New contributor




      onStyle is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      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.







      iptables firewall






      share|improve this question







      New contributor




      onStyle is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      onStyle is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      onStyle is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked Nov 23 at 17:53









      onStyle

      6




      6




      New contributor




      onStyle is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      onStyle is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      onStyle is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote













          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






          share|improve this answer










          New contributor




          Michael Prokopec is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.


















          • @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 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.
            – Michael Prokopec
            Nov 23 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 at 18:20












          • If the above will not work, the're are resource or other config issues if you're still having issues.
            – Michael Prokopec
            Nov 23 at 18:28










          • Yeah it don't work. If one connect, it must stop other connects for 5 seconds.
            – onStyle
            Nov 23 at 18:58













          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "106"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          onStyle is a new contributor. Be nice, and check out our Code of Conduct.










           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f483737%2fhow-to-limit-1-connection-per-5-seconds-iptables%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote













          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






          share|improve this answer










          New contributor




          Michael Prokopec is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.


















          • @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 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.
            – Michael Prokopec
            Nov 23 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 at 18:20












          • If the above will not work, the're are resource or other config issues if you're still having issues.
            – Michael Prokopec
            Nov 23 at 18:28










          • Yeah it don't work. If one connect, it must stop other connects for 5 seconds.
            – onStyle
            Nov 23 at 18:58

















          up vote
          1
          down vote













          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






          share|improve this answer










          New contributor




          Michael Prokopec is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.


















          • @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 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.
            – Michael Prokopec
            Nov 23 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 at 18:20












          • If the above will not work, the're are resource or other config issues if you're still having issues.
            – Michael Prokopec
            Nov 23 at 18:28










          • Yeah it don't work. If one connect, it must stop other connects for 5 seconds.
            – onStyle
            Nov 23 at 18:58















          up vote
          1
          down vote










          up vote
          1
          down vote









          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






          share|improve this answer










          New contributor




          Michael Prokopec is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          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







          share|improve this answer










          New contributor




          Michael Prokopec is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          share|improve this answer



          share|improve this answer








          edited Nov 24 at 4:06





















          New contributor




          Michael Prokopec is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          answered Nov 23 at 17:56









          Michael Prokopec

          52415




          52415




          New contributor




          Michael Prokopec is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





          New contributor





          Michael Prokopec is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.






          Michael Prokopec is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.












          • @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 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.
            – Michael Prokopec
            Nov 23 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 at 18:20












          • If the above will not work, the're are resource or other config issues if you're still having issues.
            – Michael Prokopec
            Nov 23 at 18:28










          • Yeah it don't work. If one connect, it must stop other connects for 5 seconds.
            – onStyle
            Nov 23 at 18:58




















          • @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 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.
            – Michael Prokopec
            Nov 23 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 at 18:20












          • If the above will not work, the're are resource or other config issues if you're still having issues.
            – Michael Prokopec
            Nov 23 at 18:28










          • Yeah it don't work. If one connect, it must stop other connects for 5 seconds.
            – onStyle
            Nov 23 at 18:58


















          @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 at 17:58






          @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 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.
          – Michael Prokopec
          Nov 23 at 18:15






          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.
          – Michael Prokopec
          Nov 23 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 at 18:20






          "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 at 18:20














          If the above will not work, the're are resource or other config issues if you're still having issues.
          – Michael Prokopec
          Nov 23 at 18:28




          If the above will not work, the're are resource or other config issues if you're still having issues.
          – Michael Prokopec
          Nov 23 at 18:28












          Yeah it don't work. If one connect, it must stop other connects for 5 seconds.
          – onStyle
          Nov 23 at 18:58






          Yeah it don't work. If one connect, it must stop other connects for 5 seconds.
          – onStyle
          Nov 23 at 18:58












          onStyle is a new contributor. Be nice, and check out our Code of Conduct.










           

          draft saved


          draft discarded


















          onStyle is a new contributor. Be nice, and check out our Code of Conduct.













          onStyle is a new contributor. Be nice, and check out our Code of Conduct.












          onStyle is a new contributor. Be nice, and check out our Code of Conduct.















           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f483737%2fhow-to-limit-1-connection-per-5-seconds-iptables%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          サソリ

          広島県道265号伴広島線

          Accessing regular linux commands in Huawei's Dopra Linux