Is there a way in which I can automate port forwarding on the mac?

I want to forward a computer to port 22, and my purpose of doing is so I can ssh from a remote location, making ssh easier.

If so, can someone give me the code? Let's say the computer that I want to forward to port 22 (and control via my remote computer) has the ip of What would I write as a command?

How can this happen?


  • If you enabled ssh in the network settings and punched a hole in your firewall a Mac usually listens to the ssh port. So there is no need to forward a port in your standard configuration. Please add some information about a 3rd network device (e.g. a router) which may forward a port and modify your question accordingly. BTW defines a network address and not an individual device.
    – klanomath
    Nov 14, 2014 at 14:34

1 Answer 1


I'm pretty sure I understand what you are trying to accomplish, but saying "I want to forward a computer to port 22" does not make any sense. You are trying to forward incoming packets addressed for port 22 from your router to your Mac, is what you mean to say (I am assuming). In any event, port forwarding is done in your router's settings, not your Mac's.

You can look up port forwarding steps for your router at http://setuprouter.com/.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .