1

I set up ssh tunnel from one host (192.168.1.7) like this:

ssh -NL 9111:192.168.0.55:9100 user@some.remote.host

Now I'd like to use the same tunnel from other host (192.168.1.8) in same private network. When I try, connection is refused.

How to accomplish it?

Systems are Ubuntu 14.04 everywhere.

wk.
  • 241
  • 1
  • 2
  • 13

1 Answers1

2

You need to specify a listening IP for the local side. Keep in mind that ANY computer on your network will be able to use the tunnel without any kind of authentication unless you also set up a firewall to only allow one computer to connect to that port (also, check that you don't have a firewall blocking this port).

ssh -NL 192.168.1.7:9111:192.168.0.55:9100 user@some.remote.host

You would then connect to 192.168.1.7:9111 from 192.168.1.8.

You can also enable the GatewayPorts option using

GatewayPorts yes

in your ~/.ssh/config file. This will cause forwards to bind to all interfaces by default, meaning that if you don't want to share a forwarded port with everyone you will have to specify -L 127.0.0.1:port:otherip:port

DerfK
  • 19,313
  • 2
  • 35
  • 51
  • Cause this is solution for remote printing, it does not need authorisation. Anyone from office's local network could print anyway and remote network is just other office. Thank you! – wk. Jul 15 '16 at 15:36