ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Port Redirection with IPTables on CentOS 6

    IT Discussion
    1
    2
    518
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • StrongBadS
      StrongBad
      last edited by

      Was struggling with this today but finally tracked down how to get this working. Most websites have this for different versions of IPTables which will not work.

      Here is what my CentOS brethren need to know. Just add this after the COMMIT line after the *filter section.

      *nat
      :PREROUTING ACCEPT [0:0]
      :POSTROUTING ACCEPT [0:0]
      :OUTPUT ACCEPT [0:0]
      -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-port 8080
      COMMIT

      Where 80 is the port external users will use and 8080 is the port your internal process is listening on.

      1 Reply Last reply Reply Quote 1
      • StrongBadS
        StrongBad
        last edited by

        Should go without saying, applies to RHEL 6 as well.

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post