I am dealing with 3 machines (VMs) :-
A :-172.20.10.1 (Client)
B :-172.20.10.2 (Original Server)
C:-172.20.10.5 (Redirect Server)
Now I want A to visit B and B to forward that to C.
I was able to achieve this by using :-
iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 172.20.10.5:80
iptables -t nat -A POSTROUTING -j MASQUERADE
But now I want to do this for one IP only (I.E) 172.20.10.1 to 172.20.10.5 when it tries to access 172.20.10.2 .. I have already tried The answer here.
net.ipv4.ip_forward = 1 is also set.