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

rackathon
 
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: 1302
Location: Looking over your shoulder.

PostPosted: Sat Apr 26, 2008 11:13 pm    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?
_________________
"So they turn the 'For every new Windows you have to buy new hardware' around to 'For every new hardware you have to buy a new Windows'."

Kawa-kun!


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


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

PostPosted: Sun Apr 27, 2008 12: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.
_________________
¿Osas enfrentarte a Maikel Yacson?.
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 - 5 Hours
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