Mobile APN configurations for cheaper data abroad: A case-study

Maxime Leblanc
poka-techblog
Published in
5 min readOct 15, 2018

--

During my last stay in Italy, I had the chance to learn quite a bit about mobile APN configurations, and how diverging from the provided default configuration can make the traveler save a little bit of money to buy a couple extra drinks instead of giving it to the local telecommunications company. In this story, I would like to share my findings, and therefore save you the cost-ineffective trial-and-errors I had to do to find this trick. 💸 Note that it is most-likely only relevant to travelers, as residents can usually get much better deals than short-term pre-paid customers.

The phone I used for testing

My test environment

  • An unlocked Huawei Nexus 6P
  • Android 8.1.0 (Oreo)
  • A pre-paid SIM card

Also note that I am only interested in data, without any phone minutes or text messages included. In my case, I did not have to root my phone, but some more complex configurations might require you to do so.

Pricing

In my case, the telecom company was Vodafone (for no particular reason). There are two pricing models when it comes to pre-paid data plans with them (both plans are usable at the same time):

  • The normal mobile data plan, which is quite pricey: 5€ per day, for 5GB per day.
  • The tablet & computer data plan, which gives you 32GB of data for 13€, usable for 2 month. Much better.

But the problem is that when using a smartphone, the account “drains” itself using the normal plan, and not the much more interesting tablet & computer plan. But, when tethering the connection and connecting with my laptop instead, it drains from the other, better plan.

How does it differentiate? And more importantly, how can I configure the phone to use only the cheaper plan, even for its own data? In order to understand this, we will have to explore a little bit what is an APN and why it is useful.

Vodafone uses different APNs to differentiate between it’s data plans

Access Point Name (APN) configurations

In order to connect to data services, smartphones connect to the Internet using pre-configured Access Point Names, or APNs. With modern phones, the provisioning of this configuration is made automatically via a specially crafted text-message that the telecom company sends upon activation of the SIM card. With most telecom companies I encountered, the only important configurations are the APN hostname, the (optional) proxy configuration and the APN type. You can find this configuration under Settings > Network & Internet > Mobile network > Advanced.

Now, if I check my phone, I can see that it has been automatically provisioned with three APN configurations: one for Mobile Data, another one for Tethering & HotSpot and the last one for MMS. This must be where things happen for deciding which plan gets drained when using data.

In my case the first thing I did was to edit the Mobile plan configuration and put an invalid configuration, (mobiledummy.vodafone.it, in this example) so that the phone stops draining the normal plan, and it worked. So now I have a phone that can tether some Internet to my laptop, but has no Internet itself. “Good”, but not “Great”… In order to fix this, what we need to do is to edit the configuration of the cheaper data APN so that it is used for the phone itself as well as for hotspot tethering.

There are many possible values for APN type, but here are the most commonly seen:

  • supl: This stands for Secure User Plane Location, which can be approximated to GPS location traffic.
  • dun: Stands for Dial-up Networking, which is basically for all the tethering functions of the phone.
  • hipri: This is High Priority Mobile Data, but frankly I am not sure what this really refers to 🤔
  • mms: Self-explanatory, this is used for MMS services (text-messages that contain non-plaintext elements, such as pictures or the metadata necessary for group messaging)
  • default: Any traffic that other rules have not caught-up falls back in this category.
A working configuration for my phone

You could think of this as a form of primitive IPTables, which has service types instead of ports… Or not.. Anyways… So in my case, all I had to do to make my phone use the cheap APN instead of the expensive one was to configure this APN as of type default,hipri,supl (note that on my Android, it has to be a comma-separated list, without any caps or spaces). This is because the default configuration catches all the traffic not matching any other rule, even in the other APN configurations. I think it also need the geolocation data (supl) to know if you are supposed to be roaming or not, and the hipri configuration to send special instructions to the phone. Other configurations should work as well, in fact I don’t really see a reason you could not just put * (it is an accepted wildcard) as long as your other APN configurations are disabled or invalid.

Limitations

There is also an unexplained limitation: For a reason I was not able to find yet, the clients connecting to my phone’s HotSpot are having trouble with the DNS provided by the phone’s DHCP (itself). In order for the tethering to work, clients must have a static DNS server configured for this WiFi. For this purpose, I suggest CloudFlare's1.1.1.1, which is fast and presumably more privacy-oriented than Google’s 8.8.8.8.

In theory, Vodafone says that their tablet & computer plan does not include VoIP and P2P traffic, but as far as I have tested, they do work fine. But if you were to be in a situation where a protocol block is effective, there is no reason why a simple VPN connection could not circumvent this restriction.

And that’s it, I hope this can help some nomad folks out-there ;-)

--

--