Read IP tables;

iptables -t nat -L -n -v


For redirecting port to different IP and port


echo “1” > /proc/sys/net/ipv4/ip_forward

Then, we will add a rule telling to forward the traffic on port 1111 to ip on port 1111:

# iptables -t nat -A PREROUTING -p tcp –dport 1111 -j DNAT –to-destination


and finally, we ask IPtables to masquerade:

iptables -t nat -A POSTROUTING -j MASQUERADE



Remove the rule by using -D instead of -A