Port Mapping on Linux

Mapping port 80 to inner port 8080:
/sbin/iptables -t nat -A PREROUTING -i eth+ -p tcp –dport 80 -j REDIRECT –to-port 8080

Well, I use this trick to avoid firewall blocking.

This entry was posted in Tricks. Bookmark the permalink.

2 Responses to Port Mapping on Linux

  1. Curt Lee says:

    # iptables -t nat -A PREROUTING -i eth0 -p tcp -dport 80 -j REDIRECT -to-port 8080
    Bad argument `80′
    Try `iptables -h’ or ‘iptables –help’ for more information.

  2. KC says:

    The dport and to-port parameters require two dashes on the command line:

    e.g.

    –dport 80 ….. –to-port 8080

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>