View previous topic :: View next topic |
Author |
Message |
dev-null-devil Tux's lil' helper
Joined: 12 May 2003 Posts: 93
|
Posted: Sun Sep 07, 2003 6:17 pm Post subject: iptables portforwarding, how? |
|
|
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 |
|
|
cvk Guru
Joined: 06 Jan 2003 Posts: 314 Location: Our house, in the middle of our street
|
Posted: Sun Sep 07, 2003 6:52 pm Post subject: |
|
|
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 |
|
|
dev-null-devil Tux's lil' helper
Joined: 12 May 2003 Posts: 93
|
Posted: Sun Sep 07, 2003 7:14 pm Post subject: |
|
|
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 |
|
|
cvk Guru
Joined: 06 Jan 2003 Posts: 314 Location: Our house, in the middle of our street
|
Posted: Sun Sep 07, 2003 7:23 pm Post subject: |
|
|
You can add the "-o" parameter to specify the out-interface.
chris _________________ Adopt an unanswered post now. |
|
Back to top |
|
|
dev-null-devil Tux's lil' helper
Joined: 12 May 2003 Posts: 93
|
Posted: Sun Sep 07, 2003 7:28 pm Post subject: |
|
|
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 |
|
|
sschlueter Guru
Joined: 26 Jul 2002 Posts: 578 Location: Dortmund, Germany
|
Posted: Sun Sep 07, 2003 11:07 pm Post subject: |
|
|
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 |
|
|
|