Port redirect by iptables

Actually, I like user "redir" better. But it is done well for auto-enable by iptables port redirect.

Example: Redirection on Port 8080 to port 80
Enable a Prerouting Forwarding Rule from port 8080 to 80 by adding the following code after the comments at the top in "/etc/sysconfig/iptables"

*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]

-A PREROUTING -i eth+ -p tcp --dport 80 -j REDIRECT --to-port 8080

COMMIT

Commiting the changes requires a restart of iptables, which is done by

/etc/init.d/iptables restart



Server is hosted by Alanstudio
Linux Operating System

Recommend screen resolution 1024 x 768 / IE / FireFox
Alan Studio © 2007 by Alan Cheung Hin Lun. All rights reserved.