0

Ubuntu 20.04 connected to the internet through wifi with a static IP address 192.168.1.133

Is there a way to set up something so that I can ssh to it remotely? I do not have access to the router

I set up a reverse tunnel to an http server like this

$ sudo ssh -R 8001:127.0.0.1:3000 -N -f user@remote.host

This works From the remote host, I can connect to the local host with elinks.

SUCCESS

ssh --R 2022:127.0.0.1:2222 -N -f ubuntu@django.vietfeir.com -i .ssh/djangoserver

From the remote machine:

ssh -p 2022 d0325mgray@localhost

Successfully connects me to my local machine.

9
  • 1
    You'll probably really need that access to the router for port forwarding... I'm not aware of any other easy way to get WAN traffic through to a specific LAN device.
    – MiG
    Jan 7 at 22:47
  • The router belongs to a hotel. I know how to set up port forwarding on a router. Jan 8 at 0:45
  • Why is it relevant if I cannot access the router? Jan 8 at 6:34
  • First of all, drop the sudo. It is unnecessary and a security risk to run ssh with root privilege for that. Jan 9 at 14:52
  • Then remove the extra space after 5522: in your second command. If it still doesn't work, check whether port 5522 is already in use on remote.host. Jan 9 at 14:58

2 Answers 2

0

192.168.1.133 is a private IP address and not directly reachable from the Internet. You'll need a public IP address and a mechanism to forward ssh connections from there to your Ubuntu system.

The easiest way would be to use the public IP address of your Internet router. But if you don't have access to that router to set up port forwarding there, that avenue is barred.

Another possibility is to set up a gateway server with a public IP address somewhere on the internet and create a connection from your Ubuntu system to that gateway server through which the ssh connection can then be tunneled. Candidates for such a connection are the various VPN technologies such as OpenVPN or Wireguard, but also a ssh connection with the remote port forwarding option (-R).

2
  • See my updated post about port forwarding Jan 8 at 20:11
  • I executed this with the debug option but got nothing more than the error message Jan 9 at 4:37
0

Using this command on the local machine

ssh -R 2022:127.0.0.1:2222 -N -f ubuntu@django.vietfeir.com -i .ssh/djangoserver

successfully set up remote forwarding.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.