From: sorcus@inwebse.com
To: Anton Danilov <littlesmilingcloud@gmail.com>
Cc: netfilter@vger.kernel.org
Subject: Re: What wrong with snat in nftables?
Date: Fri, 14 Jul 2017 01:06:17 +0000 [thread overview]
Message-ID: <6687da5a7ee70c19e1c3b41fea5fb20f@inwebse.com> (raw)
In-Reply-To: <e55eeed4d10d0209dc4441a83b1bc922@inwebse.com>
Nftables rules for server -
https://gist.github.com/MrSorcus/17827298ad81970cc272b9e7f779923f
Nftables rules for client -
https://gist.github.com/MrSorcus/ad05f19759e02f92aac5d9c246f56cf6
I used information from here -
https://wiki.nftables.org/wiki-nftables/index.php/Performing_Network_Address_Translation_(NAT)
> 1. flush conntrack entries after changing of rules in the nat table.
"conntrack -D" - show me "0 flow entries have been deleted.". But
"/proc/net/nf_conntrack" has 3 entries...
> 2. add counters to nftables nat rule to check that rule really hit the
> packets.
chain postrouting {
type nat hook postrouting priority 0; policy drop;
oif "enp0s3" nftrace set 1 counter packets 3 bytes 312 snat to
2a01:4f8:xx:xx::10
nftrace set 1 counter packets 0 bytes 0 accept comment "IPv6 < Nat <
Postrouting"
}
With git version of nftables, libmnl & libnftnl and kernels 4.9, 4.11 &
4.12 doesn't work...
With archlinux server doesn't work too...
> On 2017-07-11 10:10, Anton Danilov wrote:
>> Hello.
>> I haven't seen the nftables rules.
>>
>> Seems like you have misconfiguration in the nftables rules.
>>
>> NAT action are being done in the conntrack subsystem, and *tables just
>> apply the rule for first packets of NEW state connection and create
>> special conntrack entries. Other packets of this known connection
>> bypass the rules in the nat table. So it caused working after moving
>> back from ip6tables to nftables, because it hasn't affected the
>> conntrack entries.
>>
>> So, these are two recommends:
>>
>> 1. flush conntrack entries after changing of rules in the nat table.
>> 2. add counters to nftables nat rule to check that rule really hit the
>> packets.
next prev parent reply other threads:[~2017-07-14 1:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-10 13:36 What wrong with snat in nftables? sorcus
2017-07-11 10:10 ` Anton Danilov
[not found] ` <e55eeed4d10d0209dc4441a83b1bc922@inwebse.com>
2017-07-14 1:06 ` sorcus [this message]
2017-07-15 22:47 ` sorcus
2017-07-17 21:24 ` sorcus
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=6687da5a7ee70c19e1c3b41fea5fb20f@inwebse.com \
--to=sorcus@inwebse.com \
--cc=littlesmilingcloud@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