2

I installed on my Ubuntu 16.04 the openssh-server and wanted to access my pc remotely through the terminal of other networks, such as the university, for example, but I'm only able to access through ssh when on the same network.

If someone can help me establish this external connection so I can access my pc while on another connection I would be very grateful.

I do not use a router, other than the one provided by Vivo (Router / mode Vivo Fibra).

enter image description here

NOTE: I do not intend to use putty, Team Viewer or anything, I just want to use the terminal, for me it's more practical.

I do not have fluence on English, sorry for this. Text translated by google.

user68186
  • 37,461

1 Answers1

1

Port forwarding

Settings

  • Rule name: SSH for my computer (you can put any meaningful text)
  • Protocol: TCP (this is the most common protocol used by SSH)
  • External port: 2222 (you can use almost any port, but this is the most common)
  • Internal port: 22 (this is the port used by the SSH service on your computer)
  • External IP: 0.0.0.0 or leave it blank if allowed (the router will allow connections from any IP)
  • Internal IP: your computer's private IP, probably will look like 192.168.1.X.

Note: in order to have a static (always the same) private IP for your computer, you may need to tweak additional settings on the router (search static DHCP allocation or reservation for more information).

Explanation

This configuration will mean that any connection from the outside world to your router's public IP address (which you can see visiting this page) on the port 2222 will be redirected to the port 22 of your computer (private IP address).

To connect via SSH to your computer, you'll need to specify the port, because it isn't the default one (22) but a custom one (2222 in the example). You can run the example below to connect from the outside world:

ssh user@public.ip.address -p 2222

Related

Alternatives

tmate is a command line tool to connect computers behind a firewall using SSH.

0x2b3bfa0
  • 9,110
  • 7
  • 38
  • 55