Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Hi.
Suppose I have a local machine L, two remote machines R1 and R2 and a "middle" machine M.
L has no TCP/IP access to R1 or R2, but M has access to L, R1 and R2.
L has 2 local interfaces (127.0.0.1 and 127.0.0.2)
The aim is to make 2 connection forwardings listening to the same port but on different local IPs. ie (from L) :
ssh -L 1234:R1:1234 M
This should listen on 127.0.0.1
and :
ssh -L 1234:R2:1234 M
This one should listen on 127.0.0.2
Does anyone know how to do this with openssh or another ssh client?
The only soft I saw able to do this is secure-crt under windows... :-(
Impossible. The virtual host settings on the server side (R1 & R2) do not allow clients to request another port than 1234 (This tunnel has to transport HTTP).
Thank you but this doesn't help me. I know what forwarding is.
OK, here is a more complete story :
R1 and R2 have http servers on port 1234 and ssh servers on port 22.
M has only an ssh server on port 22.
The only traffic allowed is between M and the other hosts on port 22.
So, from L, here is what I have to do :
ssh M -L 2222:R1:22 -L 2223:R2:22
Then either :
ssh 127.0.0.1 -p 2222 -L 1234:R1:1234
or :
ssh 127.0.0.1 -p 2222 -L 1234:r2:1234
to have the forwarding I need.
After that, I can launch my http client and point it to 127.0.0.1:1234 to join one of the servers running on port 1234 of R1 and R2, depending on the second ssh forwarding I launched. This server only accepts requests with port 1234 in the request string of the http header.
What I would like to do is to launch the last 2 ssh commands at the same time.
Distribution: debian, gentoo, os x (darwin), ubuntu
Posts: 940
Rep:
so i guess you have tried
after
ssh M -L 2222:R1:22 -L 2223:R2:22
to run
ssh 127.0.0.1 -p 2222 -L 1234:R1:1234
and
ssh 127.0.0.1 -p 2223 -L 1235:R2:1234
connecting to
how about
runnin the above and adding an iptables rule to your pre-routing talbe to redirect traffic from 127.0.0.2:1234 to 127.0.0.1:1235 ?
this way yor browser still 'requests' port 1234 and gets piped down 1235 which would end up at R2 without anybody or any app noticing!!
Yes, of course I tried to launch ssh with local ports 1234 and 1235, and of course, it didn't work... :-)
The iptable solution seems to make sense but it seems to be a really heavy solution. I would really like to make the ssh client open their local sockets on the interface I want. This would be so much easier...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.