SSH into LAN from outside through Airport Extreme

remote controlssh

I have an Airport Extreme, and a local network.

I have several computers within this network.

I want to be able to SSH into this local machine within the network, from outside it.

What I have done so far is that I open the Airport Utility program, within there I click the picture of the router and click 'edit'.
There I click 'network' and I suspect that it's 'port settings' that I should enter, so I click that. There I click 'description' and choose 'remote ssh login'. It fills several of the empty fields, I just change the one with the private ip address to the one i want to access. the default ports are 22. If I click ok on this, can I then SSH from outside? And if so, do I just do ssh <user>@<network_ip_address> -p<that port address that was given up in the airport by default>
.. ?

Best Answer

There are three options I am aware of

Port Forwarding

You can set up port forwarding for each device you want to be be able to connect to externally.

  • This assumes you know your external IP address.

For each device you could assign an arbitrary external port that forwards to that device on port 22. (Or you can do this for one device, and then connect to the others through it)

VPN

Were you to make a VPN with your local network, and then connect to said VPN, it would give you access to everything on on the network.

Reverse SSH

With reverse SSH you make use of an external server, and set up a listening ssh session. Then, on the external server you can connect to the device behind the router without being bothered by firewalls/port forwarding/etc... This is what I prefer (as I haven't set up a VPN yet), but I have access to an external server.

You could do this with:
Device on home network ssh -f -N -R 1234:localhost:22 remote_user@remote.server.example

  • Where 1234 is the port that remote would use forward to the device
  • remote.server.example is the remote's address

Then, on the remote server ssh -p 1234 -t device_user@localhost