Linux Netfilter discussions
 help / color / mirror / Atom feed
* Use ipset and conntrack with nftables
@ 2020-08-18  9:44 Amiq Nahas
  2020-08-18 10:13 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Amiq Nahas @ 2020-08-18  9:44 UTC (permalink / raw)
  To: netfilter

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

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'?

Thanks
Amiq

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Use ipset and conntrack with nftables
  2020-08-18  9:44 Use ipset and conntrack with nftables Amiq Nahas
@ 2020-08-18 10:13 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2020-08-18 10:13 UTC (permalink / raw)
  To: Amiq Nahas; +Cc: netfilter

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 \; }

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-18 10:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-18  9:44 Use ipset and conntrack with nftables Amiq Nahas
2020-08-18 10:13 ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox