0

I want to enable remote access to my machine. I have thus far enabled port forwarding on router. Lets say the static local ip address of the machine is 192.xxx.x.x. We will cal the ip address that is visible if I visit what is my ip as 84.xx.xx.xx. In the router settings it is under WAN IP. Lets say the port is 22.

I have than run

sudo service ssh start

Looking at its status, we see that it is listening.

But here is where I get lost. If I run

ssh [email protected]

I get

ssh: connect to host 84.xx.xx.xx port 22: Connection refused

As I side note, if I try to connect locally,

ssh [email protected]

everything works fine.

Now, I know that I am making a mistake somewhere. Please tell me where, and help me learn.

Edit

Example from here

For example, say you wanted to let a friend access your remote desktop, using the command-line SSH client. You would use port number 5900 (the first VNC port), and destination server localhost

ssh -R 5900:localhost:5900 guest@joes-pc

What is joes-pc here? WHich one of the two IPs i listed? How would the command look like in my case? So that it would connect to the right machine? As there are many machines in the network? I thank you for helping me learn.

1
  • Unfortunately, questions about host/server configurations and protocols above OSI layer-4 are off-topic here. You could try to ask this question on Server Fault for a business network, or on Super User or Ask Ubuntu for a personal network.
    – Ron Maupin
    Jul 15, 2018 at 20:51

1 Answer 1

4

Try ssh [email protected] from a computer on a different network.

It's likely that your router doesn't have "loopback NAT" (or it has it but it's not enabled), which would explain why you can't ssh to your own computer with the router's external address. Ignore it.

See for example Wikipedia article on NAT

5
  • Thank you very much. Could I please ask you to look at my edit? This is my first time doing anything like this. Thank you in advance! The command I appended from the example, how would it be translated in my case? Jul 15, 2018 at 20:44
  • 1
    Don't do anything with tunnels (ssh -R) until basic SSH is working. You need to try ssh [email protected]. from a different network to test it.
    – jonathanjo
    Jul 15, 2018 at 20:45
  • Thank you! So, even though "joes" local IP is 192... the joes ip in the example, is always the router, as that is what is visible to the outside world? And what after I get this working? Could you please parse the command from the example for me? I will accept the answer ether way, as you already answered the original question. Jul 15, 2018 at 20:48
  • As well as connecting through to a shell, most ssh clients and servers will create tunnels. Run ssh -R 9999:localhost:5900 guest@beta on computer alpha and will try to log in on beta in the ordinary ssh way and connect to a shell. It also opens a reverse tunnel: on beta it is listening on port 9999, and if something connects to that, it will be connected to port 5900 on alpha. Forward tunnels also available, equally confusing until you're used to them.
    – jonathanjo
    Jul 15, 2018 at 20:56
  • You helped me a lot. Everything is as you said :) Jul 15, 2018 at 20:58

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