Redirecting Port Failure

Support for security such as Firewalls and securing linux
Ravenman
Posts: 4
Joined: 2009/03/09 22:30:00

Redirecting Port Failure

Postby Ravenman » 2009/08/24 16:03:07

Hi to all:

I'm trying to redirect one port (8082) to another port (8080) in the same server, I'm putting this rule in the /etc/sysconfig/iptables file:

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 8082 -j REDIRECT --to-port 8080

And when I'm going to restart the iptables service, the system shows me this message:

iptables-restore v1.2.11: Line 49 seems to have a -t table option.

Error occurred at line: 49
Try `iptables-restore -h' or 'iptables-restore --help' for more information.
[FAILED]

What's wrong ? How can I do fix it ?

Ravenman
Posts: 4
Joined: 2009/03/09 22:30:00

Re: Redirecting Port Failure

Postby Ravenman » 2009/08/24 17:20:42

Hi to all:

I've found the answer here: http://oceanpark.com/notes/firewall_example.html

The solution is to add to the /etc/sysconfig/iptables file:

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

Thanks for your interest. Until next time.