Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Amiq Nahas <m992493@gmail.com>
Cc: netfilter@vger.kernel.org
Subject: Re: Use ipset and conntrack with nftables
Date: Tue, 18 Aug 2020 12:13:52 +0200	[thread overview]
Message-ID: <20200818101352.GB10691@salvia> (raw)
In-Reply-To: <CAPicJaE9qBs4NAKGzzKLU5GzNneJa6056WbdGn_RzVqKJhSrWg@mail.gmail.com>

On Tue, Aug 18, 2020 at 03:14:04PM +0530, Amiq Nahas wrote:
> Hi Guys,
> 
> What would be the nftables equivalent for this rule:
> iptables -D FORWARD -m conntrack --ctorigsrc 172.5.1.123 --ctproto tcp
> -j MARK --set-mark 123

# iptables-translate -A FORWARD -m conntrack --ctorigsrc 172.5.1.123 --ctproto tcp
nft add rule ip filter FORWARD ct original protocol tcp ct original saddr 172.5.1.123 counter

> Also how can such a rule be made for a collection of different
> ip-addresses in an ipset.
> 
> So as an example: 172.5.1.123, 172.5.1.124, 172.5.1.125, 172.5.1.126
> all these ips are part of an ipset called 'myset'
>
> How can a rule like mentioned above be applied to a collection of ips
> denoted by an ipset 'myset'?

  nft add rule ip filter FORWARD ct original protocol tcp ct original saddr @myset counter

You have to define the set:

  nft add set ip filter myset { type ipv4_addr \; }

      reply	other threads:[~2020-08-18 10:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-18  9:44 Use ipset and conntrack with nftables Amiq Nahas
2020-08-18 10:13 ` Pablo Neira Ayuso [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=20200818101352.GB10691@salvia \
    --to=pablo@netfilter.org \
    --cc=m992493@gmail.com \
    --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