iptables port forwarding

iptables port forwarding

I am port forwarding  public ip x.x.x.x  to private ip 192.168.200.200  .

iptables -A INPUT -i eth0 -p tcp –dport 5001 -m state –state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp –sport 5001 -m state –state ESTABLISHED -j ACCEPT
iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp –dport 5001 -j DNAT –to-destination 192.168.200.200:5001

iptables config example

Your email address will not be published. Required fields are marked *