6 Easy Steps to Remote Access a Device

How to access home Network From outside?

Network / April 17, 2018

The timeout external to your home network occurs because the IP you specified will be routed elsewhere on external networks.

As others have indicated, you need to configure port forwarding on your router (external interface) to the SSH server. You can either use the standard port (22) or any alternative port (something above 1024). For the webserver you will need to set the port forwarding from port 80 on the external interface to your server and maybe port 443 if you want to include SSL/TLS connections.

I also recommend using the SSH config file (~/.ssh/config) to make it easier when making either an internal or external connection. Add something like this:

Host serverext Hostname 1.2.3.4 User greg Port 22 Host serverint Hostname 192.168.1.10 User greg Port 22

Change the Hostname for the serverext config to the IP address of your Internet connection. If you use a non-standard port for the external SSH connections then change the port field for serverext to match that.

Change the Hostname for the serverint config to the internal IP address for that server on your network.

Once this is configured, in conjunction with the port forwarding you will be able to use "ssh serverint" to connect to your server when you're at home and "ssh serverext" to connect to it when you're somewhere else.

It is possible to include advanced configuration options through the SSH configuration file, such as port tunneling and websocket connections. In the past I've done things like that and redirecting SSH connections through SOCKS proxy servers. I've even had it run through Tor, but it is very slow.

Source: stackoverflow.com