Home > Misc > IPtables Port Redirection

IPtables Port Redirection

April 21st, 2008 Leave a comment Go to comments

Here’s the command-by-command reference of how to forward TCP port 80 on the local host to a remote host (10.1.21.21) on TCP port 8080.

# iptables -F
# iptables -X
# iptables -t nat -A OUTPUT -d 10.1.21.21 -p tcp –dport 80 -j REDIRECT –to-ports 8080
# iptables -t nat -A PREROUTING -d 10.1.21.21 -p tcp –dport 80 -j REDIRECT –to-ports 8080

# /etc/init.d/iptables save
# /etc/init.d/iptables restart
# chkconfig iptables on

Categories: Misc Tags:
  1. No comments yet.
  1. No trackbacks yet.