I have opened a reverse SSH tunnel from machine A (Windows) sitting behind a NAT to machine B (Ubuntu) on port 4000. I can access my service running on machine A from machine B at the address localhost:4000. However, I cannot access this same service from machine C on the same subnet as machine B (i.e. at machine_b_ip:4000). I can reach machine B from machine C on other ports without issue (such as 22 or 80), but it seems like machine B does not want to listen on port 4000.

I have checked and saved both "Local ports accept connections from other hosts" and "Remote ports do the same" in the PuTTY settings on machine A.


There seems to be no firewall active:

machine_B:~$ sudo ufw status
Status: inactive

Telenet fails to connect on port 4000

machine_C>telnet machine_b_ip 4000
Connecting To machine_b_ip...Could not open connection to the host, on port 4000: Connect failed
  • 1
    Enable on Ubuntu in sshd_config directive: GatewayPorts on and restart ssh daemon – Alex Aug 5 '18 at 16:50
  • Thanks, this did it. There are many guides out there that cover reverse SSH tunnel, uncluding on SuperUser, and a suprising number do not mention this at all. I guess my question is a duplicate of this. Otherwise, it is resolved. – SkyNT Aug 7 '18 at 0:18

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.