AirPort Express and ssh

airportNetworksshterminalwifi

So, I've been trying to understand networks a little better and I'm playing around with ssh. I've learned how to set up port forwarding from my AirPort Express directly to my computer, but I am confused on how I am supposed to change the port that is used to accept ssh traffic by the router.

When I set up the port forwarding to my static IP address, I also wanted to change which port the router uses to accept ssh traffic. However, each time I change the public and private TCP ports on the base station and try to connect with ssh by specifying the router port-something like ssh Kyle@123.45.678 -p 1234-I get a connection refused.

Here is my question. How do I change the port that accepts ssh traffic for the AirPort Express router, and if I change that port and the port accepted on my computer, how do I specify the particular port for the router and the particular port accepted by my computer in the ssh command?

Both the AirPort Express and my computer are currently accepting ssh traffic on port 22 (when I have remote login activated, that is). I am trying to change each of these to a different port.

Best Answer

I think you're trying to set up port forwarding, to allow yourself to ssh in from outside, and changing the port to keep it slightly more secure? You don't need to change the port used internally (inside your network) - you just need to change the port used from outside of your network. Then, set up a rule that passes connections on the desired port to the internal. You would for example tell the router that incoming connections on port 1234 should be redirected inside your network to the machine at 10.0.1.123 on port 22. There are some instructions here that might help. (I don't have an AirPort but have set up port forwarding for multiple routers - the basic idea is the same for all)

Asking your computer to accept incoming ssh on another port is more complicated, and (as of El Capitan) apparently requires deactivation of SIP, which is why it may simply be easier to set the AirPort to forward to port 22 by default.