Code:
iptables -t nat -A PREROUTING -p tcp -d 192.168.1.222 --dport 4080 -j DNAT --to-destination 192.168.1.118
But it did not work. I also observed that,
Because you did not specified the port in --to-destination IP:PORT. You need to give port also it can not guess it
Code:
iptables -t nat -A PREROUTING -p tcp -d 192.168.1.118 --dport 4080 -j DNAT --to-destination 192.168.1.118:4088
works, i.e, port redirection works.
Answer it as above for second
This port redirection (iptables based) will only works if the destination is in the same network on locally attached interface. If you need to forward it to other network then you need tiny utility called rinetd which is a TCP port redirector. See
http://www.boutell.com/rinetd/ for more and to download it.