named pipe proxy over SSH [closed]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite












I am used to forwarding a remote service port on localhost using ssh like:



ssh -L 2181:localhost:2182 user@server
(forward remote host port 2182 to local port 2181)



now, from the machine I ssh to, I am trying to reach a tcp service and forward the response to my local machine:



local-machine:2181 <-- SSH --> remote-machine:2182 <-- netcat/named pipe --> service:2181



Note: I do not have direct access to the service machine, I only have access to the network through the machine I SSH to.



I was trying to use netcat with a named pipe:



On the remote-machine:



mkfifo fifo
nc -k -l 2182 <fifo | nc service 2181 >fifo


On local machine:
echo message | nc localhost 2181



but that doesn't seem to work.



I also tried, on remote-machine
nc -k -l 2182 0<fifo | nc service 2181 1>fifo



without luck



On the remote machine nc -k -l 2182 outputs the message I send from the local-machine:2181



if I simply pipe this like: nc -k -l 2182 | nc service 2181
I do see the response from the service on the remote-machine. So I'm able to go all the way to the service and back to the remote-machine but it stops there:



local-machine:2181 <-/- SSH --> remote-machine:2182 <-- netcat --> service:2181



so I don't understand why the named pipe won't forward the response through the ssh connection back to my local machine.



echo message | nc localhost 2182 on the remote-machine does NOT output anything back on the local-machine, so it's not making it through SSH for some reason.



Any idea why this is and how to fix it?



Thanks for help.










share|improve this question













closed as unclear what you're asking by Rui F Ribeiro, schily, G-Man, msp9011, thrig Aug 18 at 14:38


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.










  • 3




    I don't understand what you're trying to achieve. Are you tryint to do ssh -L 2181:service:2182 user@server?
    – ysdx
    Oct 6 '15 at 17:58










  • I cannot SSH to service directly, but I can SSH to the remote-machine that has access to the service. This is running in containers and I don't want to have a SSHD server in every container. I have a SSHD container that then is part of the network. I need to SSH to it and then proxy to the other services.
    – MrE
    Oct 6 '15 at 18:20











  • I see... I tried and it works. I always thought the localhost in that -L string was the local machine, not the localhost of the remote machine!
    – MrE
    Oct 6 '15 at 19:00














up vote
3
down vote

favorite












I am used to forwarding a remote service port on localhost using ssh like:



ssh -L 2181:localhost:2182 user@server
(forward remote host port 2182 to local port 2181)



now, from the machine I ssh to, I am trying to reach a tcp service and forward the response to my local machine:



local-machine:2181 <-- SSH --> remote-machine:2182 <-- netcat/named pipe --> service:2181



Note: I do not have direct access to the service machine, I only have access to the network through the machine I SSH to.



I was trying to use netcat with a named pipe:



On the remote-machine:



mkfifo fifo
nc -k -l 2182 <fifo | nc service 2181 >fifo


On local machine:
echo message | nc localhost 2181



but that doesn't seem to work.



I also tried, on remote-machine
nc -k -l 2182 0<fifo | nc service 2181 1>fifo



without luck



On the remote machine nc -k -l 2182 outputs the message I send from the local-machine:2181



if I simply pipe this like: nc -k -l 2182 | nc service 2181
I do see the response from the service on the remote-machine. So I'm able to go all the way to the service and back to the remote-machine but it stops there:



local-machine:2181 <-/- SSH --> remote-machine:2182 <-- netcat --> service:2181



so I don't understand why the named pipe won't forward the response through the ssh connection back to my local machine.



echo message | nc localhost 2182 on the remote-machine does NOT output anything back on the local-machine, so it's not making it through SSH for some reason.



Any idea why this is and how to fix it?



Thanks for help.










share|improve this question













closed as unclear what you're asking by Rui F Ribeiro, schily, G-Man, msp9011, thrig Aug 18 at 14:38


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.










  • 3




    I don't understand what you're trying to achieve. Are you tryint to do ssh -L 2181:service:2182 user@server?
    – ysdx
    Oct 6 '15 at 17:58










  • I cannot SSH to service directly, but I can SSH to the remote-machine that has access to the service. This is running in containers and I don't want to have a SSHD server in every container. I have a SSHD container that then is part of the network. I need to SSH to it and then proxy to the other services.
    – MrE
    Oct 6 '15 at 18:20











  • I see... I tried and it works. I always thought the localhost in that -L string was the local machine, not the localhost of the remote machine!
    – MrE
    Oct 6 '15 at 19:00












up vote
3
down vote

favorite









up vote
3
down vote

favorite











I am used to forwarding a remote service port on localhost using ssh like:



ssh -L 2181:localhost:2182 user@server
(forward remote host port 2182 to local port 2181)



now, from the machine I ssh to, I am trying to reach a tcp service and forward the response to my local machine:



local-machine:2181 <-- SSH --> remote-machine:2182 <-- netcat/named pipe --> service:2181



Note: I do not have direct access to the service machine, I only have access to the network through the machine I SSH to.



I was trying to use netcat with a named pipe:



On the remote-machine:



mkfifo fifo
nc -k -l 2182 <fifo | nc service 2181 >fifo


On local machine:
echo message | nc localhost 2181



but that doesn't seem to work.



I also tried, on remote-machine
nc -k -l 2182 0<fifo | nc service 2181 1>fifo



without luck



On the remote machine nc -k -l 2182 outputs the message I send from the local-machine:2181



if I simply pipe this like: nc -k -l 2182 | nc service 2181
I do see the response from the service on the remote-machine. So I'm able to go all the way to the service and back to the remote-machine but it stops there:



