0

I have one hop between my local machine and the machine I want to access some remote port. I am trying following thing. But doesn't seem to work.

From remote machine, I want port 9443 to open on my local machine. The port 9443 is already being used by

local_machine --> hop --> remote_machine

  1. Login to hop machine and run following command
 ssh -N gshah03@remote_machine -L 8080:localhost:9443 -4
  1. Now from my local machine. issue following command.
ssh -N gshah03@hop-L 9443:localhost:8080

However, on first step I am getting following error.

debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug1: Connection to port 8080 forwarding to 127.0.0.1 port 9443 requested.
debug1: channel 1: new [direct-tcpip]
channel 1: open failed: connect failed: Connection refused
debug1: channel 1: free: direct-tcpip: listening port 8080 for 127.0.0.1 port 9443, connect from 127.0.0.1 port 33558 to 127.0.0.1 port 8080, nchannels 2
debug1: Connection to port 8080 forwarding to 127.0.0.1 port 9443 requested.
debug1: channel 1: new [direct-tcpip]
channel 1: open failed: connect failed: Connection refused
debug1: channel 1: free: direct-tcpip: listening port 8080 for 127.0.0.1 port 9443, connect from 127.0.0.1 port 33562 to 127.0.0.1 port 8080, nchannels 2

Gaurang Shah
  • 101
  • 1

1 Answers1

0
ssh -N gshah03@remote_machine -L 8080:localhost:9443 -4

In this case, "localhost" IS remote_machine.

If I understand what you want, it should be

ssh -N gshah03@remote_machine -L 8080:local_machine:9443 -4

But that would mean the remote_machine doesn't need the hop to connect to your system.

If you just want 9443 on local machine to connect to 9443 on the remote machine, the following is sufficient:

ssh -N gshah03@hop-L 9443:remote_machine:9443
Gerard H. Pille
  • 2,569
  • 1
  • 13
  • 11