View previous topic :: View next topic |
Author |
Message |
vdboor Guru
Joined: 03 Dec 2003 Posts: 592 Location: The Netherlands
|
Posted: Sun Jul 04, 2004 1:27 pm Post subject: reidrecting ports (like nat) on same system |
|
|
Is it possible to redirect ports (like NAT does) to services at the same system? I tried something with -j DNAT in iptables but it didn't seam to work. _________________ The best way to accelerate a windows server is by 9.81M/S²
Linux user #311670 and Yet Another Perl Programmer
[ screenies | Coding on KMess ] |
|
Back to top |
|
|
DrCrippen n00b
Joined: 04 Jun 2004 Posts: 18 Location: Warendorf / Germany
|
Posted: Sun Jul 04, 2004 4:18 pm Post subject: |
|
|
You could change the port the service listens on. Depending on the software this is the easiest way. Or you do it with iptables as you said e.g. :
Code: |
iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 3128
|
That is an example from the netfilter hompage but DNAT should work as well:
Code: |
iptables -t nat -A PREROUTING -p tcp --dport 80 -i eth1 -j DNAT --to 127.0.0.1:3128
|
That should do the same. _________________ registered Linux user number 359161 |
|
Back to top |
|
|
tuxmin l33t
Joined: 24 Apr 2004 Posts: 838 Location: Heidelberg
|
Posted: Sun Jul 04, 2004 7:11 pm Post subject: |
|
|
Hi,
try this one:
ssh localhost -N -L8888:localhost:880 &
Assuming you have your own ssh public key in authorized_keys this one will redirect port 8888 to 80 for instance
Read "man ssh" for more details.
Alex!!! |
|
Back to top |
|
|
tuxmin l33t
Joined: 24 Apr 2004 Posts: 838 Location: Heidelberg
|
Posted: Sun Jul 04, 2004 7:12 pm Post subject: |
|
|
Typo...
of course it must read: ssh localhost -N -L8888:localhost:80 & |
|
Back to top |
|
|
|