ssh/port forwarding - listening by multiple clients

Kevin Martin ktmdms at gmail.com
Mon Sep 16 20:01:07 UTC 2013


On 09/16/13 13:15, bruce wrote:
> hey kevin, et al
> 
> here's my test:
> 
> masterServer   [vm running on foo.com:50122]
>  |
>  +---  clientServerA   localhost/7100
>  |
>  +---  clientServerB   localhost/7100
> 
> 
> on the clients, I run
>  ssh -N -f  -L  7100:127.0.0.1:7100  user at foo.com -p 50122
>  which establishes the connection to the maser server on the clients
> 
> now, as a test, I fire up nc on all servers
> 
> so for masterServer, I have
>   nc -l 7100
> 
> and on the clients, I have
>   nc localhost 7100
> 
> and on the masterServer.. I then type "foofoo"
> 
> and I get the same "foofoo" on only one of the clients.. I'm trying to
> figure out a way to get content to "both" clients, not at the same
> time.. but I'd like to be able to verify that both clients are
> actually able to access data from port 7100..
> 
> my reall goal, is to have a gearman server running on the masterside,
> with gearman clients running on thew clientservers... and having the
> gearman clients talking to the master gearman posrt via the ssh
> connection...
> 
> thanks
> 
> 
<snip>

Bruce,

This is what I've tested:

I setup a web server on the server side and then on the client side do "ssh -N -f -L 7100:127.0.0.1:80 remoteserver" and then from a
web browser on my client type in the url "http://127.0.0.1:7100".  If I get the webserver response, I'm working.  If I don't, I'm not.

If you don't want to do that, on the server do your nc -l 7100 and the ssh -L 7100:127.0.0.1:7100 remoteserver on your client(s) and
then make web requests on your clients to http://127.0.0.1:7100 and what you should see on your server (depending on the browser you
use) is something like:

Connection from 127.0.0.1 port 7100 [tcp/xfs] accepted
GET / HTTP/1.1
Host: 127.0.0.1:7100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:23.0) Gecko/20100101 Firefox/23.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
DNT: 1
Cookie: JSESSIONID=0132B021EF3BD94EC9AEAF278970748B
Connection: keep-alive


and it should be *just a little* different from each client since the JSESSIONID should not be the same (thereby proving your
accessing the server from each client over the ssh socket).


And please bottom post; it's much easier to follow a thread when reading top-to-bottom instead of bottom to top.

Kevin




More information about the users mailing list