Disable NextDNS when connected to VPN or LAN
Hi everyone,
I'm currently deploying NextDNS across a fleet of Windows machines using Microsoft Intune, and I'm trying to achieve a conditional setup based on network context.
Goal:
- When users are in the office (connected via corporate LAN or Wi-Fi), I want them to use the internal company DNS, not NextDNS.
- When users are connected to the company VPN, I also want them to use the internal company DNS, not NextDNS.
- In all other scenarios (e.g., outside the office and not connected to VPN), NextDNS should be active and enforced.
Current deployment:
I'm deploying NextDNS via MSI using the following command:
msiexec /qn /i "NextDNSSetup.msi" PROFILE=<profileId> UI=0 EXCLUDE_SSIDS="Corporate Network"
Problem:
- The
EXCLUDE_SSIDSoption works for Wi-Fi, but:- It doesn't cover wired (LAN) connections
- It doesn't help when users are connected via VPN
- As a result, NextDNS is still active in situations where I need it to be bypassed.
Questions:
- Is there a way to exclude NextDNS based on:
- Network type (LAN vs Wi-Fi)?
- Presence of a VPN connection?
- Specific internal IP ranges or DNS servers?
- Would this require:
- A custom script (e.g., PowerShell) to dynamically enable/disable NextDNS?
- Integration with Windows network location awareness?
- Or is there a built-in feature I'm missing?
- What is the recommended approach for enterprise environments with hybrid connectivity (office + VPN + remote)?
Any guidance or best practices would be greatly appreciated.
Thanks in advance!
1 reply
-
Why you would use NextDNS in corporate environment machines at all blows my mind. You will have to use Windows Network Location Awareness NLA or a shell based script task etc.
how to do it in Intune:
Go to Devices > Configuration profiles > Create profile.
Platform: Windows 10 and later | Profile type: Templates > Custom.
Add an OMA-URI setting:
Name: VPN/Internal DNS Bypass
OMA-URI:
./Device/Vendor/MSFT/Policy/Config/NetworkBoundary/DNSNamesValue:
<internal.domain>;<internal-dns-ip>
Result: Even if NextDNS is active, Windows will intercept queries for
*.corp.comand send them to your internal servers. This is the cleanest method because it doesn't require turning the service on/off.
Content aside
- 18 hrs agoLast active
- 1Replies
- 70Views
-
2
Following
