I want to deflect some IP address that we access using any tools (like nmap, medusa, etc) to the another IP Address.
For more details:
I have 2 IP Addresses, First IP Address is 192.168.1.7
and the Second is 192.168.1.6
. When I want to access the first IP Address using another PC in the same LAN, I want to deflect that to the Second IP Address on port 22, so I using Iptables for that as you can see here, I add some rule on the second IP Address pc:
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -p tcp --dport 22 -j DNAT --to-destination 192.168.43.7
iptables -t nat -A POSTROUTING -j MASQUERADE
after I tried that, it was work. But, I really need the IP Address information about who was accessing the IP Address because the result show that it's only the first IP Address that was accessing the second IP Address, not the third one. Can you help me please? Because it always converting the IP Address Source and I don't know why.
Oh, I also tried using any tools port forwarder like rinetd, socat, etc. But it doesn't work. Do you have any idea for this? I really need help.
[Update] :
I've tried using SNAT on the rule in iptables but it has same result. I read this post How to do the port forwarding from one ip to another ip in same network? but I don't know what must I do with that