Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Unable to SSH over Internet; local SSH successful

Hi,


I have been trying to setup an SSH server on my machine this past week. Following are the steps I followed:

  1. Configured a static IP address (Using DHCP with manual address) in the Advanced Network Setting in System Preferences
  2. Enabled Remote Login under Sharing for my user
  3. Used port forwarding in my router to forward port 22 requests to the static IP address configured in Step 1.

User uploaded file

I am able to SSH successfully from the local network. However, all attempts to access from the Internet have failed. I have tried disabling the firewall and connecting to my external router IP. Pings are transmitted successfully to the external IP and also a TraceRoute using Network Utility tool ends up finding my router local IP.


Would be grateful if someone could point me in the right direction here.


Thanks!


/F

MacBook Pro with Retina display, OS X Yosemite (10.10.2), null

Posted on Mar 5, 2015 10:24 PM

Reply
6 replies

Mar 6, 2015 6:05 AM in response to fr599

Do you you have LittleSnitch installed?


Do you have an Anti-virus/Anti-Malware product installed?


These products have been known to block SSH connections from a non-local IP address. Just this past month someone else in the forums found that LittleSnitch was cause the exact problem you are describing.


If you do not think you have such a utility, you can try booting into Safe Mode which should NOT load any 3rd party additions and test. If that works, then some 3rd party addition is interfering. If it still does not work, then it is one thing eliminated and we look for others.

Instructions on booting into Safe Mode: <http://support.apple.com/kb/ht1564>


You can look in the Applications -> Utilities -> Console -> system.log logs for ssh connection requests and see if the Mac is logging the local and remote connection requests. Use "ssh" in the Search window in the upper right corner, then select each of the different log files in the left column to see if there are any interesting entries with ssh in them. Hopefully, if you have a utility blocking ssh connections from a non-local IP address, it logs it and you find the problem that way.


Stupid question. When you setup your static IP address, it was in the same subnet as the router? Such as 192.168.1.nnn (assuming your router is 192.168.1.1).


The most common home router IP subnet address ranges are 192.168.0.*, 192.168.1.*, 192.168.2.*, 10.0.0.*, 10.0.1.* although any 192.168.*.*, 10.*.*.*, or 172.16.*.* through 172.31.*.* are valid home LAN IP address ranges.

Mar 6, 2015 7:10 AM in response to fr599

In addition to Bob's excellent suggestions, I'd point out that whatever cable/DSL modem you have your router plugged into may be involved (assuming the modem and router are not the same device). It depends on whether that device is managing the network or acting as a "pass-through" device, and just passing on all traffic to the router to handle. If the modem is managing the network, you'll need to pass port 22 through that.


Also, this may be a stupid question, but just to head off a potential problem... when outside the local network, you are trying to ssh into the IP address of your network as the outside world sees it, and not to the internal IP address, right?

Mar 8, 2015 2:38 PM in response to fr599

Thank you gentlemen for your quick responses.


As @BobHarris suggested, I booted into Safe Mode and test the SSH connection but I had no luck. The console logs do show activity when connecting from the local network but it is absolutely silent when I attempt to connect from an outside network. This leads me to believe that the requests are not coming through at all.


The static IP is a subnet of the router IP, though it is not one of the valid LAN ones that BobHarris suggested. I hope this isn't a problem as I had changed it for security reasons. But, yes, the static IP is a subnet address of the router IP. To address Thomas' question, yes, I am trying to access it using the IP address of the network- the ISP provided IP address as seen by outside networks. The internal IP works as like a charm and I am able to SSH into my laptop from another system connected to the same network.


Thomas, I am beginning to wonder if the modem is the culprit here as you suggested because of my earlier observations in the Console logs. I do not see any activity when trying to SSH from another network over the Internet and therefore believe the router or modem is not letting that connection through. Could you suggest any way I could check whether the modem is managing the network? Its one of those modems given to me by my ISP (Comcast 😠).


On running a port scan using the Network Utility app, I found that port 22 was detected only when I gave the static IP of my machine and NOT with the router (network) IP. Is it supposed to be so? I was under the assumption that since I have configured port forwarding on my router, port 22 should be detected on scanning with the router's IP.


Any advice would be much helpful. Thanks again gents! Cheers!


/F

Mar 8, 2015 4:15 PM in response to fr599

fr599 wrote:


Could you suggest any way I could check whether the modem is managing the network? Its one of those modems given to me by my ISP (Comcast 😠).


Most likely, that modem is managing the network, but I'm not an expert in this area. I once knew how to do this with a specific configuration, which involved a modem that was just a dumb pass-through device. It was more dumb luck on my part than anything, and at the time, if the modem had been an issue, I would likely have been stymied completely.


It sounds like you don't have an Apple router, so I can't give you specific instructions other than to say to check and see if your router is in bridged mode. If it is, the modem is managing the network and the router is just following instructions, in a manner of speaking. But how to check that, I don't know... it will vary depending on your router.

Mar 8, 2015 4:23 PM in response to fr599

On running a port scan using the Network Utility app, I found that port 22 was detected only when I gave the static IP of my machine and NOT with the router (network) IP. Is it supposed to be so? I was under the assumption that since I have configured port forwarding on my router, port 22 should be detected on scanning with the router's IP.


This is my Network Utility port scan of my public IP address:

Port Scan has started…

Port Scanning host: nn.nn.nn.nn

Open TCP Port: 22

Port Scan has completed…

So yes, you should see something if your Port 22 is open.


Is your Comcast device a modem, or a modem/router/WiFi device?

If it is a simple modem, then it should not care (until this afternoon, I had a basic Comcast modem (with VoIP phone support) that feed into my Airport Extreme WiFi router), and that basic modem did not interfere with port forwarding. Since my Airport Extreme is my router, that is where my Port Forwarding is setup.


If you have a modem/router/WiFi device from Comcast, then that is the place Port Forwarding needs to be setup up _AND_ you cannot have any other active router in your home. That means if you have a 2nd WiFi router in your home, you need to make sure that device is in bridge mode.


I said that until this afternoon, I had a simple Comcast router. This afternoon, I swapped out the basic modem for the Comcast modem/router/WiFi/VoIP device. HOWEVER, as soon as it was activated, I called Comcast and asked them to put the devcie into "Bridge" mode. It took a few tries, as initially the WiFi radio did not shut off. But eventually the got is configured in Bridge mode and the WiFi radio turned off. So it is again a simple modem with VoIP support. _AND_ it still allows my Airport Extreme to port forward my ssh port (I did verify that I should ssh via my public IP address back into my in house system).


I think you need to focus on your router. You may want to see if <http://portforward.com/> has guidance for your specific router.

Mar 9, 2015 9:08 PM in response to fr599

Gentlemen, thank you for taking the time to help me with this. I've finally fixed it!


The culprit was the Comcast "modem" which was overstepping its boundary and acting as a router. I did not know that the "modem" was broadcasting a private WiFi network! After disabling the private network, setting the modem to bridged mode, a few power cycles on my N900 and the modem, the problem was resolved. The port is now visible from a port scan of my public IP.


Thanks again!

Unable to SSH over Internet; local SSH successful

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.