Redirect Internal Port to server with public IP

Support for security such as Firewalls and securing linux
Post Reply
andrsguevara
Posts: 2
Joined: 2011/11/17 21:01:40

Redirect Internal Port to server with public IP

Post by andrsguevara » 2011/11/17 21:07:42

Hi
Please help me I have a server with public ip and what I need is for users to connect from web through the ip and port: 7777 to another server in my internal network

I put this in iptables

iptables-t nat-A PREROUTING-i eth0-p tcp - dport 7777 j DNAT - to 192.168.0.2:7777

thank you very much for your help

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Redirect Internal Port to server with public IP

Post by jlehtone » 2011/11/18 09:14:35

What is your question?

andrsguevara
Posts: 2
Joined: 2011/11/17 21:01:40

Re: Redirect Internal Port to server with public IP

Post by andrsguevara » 2011/11/18 16:34:15

this line

iptables-t nat-A PREROUTING-i eth0-p tcp - dport 7777 j DNAT - to 192.168.0.2:7777

is not working

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Redirect Internal Port to server with public IP

Post by jlehtone » 2011/11/18 19:05:16

"Not working" is terribly ambiguous.

Surely the typos are only in your posts?
[code]iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 7777 -j DNAT --to-destination 192.168.0.2[/code]
Or perhaps it is the fact that after routing the packets enter
the FORWARD chain of filter table and must pass it too?

Post Reply