Shanky
Shanky

Reputation: 139

ssh portforwarding unix

I am trying to use local port forwarding to access remote host over a firewall and am able to do so using the command below.

ssh -L 23456:remotehost:10000 localhost

>telnet localhost 23456
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.


>telnet 170.19.120.207 23456
Trying 170.19.120.207...
telnet: connect to address 170.19.120.207: Connection refused
telnet: Unable to connect to remote host: Connection refused

Looks like portforwarding is happening on loopback and anything with the hostname is getting rejected. Can someone help me to get around this, as I am sure there is/should be a way

Upvotes: 1

Views: 875

Answers (1)

sehe
sehe

Reputation: 392833

Seems it is working correctly 'telnet localhost 23456' works!

telnet 170.19.120.207 23456 shouldn't work, unless 170.19.120.207 points to your host. If you want that you need to enable gateway functionality:

ssh -g -L 23456:remotehost:10000 localhost

Upvotes: 3

Related Questions