netfilter.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Francisco Agostinho <f.agostinho123@gmail.com>
To: Kerin Millar <kfm@plushkava.net>, netfilter@vger.kernel.org
Subject: Re: IPtables rate limiting question
Date: Thu, 31 Oct 2024 12:20:14 +0000	[thread overview]
Message-ID: <CAMa3rT6HD_5mroBZ-dPkvp85tWBsw+5FFwzWmMqABdaPyA7pJw@mail.gmail.com> (raw)
In-Reply-To: <85253915-6d36-483f-a84b-69de4a1ba161@app.fastmail.com>

>*raw
>:PREROUTING ACCEPT [0:0]
>:OUTPUT ACCEPT [0:0]
>:limitban - [0:0]
>-A PREROUTING ! -i lo -p tcp -m conntrack --ctstate NEW -j limitban
>-A limitban -m set --match-set banned src -j DROP
>-A limitban -m hashlimit --hashlimit-above 10/min --hashlimit-mode srcip --hashlimit-name test10 -j SET --add-set banned src --timeout 900
>-A limitban -m hashlimit --hashlimit-above 80/min --hashlimit-mode srcip --hashlimit-name test80 -j SET --add-set banned src
>-A limitban -m set --match-set banned src -j DROP
>COMMIT

>For this ruleset to be loadable, you'll first need to create the ipset that it references.

># ipset create banned hash:ip timeout 1800

Regarding not mentioning the tables, I was using *nat table for the
PREROUTING and before tried to use the DROP rules on the *filter
table, which was not dropping the traffic.

Ok so the ipset suggestion worked! The current setup that worked is
putting the DROP rules on the *raw table PREROUTING and the SET rules
on the *nat table PREROUTING. Also created 1 ipset for each use case.

Thank you very much for the help!

<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Sem vírus.www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

      parent reply	other threads:[~2024-10-31 12:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-25 15:19 IPtables rate limiting question Francisco Agostinho
2024-10-25 18:12 ` Kerin Millar
2024-10-25 20:13   ` Slavko
2024-10-25 21:37     ` Kerin Millar
2024-10-26 10:23       ` Reindl Harald
2024-10-26 11:05         ` Kerin Millar
2024-10-26 11:15           ` Reindl Harald
     [not found]   ` <CAMa3rT6WZXDaUhvfjmWL8+_Jun-2M4zGqr2U4OBig7Z7LrDpgQ@mail.gmail.com>
2024-10-31 12:15     ` Francisco Agostinho
2024-10-31 12:28       ` Reindl Harald
2024-10-31 12:20   ` Francisco Agostinho [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMa3rT6HD_5mroBZ-dPkvp85tWBsw+5FFwzWmMqABdaPyA7pJw@mail.gmail.com \
    --to=f.agostinho123@gmail.com \
    --cc=kfm@plushkava.net \
    --cc=netfilter@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).