I want to redirect the tcp port to interfaceX , to new destination : ip 192.168.3.8 on interfaceY with nftable rules.
I tried that:
nft flush ruleset
nft add table ip nat
nft add chain ip nat PREROUTING
nft add rule ip nat PREROUTING iif "interfaceX" tcp dport 1080 dnat to 192.168.3.8
nft add chain ip nat POSTROUTING
nft add rule ip nat POSTROUTING ip daddr 192.168.3.8 oif "interfaceY" snat to 192.168.3.1
The result is:
~# nft list ruleset
table ip nat {
chain PREROUTING {
iif "interfaceX" tcp dport socks dnat to 192.168.3.8
}
chain POSTROUTING {
ip daddr 192.168.3.8 oif "interfaceY" snat to 192.168.3.1
}
}
That not works , that socks continue to arrived to interfaceX
How can I fix that rules?