I have a RHEL 7 (IP 192.168.0.10/24) and RHEL 8 (IP 192.168.0.11/24) host both of which are getting duplicated packets from a router which are intended for a different host (IP 192.168.1.10/24). How can I use iptables on the RHEL 7 host and nftables on the RHEL 8 host to modify the destination IP so that each host receives the packet as if it was truly the destination?
Sample packet on the rhel7 host:
[root@rhel7 ~]# tcpdump -nni eth0 port 20800
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
11:43:53.339859 IP 1.2.3.4.22551 > 192.168.1.10.20800: Flags [S], seq 2316850366, win 29200, options [mss 1460,sackOK,TS val 3894703027 ecr 0,nop,wscale 7], length 0
I think something has to be done in the prerouting table but I didn't have success with this:
iptables -t nat -I PREROUTING -d 192.168.1.10 -j DNAT --to 192.168.0.10
Any suggestions? I assume once the iptables command is figured out, the nftables command be found using iptables-translate.