DNS not working when VPN is active on iOS/iPadOS 18.x

Our company has a VPN client that uses the Packet Tunnel Provider network extension and when 18 came out we noticed that we were no longer seeing DNS requests get sent to the VPNs TUN interface. Do a packet trace, once the VPN becomes active we see requests to _dns.resolver.arpa and 12-courier.push.apple.com, which both get resolved as expected. Also our main app that controls the VPN service and does authentication has to resolve a hostname to get to an authentication service and we see those requests just fine as well. However, when we try to resolve by going to a webpage in Safari we see no DNS request corresponding to that.

What are we missing? At first I thought it was the RFC9461 stuff but from the packet traces I don't believe that is the case.

I have also tried other networking tools to send the DNS requests and that failed as well.

Answered by scottbonar in 819372022

After inspecting the PTP (that I have unfortunately inherited due to a company workforce reduction) I believe I found the issue. It was returning from the startTunnel function before completely setting up the interfaces so we were telling the OS that the VPN was connected when it really wasn't. I suspect we have been getting lucky with all the releases up to now. Once I rewrote the code everything worked.

It's almost as if the system "believes" that network is not working.

I have also gone back and tested the same VPN/PTP client on iOS/iPadOS 18.0 and it works correctly. So there is obviously something I am missing either in the configuration of the PTP that > 18.0 does not like and is therefore shutting down the network.

Another issue I have noticed and I don't know if it's related but on devices that have 18.0.1 or bigger, my VPN app no longer shows up in the Notifications Settings.

Accepted Answer

After inspecting the PTP (that I have unfortunately inherited due to a company workforce reduction) I believe I found the issue. It was returning from the startTunnel function before completely setting up the interfaces so we were telling the OS that the VPN was connected when it really wasn't. I suspect we have been getting lucky with all the releases up to now. Once I rewrote the code everything worked.

DNS not working when VPN is active on iOS/iPadOS 18.x
 
 
Q