Re: ssh/port forwarding - listening by multiple clients

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx -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





On Mon, Sep 16, 2013 at 9:19 AM, Kevin Martin <ktmdms@xxxxxxxxx> wrote:
> On 09/16/13 07:55, bruce wrote:
>> hi..
>>
>> Trying to see if ssh/port forwarding can be used to solve a prob.
>>
>> I want to have multiple clients connected to a single master server
>>
>> The masterServer/app is providing data on port X
>>
>> The clientNodes/apps should then listen on port X
>>
>> ssh allows for port forwarding, but I can't figure out how to
>> accomplish this using ssh/port forwarding.
>>
>> I've tried using :
>> ssh   -L 8000:localhost:8000  bob@xxxxxxx -p abc
>>  as foo.com:abc is the vm ip/port that's the server app
>>
>> I then did a test using nc
>>
>> where on the serverside, i did a
>>
>> nc -l 8000, and got an err msg indicating the port was already in use
>>
>> port 8000 is the port the server app sends data on, and is the port
>> I'd like to listen on on the clientnodes/apps..
>>
>> pointers/comments are more than welcome!
>>
>> thanks
>>
> Bruce,
>
> So what I'm getting from this is:
>
> The server has an application listening on port 8000 (so that put's that port in use on the server side)
>
> The clients, via the ssh command, bind port 8000 on their side and any traffic to that port on their side from that machine is
> forwarded to port 8000 on the server foo.com over port "abc" (the port that ssh is using to connect to the remote server).
>
> All of which has me a tad confused.
>
> In a typical client/server setup, your clients will access the server on a given port.  The server won't, necessarily, care what
> port the clients are talking to it from as once the client makes the connection you'll have your 3-way handshake done and a socket
> setup.  IF the server sometimes initiates the contact to the client THEN the client will need to be listening on a particular port.
>  That being said, if you need to forward packets back and forth over ssh, I don't think that the server app and the client app can
> be listening on the same port UNLESS you specifically bind the server port 8000 to a particular interface/address AND the server has
> multiple nics/addresses which can be used (the same holding true for the client).  I THINK this scenario would work if you have it
> available:
>
> Ex: server has addresses 1.2.3.3 and 1.2.3.4
>     Server app runs on port 8000 but ONLY on address 1.2.3.3
>     From the server you "ssh -L 1.2.3.4:8000:localhost:8000 bob@10.1.2.3 -p 2222"
>
>     client has addresses 10.1.2.3 and 10.1.2.4
>     Client app runs on port 8000 but ONLY on address 10.1.2.3
>     From the server you "ssh -L 10.1.2.4:8000:localhost:8000 bob@1.2.3.3 -p 2222"
>
>     When the server needs to talk to the client on port 8000 it would need to talk to it's own address of 1.2.3.4 which would
> forward the traffic over the ssh connection to the remote machine 10.1.2.3:8000.  When the client needs to talk to the server on
> port 8000 it would have to talk to it's own address of 10.1.2.4:8000 which would then forward the traffic over an ssh tunnel to
> 1.2.3.3:8000.  This is all much easier if the client and server don't share a port assignment (assuming that both the server and
> client apps need to INITIATE conversations...if only one side is always the INITIATOR of the conversation, you would still want to
> have the server and client bound to separate ports, if only because there may come a day when you are running the client app on the
> same machine as the server app.
>
> Kevin
> --
> users mailing list
> users@xxxxxxxxxxxxxxxxxxxxxxx
> To unsubscribe or change subscription options:
> https://admin.fedoraproject.org/mailman/listinfo/users
> Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
> Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
> Have a question? Ask away: http://ask.fedoraproject.org
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org




[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux