Is it possible to route specific DNS requests to the local DNS server with custom NEDNSSettingsManager configuration?

I'm researching the capabilities of NEDNSSettingsManager. I've been able to implement custom dns settings to route my phone's DNS requests onto the servers I need. However, I can't find if there's a mechanism to route specific domains to the local DNS provider.

Let's say I'm a business with a local DNS server that resolves my internal resources. I need my corporate iPhones to hit a 3rd-party secure DNS server selected by me. The latter has no idea about domain "my.business.gg".

Using NEDNSSettings.matchDomains has the opposite effect. Maybe NEDNSSettingsManager.onDemandRules is the way to go? If so, how would one use it? If not, is it possible to do what I need to do with DNS settings, or should I look into DNS Proxy instead?

Please help. Thanks

Answered by iandreyeu in 742959022

Figured out what to do using on demand rules described here: https://www.wwdcnotes.com/notes/wwdc20/10047 . It turns out that the rules are evaluated one-by-one, and the .neverConnect means that the matching request is handled by the default DNS provider, not our custom one (which is exactly what I need)

Purchase an MDM solution if you want to manage the settings for corporate devices; what you're asking to do is most likely on an App level and not a device level using the APIs mentioned for apparent privacy and security reasons.

Accepted Answer

Figured out what to do using on demand rules described here: https://www.wwdcnotes.com/notes/wwdc20/10047 . It turns out that the rules are evaluated one-by-one, and the .neverConnect means that the matching request is handled by the default DNS provider, not our custom one (which is exactly what I need)

Could you show an example of your configuration file that achieved this?

Is it possible to route specific DNS requests to the local DNS server with custom NEDNSSettingsManager configuration?
 
 
Q