Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2011
    Posts
    36

    Howto redirect port with iptables

    Howto forward http port (80) to https port (443) with iptables. I wuant redirect all connect access to https.
    Thank you

  2. #2
    Join Date
    Feb 2012
    Posts
    25
    Please use the following command for redirect port.

    # iptables –t nat –A PREROUTING –i eth0 –p tcp –dport 80 –j REDIRECT –to-port 443

    # /etc/init.d/iptables save

    # chk con fig ipt a bles on

  3. #3
    Join Date
    Feb 2011
    Posts
    36
    Quote Originally Posted by godzbless View Post
    Please use the following command for redirect port.

    # iptables –t nat –A PREROUTING –i eth0 –p tcp –dport 80 –j REDIRECT –to-port 443

    # /etc/init.d/iptables save

    # chk con fig ipt a bles on
    I have a erorr
    Try `iptables -h' or 'iptables --help' for more information.
    howto fix ?

  4. #4
    Join Date
    Jun 2012
    Location
    Amsterdam
    Posts
    13
    Dear daicadung,

    Using iptables for this purpose is not a good idea and will certainly not work with the command supplied by godzbless. Iptables is meant for TCP/IP level forwarding and you need a HTTP 301 redirect. This can be done using your webserver's configuration.

    Since this is in the security forum, it is also worth noting that redirects to the secure website are not a secure thing to do, as proven by Moxie Marlinspike's sslstrip.

Similar Threads

  1. Howto Using Iptables Block User-Agent ?
    By daicadung in forum Hosting Security and Technology
    Replies: 15
    Last Post: 03-25-2012, 12:43 PM
  2. Redirect IP using iptables?
    By PirateSolutions in forum Hosting Security and Technology
    Replies: 1
    Last Post: 05-02-2011, 03:58 AM
  3. iptables REDIRECT to RemoteIP
    By Lander in forum Hosting Security and Technology
    Replies: 2
    Last Post: 03-08-2011, 03:40 AM
  4. Redirect traffic via iptables
    By Markovic in forum Hosting Security and Technology
    Replies: 7
    Last Post: 01-10-2010, 03:47 AM
  5. iptables redirect rule - please help
    By SysTeam in forum Hosting Security and Technology
    Replies: 3
    Last Post: 08-07-2009, 09:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •