Utilizing Ad Blocking On Your Network
Published onby Iron
Imagine a browsing experience where pesky ads vanish before they reach your screen. With UniFi, it’s possible to set up ad blocking directly on your network using the UniFi Gateway. Ad blocking on a network level cuts out ads for every device connected to your Wi-Fi, making it cleaner, faster, and more secure. Here’s everything you need to know to get started.
Let's dive in!

Table of Contents
- What is ad blocking on UniFi?
- Setting up ad blocking on your UniFi Gateway
- Fine-Tuning Your Ad Blocker
- Monitoring and Testing Your Ad Blocking
- Advantages of Network-Level Ad Blocking
- Troubleshooting Common Issues
- Final Thoughts
What is ad blocking on UniFi?
Ad blocking at the gateway level removes ads from websites across all devices connected to your network. Unlike browser-based ad blockers, which need to be installed on each device separately, a gateway-level solution keeps ads out without any additional setup on the end devices. With UniFi, this is done by configuring DNS filtering on the gateway.
DNS filtering works by redirecting ad-related DNS requests to a “blackhole,” stopping them from loading on your device. Here’s how you can set it up to enjoy an ad-free experience across your network.
Setting up ad blocking on your UniFi Gateway
Let’s walk through the setup process. To get started, you’ll need access to your UniFi console, where you’ll configure DNS filtering.
Step 1: Access the UniFi Network Controller
To begin, log into your UniFi Network Controller, either through your UniFi app or via the web. This is the central dashboard for managing your UniFi devices, including the UniFi Gateway.
- Open your web browser and navigate to the UniFi controller’s IP address (often "https://192.168.1.1").
- Log in with your credentials.
- If you’re managing remotely, make sure you’re logged into the UniFi Cloud to access your network settings.
Step 2: Go to DNS Settings
With your console open, head to the Settings section on the sidebar.
- Click on Settings > Internet > DNS Filtering.
- This is where you’ll configure your ad-blocking settings.
DNS Filtering on the UniFi Gateway blocks unwanted traffic by targeting the DNS requests of known ad domains. By choosing a custom DNS filter or opting for a DNS provider with built-in ad blocking, you can prevent ads at the network level.
Step 3: Choose Your Ad-Blocking Method
There are two main ways to implement ad blocking on UniFi:
-
Custom DNS Filter: You can use a custom DNS filter service, such as Pi-hole or a third-party DNS like AdGuard.
-
DNS Provider with Ad Blocking: Some DNS providers, like Cloudflare or OpenDNS, offer ad-blocking services built into their DNS configurations.
Let’s explore each approach in detail.
Option A: Using Pi-hole for Ad Blocking
Pi-hole is a free, open-source DNS-level ad blocker that runs on a local server or Raspberry Pi. It’s effective at blocking ads across your entire network.
To use Pi-hole with UniFi:
-
Set up Pi-hole: Install Pi-hole on a server within your network.
-
Configure DNS: In the UniFi Network Controller, set Pi-hole’s IP address as the primary DNS server.
-
Apply DNS Filtering: In your UniFi settings, ensure Pi-hole is set as the primary DNS to enforce network-wide ad blocking.
Pi-hole also allows fine-tuning, so you can manually add or remove specific domains from the block list.
Option B: Using Third-Party DNS Services
Third-party DNS services, like AdGuard DNS, Cloudflare DNS (with ad blocking), and Quad9, offer robust ad-blocking features.
To use a third-party DNS with UniFi:
-
Choose Your DNS Service: Select a DNS provider known for ad-blocking, like AdGuard.
-
Set DNS in UniFi: Go to Settings > Internet > DNS Filtering and input the DNS server addresses for your chosen provider.
-
Enable Filtering: Apply these settings, and UniFi will route all DNS requests through this ad-blocking DNS server.
AdGuard DNS, for instance, is an easy option if you’re looking for something without additional hardware or maintenance. Simply input the AdGuard DNS addresses ("94.140.14.14" for primary and "94.140.15.15" for secondary) to activate.
Fine-Tuning Your Ad Blocker
Blocking ads with DNS filtering is straightforward, but some sites might slip through. Here are a few tips for improving your ad-blocking performance:
- Customize Block Lists: Many DNS services and Pi-hole allow you to add custom block lists for more comprehensive ad blocking. Consider adding known ad-serving domains.
- Whitelist: Occasionally, essential content is blocked. Whitelist certain sites in your DNS settings if legitimate content is accidentally blocked.
- Regular Updates: DNS filters need regular updates to keep up with new ad servers. Update your Pi-hole or DNS list regularly.
For families, it’s easy to add parental control filters alongside ad blocking to provide a safer online experience.
Monitoring and Testing Your Ad Blocking
Once your ad-blocking setup is complete, test it to ensure everything works as expected.
-
Check DNS Resolution: Use a website like "dnsleaktest.com" to confirm that your DNS is routing through Pi-hole or the selected third-party service.
-
Monitor Traffic: Use the UniFi dashboard’s traffic statistics to ensure the ads are being filtered out.
-
Use Test Sites: Sites like "ads-blocker.com" can verify if ads are blocked across devices connected to your network.
You’ll see an immediate drop in unwanted traffic and potentially faster load times since ads are no longer consuming your bandwidth.
Advantages of Network-Level Ad Blocking
Network-wide ad blocking isn’t just about convenience; it brings a few technical benefits to your overall network setup:
-
Performance Boost: No ads means faster page loads.
-
Privacy Protection: Ad servers track users across sites. DNS filtering halts this tracking at the network level.
-
Reduced Bandwidth: With ads blocked, you’ll use less data, saving bandwidth for the stuff you actually care about.
-
Device Compatibility: Network-level blocking works on all connected devices without any extra setup.
These benefits make ad blocking at the gateway a must for anyone who values a cleaner browsing experience, privacy, or both.
Troubleshooting Common Issues
Encountering issues while setting up ad blocking? Here’s a quick guide to troubleshooting:
-
Check DNS Settings: Ensure your DNS settings point to the correct ad-blocking DNS. Small typos can lead to unexpected results.
-
Reboot Gateway: After changes, restart your UniFi Gateway to clear old DNS cache.
-
Device Not Blocking Ads?: Sometimes devices need to refresh their DNS cache. Reconnect devices to your Wi-Fi or reboot them.
-
Whitelist Over-blocked Sites: If certain sites aren’t loading correctly, add them to your whitelist.
For additional support, UniFi forums and online guides are a great resource.
Final Thoughts
Using a UniFi Gateway for ad blocking offers a seamless experience, cutting ads out of the network for everyone. Whether you’re using Pi-hole or a third-party DNS like AdGuard, the setup is simple and effective. With UniFi controller, managing your ad blocking is as easy as tweaking a few settings and letting the gateway do the rest.
And remember, if you’re looking for a reliable, scalable UniFi hosting solution, consider UniHosted. We handle UniFi controller management so you can enjoy uninterrupted, ad-free browsing across all your devices. Give us a try if you’re ready for a smoother, simpler network experience!If you would like me to personally walk you through UniHosted, you can schedule a call with me here.
We host UniFi Controllers in the Cloud
Are you ready to take your UniFi Network to the next level? Deploy a UniFi Cloud Controller in minutes and manage your network from anywhere.
Free tier available
Get the best support
Join 1660+ customers
No credit card required