I have a desktop computer and a laptop. Both run Debian 9.5. Both have openssh installed.

On my desktop, when I run ip a, I see this as part of the output:

enp0s31f6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
  # Some other stuff

On my laptop, when I run ssh myDesktopUsername@, I get this error after a while: ssh: connect to host port 22: Connection timed out.

My desktop computer is connected to my Motorola router/modem by Ethernet cable. On the port forwarding section of my router/modem page, I have this rule.

enter image description here

My laptop is not on the same network as my desktop machine. Using my laptop, how do I remotely connect to my desktop via SSH?

  • Is the ssh server on running? systemctl status sshd.service... – jasonwryan Oct 26 '18 at 2:26
  • Yes. Output: Active: active (running) – Username Oct 26 '18 at 2:42
  • Connection still times out without port forwarding. – Username Oct 26 '18 at 2:45

The address class used for your desktop is a "private" address which will not be accessible from outside this network. So port forwarding is required if your laptop is outside this network.

To connect to your desktop from outside the network, you need to know the "external" or WAN/internet IP address of your modem as it is the one doing the port forwarding. (It is only forwarding the port, it cannot forward the IP address!)

This address can usually be found by looking at the web page of your modem/router. However, many ISP's would dynamically reassign this IP address periodically, so it may not be a fixed address. In that case the problem is a bit harder to fix! There are also many solutions, but probably too complicated to explain here.

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.