NextDNS Setup for UDM Pro/SE, Multi-VLAN, Multi Profile
G'morning all,
I wanted to drop a post here as I was recently converted to NextDNS for its features and controls. Being a long time Unifi user & engineer, I wanted to post the setup I used for a Multi-vlan / Multi-profile setup and how to get it working correctly. I will also tell you that when Network upgrades are done on the UDM, they do NOT affect the installation of Next DNS, but if it does, simply re-run the Nextdns setup with the "Remove" option, and re-install. Easy.
Anyways, I am running the UDM SE (Identical to the UDM Pro from a base OS standpoint, so no difference), I run multiple Vlans, and I have multiple profiles setup on NextDNS, one being for the teens, the other for the rest of the house. I want to go through the setup process as there were a number of steps out there, but none of them brought it all together to make it work correctly.
Ok, first thing first. Make sure the UDM has the latest Console/Network updates. (OS setting on local console), once updated, go to nest step.
- You must make a few changes on the UDM to make sure that NextDNS will work correctly with the Unifi OS, so in no particular order
- Navigate to settings, Internet, click on Internet IP top of the screen, and make sure DNS is set to AUTO
- Navigate to Networks, if you have a single network or multiple VLANs, it is the same process. Go into each Vlan, DHCP options, and make sure DNS is set to AUTO
- On the same screen, make sure that "Content Filtering" is "NONE" (Unifi is not noted for its great content filtering anyway.)
- Navigate to "Security" and make sure "AD Blocking" is unchecked and DNS Sheild is "Off" (If you use DNS Sheild, refer to the setup option on the setup tab of NextDNS)
- Follow the install directions for NextDNS listed here: https://github.com/nextdns/nextdns/wiki/UnifiOS
- **If you get any errors stating to shut off the ad blocker or content filtering, you missed something from the above step, go back and review your UDM setup, once you fix on UDM, the setup process will automatically continue**
- When going through the install, you will hit "Y or Yes" for a few initial questions, then you will get the first input prompt "Profile ID:" Put in your profile ID (xxxxxx) OR put in your main profile ID if you have multiple. No worry here, we are going to change this shortly.
- It will then ask you about NextDNS cache to improve latency, answer "N" and move on.
- At this point, you SHOULD be back to the UDM CLI prompt. Now we create the custom config files to make this work.
- Using the CLI, here is the "format" for 2 VLANs, one for kids, and one for everything else, I think you will get the flow here (xxxxxx would be the MAIN profile, yyyyyy would be the VLAN-specific profile)
nextdns start nextdns activate nextdns config set -profile xxxxxx -profile 172.16.100.0/24=yyyyyy -setup-router nextdns config set -auto-activate -report-client-info nextdns restart
- Some notes on the config setup for your knowledge. This step will re-write the config file (/var/run/nextdns.sock) created with the base setup when you installed it.
- I put the first profile config "-profile xxxxxx" first as this will define that profile xxxxxx be applied to every other network NOT defined in the proceeding list. This is a blanket to all the other vlans you might have
- The next CLI section "-profile 172.16.100.0/24=yyyyyy", use CIDR notation to set up every network (Vlan) you have that you want a profile against. You could have one like the above example OR just keep adding another "-profile" after this one to add more.
- Finish the config set command with "-setup-router" to have NextDNS integrate with router firmware
- Next command set "-auto-activate" and "-report-client-info" are the commands needed to make sure that the logs in NextDNS report the correct client names.
- Restart the NextDNS service.
- At this point, NextDNS is running on the UDM, but we need one more step to complete it.
- Go to NextDNS dashboard, go to the "Linked IP" section and down to "Linked IP" and tap on the blue box to the right. That should link your external IP router IP address to the NextDNS service. *Note, if you are running a VPN on the router, this will require advanced configuration not documented here. Also if you are running a VPN on any device (ie. work laptop, etc.) directly, it will circumvent NextDNS and will not provide any services.
- Easy way to test, simply go to your browser and try this for a search & TLD block. (if you have these setup in NextDNS)
- I have a block on the ".ai" TLD domain to block AI chat sites
You should be good to go! You should also see the correct client names BY PROFILE in the logs on the dashboard.
Some notes on the product I found during the setup & use.
- If you have ANY iOS product (iPad, iPhone, etc), use the Apple Configuration Profile Generator on the iOS setup page, add the device name and USE THE QR code (much easier), follow the install on the device. Apple devices are weird with their IP masking and other things they do, and to get it to work successfully, I had to go this route. and It also continues to work OFF the wifi on LTE which is GREAT for kids phones when they are away from home.
- NextDNS is superior to the two previous services I used, OpenDNS and Pihole, much more advanced features, and most importantly to me, the ability to filter TLDs (.ai & .me OR specific sites with those TLDs) as to get rid of AI chats, etc.
- It has a pre-built AD block list (that auto updates), lots of options for parental control as well as Threat intelligence & AI threat detection, does an excellent job blocking domains that are known, new, and unknown via the AI
- Let's be honest, Unifi's Ad blocker, content filtering, etc. is NOT a game changer. They seemed to have put a basic level of effort into those areas, thus why we are here.
- The parental control options are absolutely amazing. Especially the ability to block bypass methods AND most importantly "Recreation time" i.e. Welcome to screen time for ALL devices connected to the service.
- And if you are an inquiring parent, the logs show you EVERYTHING being accessed by device.
- If you are a Unifi user, when you utilize firewall rules to block apps and/or sites, Apple devices, due to how they encapsulate traffic, go right around your block as the traffic going through the router is not "seen" (i.e. blocking youtube on a router, but are able to access through SSL browser). This product will prevent that from happening as it is working at the domain request level.
I hope this helps anyone using the UDM Pro/SE with the NextDNS product.
**One last note, when NextDNS upgrades the product, just go back to the UDM CLI and run
nextdns upgrade
nextdns restart
Have a great day
9 replies
-
Thanks for sharing this...can you expand on:
*Note, if you are running a VPN on the router, this will require advanced configuration not documented here.
I have two policy based routes that utilize ProtonVPN for a "Secure" wifi network that routes out of country, and then another one that is routed locally within my Country and they are tied to two separate VLANs. 10.10.30.0/24 & 10.10.40.0/24 respectively get routed entirely.
I'm also utilizing DNS Shield with DoH from NextDNS currently.I don't want any of their traffic to route through NextDNS anyway as that circumvents the purpose of the VPN use really.
Am I fine to still proceed with setting this up for my children's dedicated VLAN or will these VPN tunnels cause issues?
-
You post was PERFECT timing for me. My AdGuard Home setup bit the dust a couple days ago and made the decision to switch. Thanks so much
-
How I can setup only 1 VLAN (out of 6 I have) to use the NextDNS Profile? Because when I installed CLI in the first step I put my NextDNS Profile ID, which the installer setup (as I assume) as the default Profile for all VLANa. Then I edited the "format" and run like this:
----
nextdns start
nextdns activate
nextdns config set -profile 192.168.104.0/24=8b96cf -setup-router
nextdns config set -auto-activate -report-client-info
nextdns restart
-----
Now all my VLANs run on the NextDNS.
So - how to setup NextDNS only for one of my VLANs (in this case: 192.168.104.0/24)?
-
Does this install create a nextdns.conf file? If so where is that located, is it in /etc/nextdns.conf
Content aside
-
3
Likes
- 5 days agoLast active
- 9Replies
- 138Views
-
7
Following