Could I connect to my iphone using 3g ip?

2020-05-06 17:35发布

问题:

This question is for pure curiosity. Lets say I have lighttpd installed on my phone (or any service for that matter). Pinging the ip from my pc results in timed out connection and its clear the iphones internal firewall is non existent (well I believe no anyways). so for an accepted answer you will need to cover these grounds...

  1. If the provider is blocking this traffic, then how does 1 create apps allowing connections through tcp on a listening port over 3g?

  2. How does apples push service / iMessage work to transfere data to the device? Wouldn't this service itself use a tcp protocol listening on a port?

  3. Again if the provider is blocking this traffic, How do they determine its an iphone and not a wireless dongle (which also uses sim cards and I THINK allows connections externally although im not 100% sure).

Reason i ask is because i thought about a web server for the phone which allows administration aswell as location overviews and status etc. but this would be pointless if there was no way too connect, and the issue about dynamic ip would of been overcome by updating the ip address to an external server.

回答1:

  1. Your provider is very likely giving you an IPv4 address that is behind a many-to-one NAT gateway. So they are not blocking your IP address per se, but you won't be able to reach anything inside the NAT from outside the NAT due to the statefulness of many-to-one NAT. Hopefully this situation will change when IPv6 starts becoming popular for mobile phones. As there is no short supply of those IP addresses, there is no need to NAT.

  2. Like every other push service, it's probably actually a connection that it initiated by the phone toward a well-known server on the Internet. The notification server sends notifications down this connection after the phone opens it.

  3. What makes you think they detect (or care) whether a phone, tablet, tethered device, or 3G dongle is connected at the other end of the PDP context?

UPDATE about APNs

It is very possible that your carrier gives a NATted IP address to your phone and a true public IP address to your 3G dongle because they are connecting to different APNs. The name of the APN that the 3G dongle is using may even be a closely guarded secret in order to thwart users who want to get a public IP address for their phone by reconfiguring their phone touse the APN intended for dongles. That APN would be preconfigured inside the dongle and difficult to extract. This would be done because public IP addresses are in limited supply and the carrier doesn't want to waste them on phones (and there are way more phones out there than there are 3G dongles).

The above paragraph is speculative and carrier-dependent, but it seems likely that some carriers would do that.