From: Florian Westphal <fw@strlen.de>
To: david NEW <david@hajes.org>
Cc: netfilter@vger.kernel.org
Subject: Re: nftables static routing fails
Date: Mon, 13 Jan 2020 22:40:02 +0100 [thread overview]
Message-ID: <20200113214002.GJ795@breakpoint.cc> (raw)
In-Reply-To: <967a25ca-ed80-b13e-a301-0907081debbf@hajes.org>
david NEW <david@hajes.org> wrote:
> hi,
>
> I am trying to route blocked ip set to IP:8080 where is info about "you have
> been blocked"
>
> table ip raw {
> set bad_ip {'
> type ipv4_addr
> elements = { xxx.xxx.xxx.xxx }
> }
>
> chain prerouting {
>
> type filter hook prerouting priority -500; policy accept;
> nft add raw preroute ip saddr @bad_ip tcp dport { 80, 443 } ip daddr set
> xxx.xxx.xxx.xxx tcp dport set 8080 notrack
> }
>
>
> netfilter doesn't complain about this rule but nothing happens...connection
> timed out and nothing happened. I see no errors in Apache2 logs.
>
> I can see connection attempt in tcpdump but it is not redirected.
How do you know from tcpdump? tcpdump occurs before port rewrite.
You should see syn to foo:80, then a syn-ack from xxx.xxx.xxx.xxx:8080.
As original client connected to foo:80, the syn-ack is dropped on client
side.
You need to add a reverse xlate rule if you really want this, or use
normal redirect via nat.
next prev parent reply other threads:[~2020-01-13 21:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-13 21:13 nftables static routing fails david NEW
2020-01-13 21:28 ` Daniel
2020-01-13 21:40 ` Florian Westphal [this message]
2020-01-13 21:59 ` david NEW
2020-01-13 22:33 ` Florian Westphal
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=20200113214002.GJ795@breakpoint.cc \
--to=fw@strlen.de \
--cc=david@hajes.org \
--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.