I've implemented a VPN app with Packet Tunnel Provider for iOS.
I did the following test:
- I configured a VPN with an on-demand rule to always connect
- I connected the VPN.
- My server would accept my user one time only, so trying to connect a second time will fail
- I let the iPhone enter sleep mode, to get the tunnel disconnected. When it will wake up and try to reconnect, it won't succeed, but it will keep trying because of the on-demand rules. This will leave the device without a network access.
- After something like 15 min, I sent a mail from my Mac to my user at the iPhone.
- I awake my iPhone
What happened is that the iPhone didn't have network access (the tunnel was down, but everything was routed to it, as expected) and it try to connect to the VPN and fail. But the iPhone stiil recieved the mail somehow, even it didn't have internet connection.
How is it possible? Are emails are excluded from the tunnel?
Almost all the traffic should pass via the tunnel since I included the default route for IPv4
Ah, this make sense. The Enterprise VPN and Personal VPN work in a very similar way in how they are activated. For example, I mentioned that a personal VPN is configured and started. The onDemandRule will attempt to keep the VPN connected using the default route, but the VPN is not started based on network activity. This is very similar to how an Enterprise VPN would work. The difference between the two is that the Enterprise VPN takes precedence on the system over a Personal VPN and only one Enterprise VPN can be running at a time.
Going back to your original question, in a Enterprise VPN configuration the mail app did not trigger the VPN to start. If the VPN was already running then the default route would attempt to route this traffic.
Matt Eaton
DTS Engineering, CoreOS
meaton3 at apple.com