Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
reidrecting ports (like nat) on same system
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
vdboor
Guru
Guru


Joined: 03 Dec 2003
Posts: 592
Location: The Netherlands

PostPosted: Sun Jul 04, 2004 1:27 pm    Post subject: reidrecting ports (like nat) on same system Reply with quote

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
View user's profile Send private message
DrCrippen
n00b
n00b


Joined: 04 Jun 2004
Posts: 18
Location: Warendorf / Germany

PostPosted: Sun Jul 04, 2004 4:18 pm    Post subject: Reply with quote

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
View user's profile Send private message
tuxmin
l33t
l33t


Joined: 24 Apr 2004
Posts: 838
Location: Heidelberg

PostPosted: Sun Jul 04, 2004 7:11 pm    Post subject: Reply with quote

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
View user's profile Send private message
tuxmin
l33t
l33t


Joined: 24 Apr 2004
Posts: 838
Location: Heidelberg

PostPosted: Sun Jul 04, 2004 7:12 pm    Post subject: Reply with quote

Typo...

of course it must read: ssh localhost -N -L8888:localhost:80 &
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