Page 1 of 1

VPN on demand and higher battery drain when in motion

Posted: Thu Nov 19, 2020 4:32 pm
by hawkeye217
I've set up a VPN on demand profile through a .mobileconfig on iOS 14.2 (OpenVPN app version 3.2.2) and all is working well. I've had the same setup also work well on previous versions of iOS and on other phones. But I've always had one notable issue that I have not been able to work around.

iOS tends to "phone home" to Apple's servers a lot, especially when I am in motion. I notice that when I'm out cycling, my battery tends to drain more than it should. I've traced this to my VPN on demand profile connecting through cellular data to presumably send location data back to Apple's servers - from my PiHole logs, I see domains like gs-loc.apple.com and some akamai.net servers being contacted every 5 minutes or so.

I don't mind the location data being sent (presumably for things like Find My iPhone), but the extra overhead of connecting to my VPN server through the on-demand profile every time drains the battery more than it should. Looking at the battery details under iOS settings shows OpenVPN as one of the highest culprits after coming back from a longer bike ride.

Has anyone else experienced this before and does anyone have any ideas on how to get around it? I've already set up some of the OnDemandRules in the mobileconfig file to disconnect the VPN when connected to my home's wifi, but I am not sure how to prevent the VPN from even connecting in the first place when trying to resolve those specific Apple domains that continually show up in my Pihole logs.

Any suggestions from anyone would be appreciated! Thanks!

Re: VPN on demand and higher battery drain when in motion

Posted: Thu Nov 19, 2020 8:51 pm
by TinCanTech
hawkeye217 wrote:
Thu Nov 19, 2020 4:32 pm
iOS tends to "phone home" to Apple's servers a lot, especially when I am in motion. I notice that when I'm out cycling, my battery tends to drain more than it should. I've traced this to my VPN on demand profile connecting through cellular data to presumably send location data back to Apple's servers - from my PiHole logs, I see domains like gs-loc.apple.com and some akamai.net servers being contacted every 5 minutes or so.

I don't mind the location data being sent (presumably for things like Find My iPhone), but the extra overhead of connecting to my VPN server through the on-demand profile every time drains the battery more than it should. Looking at the battery details under iOS settings shows OpenVPN as one of the highest culprits after coming back from a longer bike ride.
Where do we start ...

Just out of curiosity, why don't you turn your phone off when you are riding your bike ?

Re: VPN on demand and higher battery drain when in motion

Posted: Thu Nov 19, 2020 10:29 pm
by hawkeye217
TinCanTech wrote:
Thu Nov 19, 2020 8:51 pm

Just out of curiosity, why don't you turn your phone off when you are riding your bike ?
I use a fitness app to record ride data.

Re: VPN on demand and higher battery drain when in motion

Posted: Thu Nov 19, 2020 11:07 pm
by TinCanTech
hawkeye217 wrote:
Thu Nov 19, 2020 10:29 pm
I use a fitness app to record ride data.
I think your phone is doing enough and most likely that is the best you will get out of your battery.

Re: VPN on demand and higher battery drain when in motion

Posted: Thu Nov 19, 2020 11:59 pm
by hawkeye217
TinCanTech wrote:
Thu Nov 19, 2020 11:07 pm
hawkeye217 wrote:
Thu Nov 19, 2020 10:29 pm
I use a fitness app to record ride data.
I think your phone is doing enough and most likely that is the best you will get out of your battery.
Regardless of what my phone is doing, my question remains the same as my OP. Is it possible to configure OpenVPN or VPN on demand to not attempt to connect the VPN at all for certain domains?

Re: VPN on demand and higher battery drain when in motion

Posted: Fri Nov 20, 2020 1:40 am
by TinCanTech
hawkeye217 wrote:
Thu Nov 19, 2020 11:59 pm
Is it possible to configure OpenVPN or VPN on demand to not attempt to connect the VPN at all for certain domains?
No. That would be a function of your device.
hawkeye217 wrote:
Thu Nov 19, 2020 11:59 pm
my question remains the same as my OP
hawkeye217 wrote:
Thu Nov 19, 2020 11:59 pm
VPN on demand and higher battery drain when in motion
You have a mobile wireless device on the move ..

Have you ever marched up a 1 in 4 incline with an open field radio ?

Re: VPN on demand and higher battery drain when in motion

Posted: Fri Nov 20, 2020 4:41 am
by TinCanTech
TinCanTech wrote:
Fri Nov 20, 2020 1:40 am
Have you ever marched up a 1 in 4 incline
Should this be: "an one in four" ?

Re: VPN on demand and higher battery drain when in motion

Posted: Fri Nov 20, 2020 11:30 pm
by 300000
so if Apple didnot phone home when you in motion openvpn use more battery or not? if you think that way you need to find out how normal openvpn do nothing and dont consume battery but when Apple phone home it use a lot? it that you say because of openvpn use more batery?

Re: VPN on demand and higher battery drain when in motion

Posted: Fri May 07, 2021 11:39 am
by arrmo
Sorry to post on this, but not sure how / where else to ask :(. Fighting to get a mobileconfig file working - also with iOS 14. Any chance you can share your working file (with any secret / private information crossed out of course, but left in to see the fields)?

Thanks!!!