I'm playing around with nftables
to gain more experience and have a pretty easy scenario: NAT the destination port 8080 to 8081 (not really useful but in the Lab it is good enough).
This nft config works (so all packets which are targeted at port 8080 are forwarded to port 8081):
chain foo {
type nat hook output priority mangle; policy accept;
tcp dport 8080 redirect to :8081
}
when I change the base chain hook from output
to prerouting
:
chain foo {
type nat hook prerouting priority mangle; policy accept;
tcp dport 8080 redirect to :8081
}
it doesn't work any more.
Why does the prerouting
hook is not working in this scenario?