Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
iptables portforwarding, how?
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
dev-null-devil
Tux's lil' helper
Tux's lil' helper


Joined: 12 May 2003
Posts: 93

PostPosted: Sun Sep 07, 2003 6:17 pm    Post subject: iptables portforwarding, how? Reply with quote

How do i portforward all incoming packets on my router (eth0) to an internal machine, the internal machine is a virtual server connected through a tap0 device, so i need something like this (in human language):

all connections to my server on port 80, should be forwarded to 192.x.x.x on tap0 from eth0. (eth0 contains the external ip.)

Sorry, but thats just the best i could do, im not really familiar with iptables or the linux (/unix) language.. yet.
Hope someone could clear this up anyway.

/Peter
_________________
All change, motion, and time is an illusion.
-- Plato, year 310
Back to top
View user's profile Send private message
cvk
Guru
Guru


Joined: 06 Jan 2003
Posts: 314
Location: Our house, in the middle of our street

PostPosted: Sun Sep 07, 2003 6:52 pm    Post subject: Reply with quote

If I remember correctly
Code:
iptables -t nat -A PREROUTING -p tcp --dport 80 -i eth0 -j DNAT --to 192.x.x.x:80

should do the job, doesn't it?

cvk
_________________
Adopt an unanswered post now.
Back to top
View user's profile Send private message
dev-null-devil
Tux's lil' helper
Tux's lil' helper


Joined: 12 May 2003
Posts: 93

PostPosted: Sun Sep 07, 2003 7:14 pm    Post subject: Reply with quote

My eth1 device has 192.168.x.x and that is the same number as on my tap0 device, so i need to specify the tap0 device somehow.
// Friend told me so, but he cant configure iptables :(
_________________
All change, motion, and time is an illusion.
-- Plato, year 310
Back to top
View user's profile Send private message
cvk
Guru
Guru


Joined: 06 Jan 2003
Posts: 314
Location: Our house, in the middle of our street

PostPosted: Sun Sep 07, 2003 7:23 pm    Post subject: Reply with quote

You can add the "-o" parameter to specify the out-interface.

chris
_________________
Adopt an unanswered post now.
Back to top
View user's profile Send private message
dev-null-devil
Tux's lil' helper
Tux's lil' helper


Joined: 12 May 2003
Posts: 93

PostPosted: Sun Sep 07, 2003 7:28 pm    Post subject: Reply with quote

Like this (just add?):
iptables -t nat -A PREROUTING -p tcp --dport 80 -i eth0 -o tap0 -j DNAT --to 192.x.x.x:80

or this (replace?):
iptables -t nat -A PREROUTING -p tcp --dport 80 -o tap0 -j DNAT --to 192.x.x.x:80

mumble mumble, sorry for my newbiness, is there btw, somewhere i can read about iptables, or offcourse i mean learn?
_________________
All change, motion, and time is an illusion.
-- Plato, year 310
Back to top
View user's profile Send private message
sschlueter
Guru
Guru


Joined: 26 Jul 2002
Posts: 578
Location: Dortmund, Germany

PostPosted: Sun Sep 07, 2003 11:07 pm    Post subject: Reply with quote

dev-null-devil wrote:

My eth1 device has 192.168.x.x and that is the same number as on my tap0 device, so i need to specify the tap0 device somehow.
(


You need unique IPs!
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