Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Devin Bayer <dev@doubly.so>
Cc: duncan_roe@optusnet.com.au,
	"netminder (Eric Peterson)" <netminder@gmail.com>,
	netfilter@vger.kernel.org
Subject: Re: meter directive
Date: Mon, 28 Sep 2020 18:40:37 +0200	[thread overview]
Message-ID: <20200928164037.GA3454@salvia> (raw)
In-Reply-To: <e144da82-726e-21fb-fcad-7181a19b0bb7@doubly.so>

On Mon, Sep 28, 2020 at 06:26:04PM +0200, Devin Bayer wrote:
> 
> 
> On 28/09/2020 18.21, Pablo Neira Ayuso wrote:
> 
> > On Mon, Sep 28, 2020 at 06:12:21PM +0200, Devin Bayer wrote:
> 
> >>
> 
> >> How do I get the behavior like in the wiki, which uses maps?
> 
> >
> 
> > What example are you referring to?
> 
> 
> https://wiki.nftables.org/wiki-nftables/index.php/Meters
> 
> % nft list map my_filter_table my_ssh_meter
> 
> table ip my_filter_table {
> 	map my_ssh_meter {
> 		type ipv4_addr . inet_service
>               size 65535
> 		flags dynamic,timeout
> 
> 		elements = { 64.62.190.36 . 55000 expires 38s : counter packets 2 bytes
> 220, 83.98.201.47 . 35460 expires 39s : counter packets 10 bytes 5988,
> 172.217.7.142 . 43254 expires 46s : counter packets 1 bytes 98}
> 
> 	}
> 
> }

I just fixed this in the wiki.

For this example:

% nft add chain filter input {type filter hook input priority 0\;}
% nft add set filter ssh-meter { type ipv4_addr\; flags dynamic\; }
% nft add rule filter input tcp dport 22 ct state new add @ssh-meter { ip saddr limit rate 10/second } accept

The listing is:

% nft list set my_filter_table my_ssh_meter
table ip my_filter_table {
        set my_ssh_meter {
                type ipv4_addr
                size 65535
                flags dynamic
                elements = { 10.141.10.2 limit rate 10/second }
        }
}

  reply	other threads:[~2020-09-28 16:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-04  8:38 meter directive Devin Bayer
2020-09-27 12:27 ` Devin Bayer
     [not found]   ` <20200928021034.GB20886@dimstar.local.net>
2020-09-28 10:01     ` Devin Bayer
2020-09-28 12:32       ` Duncan Roe
2020-09-28 13:00         ` Devin Bayer
2020-09-28 16:08           ` Pablo Neira Ayuso
2020-09-28 16:12             ` Devin Bayer
2020-09-28 16:21               ` Pablo Neira Ayuso
2020-09-28 16:26                 ` Devin Bayer
2020-09-28 16:40                   ` Pablo Neira Ayuso [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-09-28 20:17 Eric Peterson

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=20200928164037.GA3454@salvia \
    --to=pablo@netfilter.org \
    --cc=dev@doubly.so \
    --cc=duncan_roe@optusnet.com.au \
    --cc=netfilter@vger.kernel.org \
    --cc=netminder@gmail.com \
    /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