From: Florian Westphal <fw@strlen.de>
To: netfilter@e-posta.sk
Cc: netfilter@vger.kernel.org
Subject: Re: ebtables rule rewriten to nft 'set host' does not work
Date: Thu, 30 May 2024 15:10:02 +0200 [thread overview]
Message-ID: <20240530131002.GA2041@breakpoint.cc> (raw)
In-Reply-To: <b1c34f18-f564-4eda-a4ce-1af086d5a8aa@e-posta.sk>
netfilter@e-posta.sk <netfilter@e-posta.sk> wrote:
> I guys I got kind of Man-In-Middle setup, where ubuntu based box is
> correcting coordinates transferred thru wire.
>
> This is old setup coming from age of iptables and ebtables. I tried to move
> to nft command-line, but with no success. ebtables command works, but nft
> does not. Note: box is running nftables with iptable and ebtable interface.
>
> When I convert ebtables command into nft rule, this rule never get hit,
> while its ebtables equivalent does.
>
> nft version
>
> # nft -V
> nftables v1.0.2 (Lester Gooch)
> cli: editline
> json: yes
> minigmp: no
> libxtables: yes
>
>
> script setting nft ruleset via nft and ebtables
>
> #!/bin/bash
> IP=*IP*
> PORT=*PORT*
>
> nft flush ruleset
> nft -f - <<NFT
> table bridge nat {
> chain PREROUTING {
> type filter hook prerouting priority dstnat; policy accept;
> meta ibrname "*DEV*" ip daddr ${IP} ether type ip tcp
> dport ${PORT} meta pkttype set host
> }
> }
> ....
> NFT
> # this rule does not work in NFT (yet?)
> ebtables -t nat -A PREROUTING --logical-in *DEV*-p ipv4 --ip-protocol tcp
> --ip-dst $IP --ip-dport $PORT -j redirect --redirect-target ACCEPT
-j redirect mangles ethernet destination address to that of bridge
device.
See this example from nft(8):
# assumes 00:11:22:33:44:55 is local MAC address.
bridge input meta iif eth0 ip saddr 192.168.0.0/16 tcp dport \
80 meta pkttype set unicast ether daddr set 00:11:22:33:44:55
next prev parent reply other threads:[~2024-05-30 13:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-29 9:07 ebtables rule rewriten to nft 'set host' does not work netfilter
2024-05-29 23:17 ` Kerin Millar
2024-05-30 13:10 ` Florian Westphal [this message]
2024-05-30 14:50 ` netfilter
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=20240530131002.GA2041@breakpoint.cc \
--to=fw@strlen.de \
--cc=netfilter@e-posta.sk \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.