Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I configured SSH access to my Mac in order to use Prompt on my iPad. That way I can use my Mac from anywhere in the world, as long as I can get my home IP address.

Although the SSH connection works fine from a separate external connection (my 3G iPhone, for example), it times out when I try to connect from a separate device on the same home wifi network.

As a result, I spent two whole days trying to debug a connection that actually works fine.

Why does an SSH connection that works fine from a separate external address time out when I try to connect from behind the same router?

Is there a workaround so I can just use a single SSH setting whether I am in my living room or on a different continent?

Note: a useful way to get your home IP address (if it's not fixed) is to log into your Gmail account from afar and look at "Last account activity" on the lower right corner of the screen.

share|improve this question
    
Answering your question requires some more information about how you are actually connecting and your network setup. Are you using a router, did you map the SSH port through NAT, ...? –  Gerry Dec 19 '11 at 10:32
    
I am using a router supplied by my internet provider, and I set up the port forwarding through NAT. I confirmed that the port is open using two different web site services. I cannot ping the computer from my local connection, either. –  Andrew Swift Dec 19 '11 at 10:49
    
And how are you connecting? Are you using the public IP address? –  Gerry Dec 19 '11 at 12:09
    
When I connect by the local IP address (192.168...) it works. When I connect by the public (seen from outside my house) IP address, I can neither ping or SSH. All this is done from a computer connected to my router, sharing the same public IP address. –  Andrew Swift Dec 19 '11 at 12:58
    
Works: ssh Administrator@192.168.1.10. Doesn't work: ssh Administrator@86.168.205.17. All computers are connected to the internet via my wifi router which has the 86.168.205.17 public IP address. I have tried both examples from my Mac (192.168.1.10) and my iPad (192.168.1.20). There is no difference. If I connect with 3G from the iPad, suddenly ssh Administrator@86.168.205.17 works. –  Andrew Swift Dec 19 '11 at 13:20

2 Answers 2

The router does the NAT on the external interface. However when you ssh to your WAN address the router will recognize packets coming in on on the internal interface as being sent to its own address and will just send them to its local port 22. What you want does exist but isn't often supported, it's called "NAT loopback".

See NAT Loopback Routers

share|improve this answer

You might try using the bonjour address.

ssh Administrator@mymac.local

Obviously replace mymac.local with the bonjour address for the Mac in question. This can be found in the Sharing preference.

Of course this will only work on the LAN.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.