local-machine:2181 <-/- SSH --> remote-machine:2182 <-- netcat --> service:2181



so I don't understand why the named pipe won't forward the response through the ssh connection back to my local machine.



echo message | nc localhost 2182 on the remote-machine does NOT output anything back on the local-machine, so it's not making it through SSH for some reason.



Any idea why this is and how to fix it?



Thanks for help.










share|improve this question













I am used to forwarding a remote service port on localhost using ssh like:



ssh -L 2181:localhost:2182 user@server
(forward remote host port 2182 to local port 2181)



now, from the machine I ssh to, I am trying to reach a tcp service and forward the response to my local machine:



local-machine:2181 <-- SSH --> remote-machine:2182 <-- netcat/named pipe --> service:2181



Note: I do not have direct access to the service machine, I only have access to the network through the machine I SSH to.



I was trying to use netcat with a named pipe:



On the remote-machine:



mkfifo fifo
nc -k -l 2182 <fifo | nc service 2181 >fifo


On local machine:
echo message | nc localhost 2181



but that doesn't seem to work.



I also tried, on remote-machine
nc -k -l 2182 0<fifo | nc service 2181 1>fifo



without luck



On the remote machine nc -k -l 2182 outputs the message I send from the local-machine:2181



if I simply pipe this like: nc -k -l 2182 | nc service 2181
I do see the response from the service on the remote-machine. So I'm able to go all the way to the service and back to the remote-machine but it stops there:



local-machine:2181 <-/- SSH --> remote-machine:2182 <-- netcat --> service:2181



so I don't understand why the named pipe won't forward the response through the ssh connection back to my local machine.



echo message | nc localhost 2182 on the remote-machine does NOT output anything back on the local-machine, so it's not making it through SSH for some reason.



Any idea why this is and how to fix it?



Thanks for help.







ssh ssh-tunneling netcat fifo






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Oct 6 '15 at 17:52









MrE

19618




19618




closed as unclear what you're asking by Rui F Ribeiro, schily, G-Man, msp9011, thrig Aug 18 at 14:38


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






closed as unclear what you're asking by Rui F Ribeiro, schily, G-Man, msp9011, thrig Aug 18 at 14:38


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









  • 3




    I don't understand what you're trying to achieve. Are you tryint to do ssh -L 2181:service:2182 user@server?
    – ysdx
    Oct 6 '15 at 17:58










  • I cannot SSH to service directly, but I can SSH to the remote-machine that has access to the service. This is running in containers and I don't want to have a SSHD server in every container. I have a SSHD container that then is part of the network. I need to SSH to it and then proxy to the other services.
    – MrE
    Oct 6 '15 at 18:20











  • I see... I tried and it works. I always thought the localhost in that -L string was the local machine, not the localhost of the remote machine!
    – MrE
    Oct 6 '15 at 19:00












  • 3




    I don't understand what you're trying to achieve. Are you tryint to do ssh -L 2181:service:2182 user@server?
    – ysdx
    Oct 6 '15 at 17:58










  • I cannot SSH to service directly, but I can SSH to the remote-machine that has access to the service. This is running in containers and I don't want to have a SSHD server in every container. I have a SSHD container that then is part of the network. I need to SSH to it and then proxy to the other services.
    – MrE
    Oct 6 '15 at 18:20











  • I see... I tried and it works. I always thought the localhost in that -L string was the local machine, not the localhost of the remote machine!
    – MrE
    Oct 6 '15 at 19:00







3




3




I don't understand what you're trying to achieve. Are you tryint to do ssh -L 2181:service:2182 user@server?
– ysdx
Oct 6 '15 at 17:58




I don't understand what you're trying to achieve. Are you tryint to do ssh -L 2181:service:2182 user@server?
– ysdx
Oct 6 '15 at 17:58












I cannot SSH to service directly, but I can SSH to the remote-machine that has access to the service. This is running in containers and I don't want to have a SSHD server in every container. I have a SSHD container that then is part of the network. I need to SSH to it and then proxy to the other services.
– MrE
Oct 6 '15 at 18:20





I cannot SSH to service directly, but I can SSH to the remote-machine that has access to the service. This is running in containers and I don't want to have a SSHD server in every container. I have a SSHD container that then is part of the network. I need to SSH to it and then proxy to the other services.
– MrE
Oct 6 '15 at 18:20













I see... I tried and it works. I always thought the localhost in that -L string was the local machine, not the localhost of the remote machine!
– MrE
Oct 6 '15 at 19:00




I see... I tried and it works. I always thought the localhost in that -L string was the local machine, not the localhost of the remote machine!
– MrE
Oct 6 '15 at 19:00










1 Answer
1






active

oldest

votes

















up vote
0
down vote













as pointed by @ysdx



the simple solution is:



ssh -L 2181:service:2182 user@server






share|improve this answer



























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    as pointed by @ysdx



    the simple solution is:



    ssh -L 2181:service:2182 user@server






    share|improve this answer
























      up vote
      0
      down vote













      as pointed by @ysdx



      the simple solution is:



      ssh -L 2181:service:2182 user@server






      share|improve this answer






















        up vote
        0
        down vote










        up vote
        0
        down vote









        as pointed by @ysdx



        the simple solution is:



        ssh -L 2181:service:2182 user@server






        share|improve this answer












        as pointed by @ysdx



        the simple solution is:



        ssh -L 2181:service:2182 user@server







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Aug 16 at 22:51









        MrE

        19618




        19618












            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Displaying single band from multi-band raster using QGIS

            How many registers does an x86_64 CPU actually have?