Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Simple IPTables: Port Forwarding (SOLVED)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Kenji Miyamoto
Veteran
Veteran


Joined: 28 May 2005
Posts: 1452
Location: Looking over your shoulder.

PostPosted: Sun Apr 27, 2008 4:13 am    Post subject: Simple IPTables: Port Forwarding (SOLVED) Reply with quote

I know this has been talked about again and again, but a search on Google doesn't provide any clear, simple solutions to port forwarding under IPTables. This is the 'normal' port forwarding as in under NAT routers: port X on a machine routes to port Y on another machine behind the NAT, and traffic flows both ways (through NAT). How would I do this?
_________________
[ Kawa-kun, new and improved!! ]

Alex Libman seems to be more of an anarchist than a libertarian.


Last edited by Kenji Miyamoto on Sun Apr 27, 2008 1:59 pm; edited 1 time in total
Back to top
View user's profile Send private message
Inodoro_Pereyra
Advocate
Advocate


Joined: 03 Nov 2006
Posts: 2631
Location: En la otra punta del cable

PostPosted: Sun Apr 27, 2008 5:59 am    Post subject: Reply with quote

Lets suppose you want to port forward 4662 TCP (edk) to 192.168.0.50 and your router wan interface is ppp0:
Code:
iptables -A FORWARD -i ppp0 -o ethX -p tcp --dport 4662 -j ACCEPT #This line only if you have a DROP, then ACCEPT policy.
iptables -A PREROUTING -p tcp --dport 4662 -i ppp0 -j DNAT --to 192.168.0.50:4662  #this one will do the trick

Where ethX should be replaced with your lan network adapter name.

Regards.
_________________
Mi Blog.

Si no fuera por C, estaríamos escribiendo programas en BASI, PASAL y OBOL.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum