I am currently trying to solve the following problem, but my google/SO searches have not yielded a matching scenario so far:
From my linux host, I must reach the destination host 172.19.28.152. However, due to corporate network complications, I must use a different IP address for that target: 10.187.19.132.
I must solve the problem in the IP layer because the application does not allow changing the target (it will always use the 172... IP address, and there is no way for me to change that behaviour in my scenario). Also, the application does not allow me to specify a DNS name instead.
Because of this, I want to configure nftables to do the following:
If a packet leaves my own host with the destination 172.19.28.152, replace the destination IP with 10.187.19.132. When the target replies, rewrite 10.187.19.132 with the original 172.19.28.152 (NAT) My problem is that I cannot figure out the syntax for such a rule.