2

I want to give my iPhone (iOS7) a hostname, which will automatically resolve from anywhere as long as the phone is online. My iPhone can be jailbroken as part of the solution; that's not preventative. I'd prefer that the hostname be dynamically updated, but if not, I can script the polling/constant update. The goal is to not have to manually figure out/enter IP or routing information in order to remotely connect to my phone, regardless of whether the phone is connected via wifi or cellular data.

What I've looked into:

  1. I've seen a few links as to how to automatically have it update DynDNS or similar with its local IP address, but that's not terribly useful, since I'd like to be able to access it remotely (not on the same LAN). There are sites which I could scrape that give me my external IP, but a lot of people seem to be of the opinion that cellular providers do NAT or similar IP consolodation, so that would invalidate the resolution of the hostname when the phone wasn't on wifi.

  2. I could also run an always-on VPN from the phone, and have it either connect or proxy through a computer I control, one with an external IP, and have that computer NAT requests for the hostname to the iPhone. I know how to set up a VPN, but I don't know enough about how VPNs work over cellular data with an iPhone to set that up; if anyone knows more about this solution, please mention it in an answer.

  3. I could also run a constant SSH reverse proxy or something like that (which sets up an always-open socket, push notification style, by initiating on the phone and keeping it open with the remote peer), and resolve the hostname on the peer and then somehow relay requests to the phone. Like the VPN idea, I know about this in theory, but don't really know where to start looking for info on how to configure it.

Question:

How do I give my (optionally jailbroken) iPhone an externally resolvable, preferably dynamically updated hostname on both wifi and cellular data?

  • would the other way around work also ? e.g. calling a host from the iPhone side ? I wrote a dyndns script some while ago to do the same thing. So you could tell your iphone to call a side (curl) every x minutes and the side (server) can tell you the exact information about your iphone. Might work, might not. I never tried it with an iPhone :D – rwenz3l May 2 '14 at 12:41
  • Sure, but that assumes that the external IP is not NATed. For example, there could be a thousand iPhones behind one Verizon external IP, so sending requests to that IP would accomplish nothing at all. If I go that route, I need to know that the service provider is actually giving devices unique IPs. That seems doubtful, given the already-severe shortage of IPv4 addresses. – Zac B May 2 '14 at 13:43
  • 1
    Actually, SSH'ing into my cellular IP iPhone works fine. I'm not sure where you can get that value without jailbreaking. Edit: Actually, of course you can log the IP on a web server or similar. – Tatsh May 2 '14 at 13:45
  • Interesting. I'll test that with my provider. If it works, I'll let you know, and you can post it as an answer. Thanks! – Zac B May 2 '14 at 13:49
  • Regardless, if I were going to set this up, I would set my router to set a static IP to my iPhone based on the MAC address. I can use my external IP to get to the router (which can have a domain set up + DynDNS or similar because it's not a static IP). You may want to have a main system with services running that can route based on IP. This is very easy for web servers (just use nginx and proxy_pass, etc). For SSH and others, I'm not sure of an easy solution. You can also just set the iPhone SSH to another port and forward that port directly if you don't mind typing -p PORT every time. – Tatsh May 2 '14 at 13:56

You must log in to answer this question.

Browse other questions tagged .