I am trying to see if I can SSH to my iPhone using the 3G network. So, given my IP, I am trying to make contact through SSH, using the defined port (which is no longer 22, I changed it).

It all works fine on my private wifi network. For some reason, it doesn't on 3G...

Any ideas ?


  • 5
    3G services are often on private addressed networks, and use NAT to get out to the internet. What IP is your phone getting on 3G (and I mean the phone itself, not what you see on whatismyip.com)
    – Paul
    Commented May 2, 2012 at 12:30
  • It's possible on remote, normal networks, but I've never tried/heard of being able to access servers that are hosted over cellular data. Commented May 2, 2012 at 23:02
  • If a NAT is used (and it surely is used - I can get only 3 different IP addresses by reconnecting), then how are ports managed? Skype uses port 80, email is used for email ports, and all online games - need a port to function ?
    – Ted
    Commented May 3, 2012 at 12:10

2 Answers 2


a) Unless you have jailbroken your device, iOS doesn't have an SSH server to run.

b) If you have jailbroken your device, it will not be possible to SSH into your iPhone over cellular. You are behind one of the most complex NAT setups there is. When you move between towers, and lose signal, you lose your lease to a unique ID with the cellular network (like an IP). However, every time your connection is re-established with your carrier, you're connected to a new tower and your connection is routed differently through another NAT and finally out somewhere, probably in another state.

In researching this alone, over the course of 10 minutes, my iPhone returned 2 different IPs from the internet, one in Florida, one in Pennsylvania.

Short answer: Wi-Fi = yes | Cellular = no

  • Doesn't DNS solve this? Perhaps there is a way to give your phone a DNS. The IP address could change, per tower for instance, but the DNS to which you connect with SSH would remain the same. I wonder if this is possible.
    – Adriaan
    Commented Feb 13, 2015 at 8:51
  • And as the answer from mspasov indicates, the address might also not change if you have a VPN tunnel running. SSH over VPN perhaps?
    – Adriaan
    Commented Feb 13, 2015 at 8:52
  • It seems that some carriers offer fixed IPs as an extra (expensive) service: matthewcmcmillan.blogspot.co.uk/2013/08/… Commented Aug 14, 2016 at 9:22
  • @Adriaan DNS doesn’t solve it. Even if you set DNS to very quickly change the IP address when your external cellular IP address changes, there are two roadblocks. The cellular network isn’t likely to offer you port forwarding, so connecting in the first place won’t happen. Also, the SSH connection is established by using DNS once to get the IP address and then using that first IP address thereafter; you’d have to set your SSH client to start up tmux, to detect a dead connection very quickly, and then to either start a new connection or exit to a script that restarts the SSH client. Commented Jun 20, 2018 at 0:09

Yes, you can, if you use a VPN service, that assigns you a real, unmasked IP address (which will be accessible from the internet) or a VPN to your local network.

You must log in to answer this question.

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