Streamline your network management with our comprehensive DNS configuration guide for Windows. Learn best practices, improve security, and boost network efficiency with easy-to-follow steps.
Learn About PricingWe offer a Windows app that can streamline the configuration of the service. It does not have a deployable MSI file for mass deployments, it must be configured on each device separately.
A more detail guide on how to configure the Windows app is found here: Setup DNS Filtering on Windows with CleanBrowsing.
The Windows app is not required to configure CleanBrowsing on a Windows device. DNS can be configured mannually via the Network Adapter Settings (IPv4 and IPv6). If configuring manually, we recommend configuring both Ethernet and Wi-Fi interfaces by default, and either a) disabling IPv6 or b) configuring both IPv4 and IPv6 on the device.
Find a detailed guide on how to configure manually here. Configuring IPv4 does requre you to push your public IP to our system so that we know what traffic to filter.
If you configure the interfaces directly we recommend using Group Policy to restrict access so that your users cannot make local changes.
When using IPv4 on your network you need to keep CleanBrowsing aware of the networks public IP. This can be done by querying
the Dynamic Device URL issued in the CleanBrowsing dashboard. It looks like this: https://my.cleanbrowsing.org/dynip/[unique ID].
We advise automating the process of keeping the Dynamic Device URL updated.
This will create a script to automatically find the networks public IP using the CleanBrowsing Dynamic Device URL.
# Log file path<
$logFilePath = "C:\Scripts\Logs\DynamicDNS.txt"
# Function to write log messages
function Write-Log {
param(
[string]$Message
)
$Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
$LogMessage = "$Timestamp - $Message"
$LogMessage | Out-File -FilePath $logFilePath -Append
}
# Write log message indicating script start
Write-Log "Script started."
try {
# Invoke web request to retrieve dynamic IP address
$response = Invoke-WebRequest -Uri "https://my.cleanbrowsing.org/dynip/abc123" -UseBasicParsing
$ipAddress = $response.Content
# Log the retrieved IP address
Write-Log "Retrieved IP address: $ipAddress"
# Add your additional logic here if needed
Write-Log "Script completed successfully."
}
catch {<
# Write exception details to log if an error occurs
Write-Log "Error occurred: $_"
}
This will create a scheduler on your machine to initiate the sript in Part 1.
Encrypted DNS, such as DNS over HTTPS (DoH) or DNS over TLS (DoT), enhances user privacy by encrypting DNS queries, making it difficult for external parties to monitor
web activity. However, this same encryption can pose a threat to networks by bypassing traditional DNS filtering and monitoring tools that organizations use to enforce
security policies.
When DNS traffic is encrypted, network administrators lose visibility and control over domain resolutions, potentially allowing malicious sites or content
to slip through, increasing the risk of threats like malware, phishing, or unauthorized access.
To help address this you can follow the instructions below to block DOH and DOT on your devices.
You can use a scheduled task in Windows to run a PowerShell script that dynamically adds block rules to the firewall based on a public IP blocklist
# Define URLs to fetch IP addresses from
$ipv4Url = "https://raw.githubusercontent.com/dibdot/DoH-IP-blocklists/master/doh-ipv4.txt"
$ipv6Url = "https://raw.githubusercontent.com/dibdot/DoH-IP-blocklists/master/doh-ipv6.txt"
$logFile = "C:\Scripts\Logs\BlockDOH.txt"
# Define IP addresses to exclude from blocking so that you can still use CleanBrowsing
$excludeIPs = @('185.228.168.10')
# Function to fetch and parse IP addresses from URLs
function Get-IPsFromUrl {
param (
[string]$Url
)
$content = Invoke-WebRequest -Uri $Url -UseBasicParsing
$ips = $content.Content -split "`n" | ForEach-Object {
if ($_ -match '^\s*([0-9a-f:.]+)') { $matches[1] }
}
return $ips
}
# Fetch IP addresses
$ipv4Addresses = Get-IPsFromUrl -Url $ipv4Url
$ipv6Addresses = Get-IPsFromUrl -Url $ipv6Url
# Combine IPv4 and IPv6 addresses
$allIPs = $ipv4Addresses + $ipv6Addresses
# Ensure the log file directory exists
$dir = Split-Path -Path $logFile
if (-not (Test-Path -Path $dir)) {
New-Item -ItemType Directory -Path $dir | Out-Null
}
# Get existing firewall rules
$existingRules = Get-NetFirewallRule | Where-Object { $_.DisplayName -like "BlockDoH*" } | Select-Object -ExpandProperty DisplayName
# Add firewall rules for new IP addresses, excluding specified IPs
foreach ($ip in $allIPs) {
if ($ip -in $excludeIPs) {
"Skipping excluded IP $ip" | Out-File -FilePath $logFile -Append
continue
}
$ruleName = "BlockDoH_$ip"
if ($ruleName -notin $existingRules) {
# Adding rule to block the IP
New-NetFirewallRule -DisplayName $ruleName -Direction Outbound -Action Block -RemoteAddress $ip -Protocol Any
"Added firewall rule to block $ip" | Out-File -FilePath $logFile -Append
}
else {
"Rule for $ip already exists." | Out-File -FilePath $logFile -Append
}
}
"Firewall rules update completed." | Out-File -FilePath $logFile -Append
Feel free to manually trigger the script on the first run to get the initial IPs blocked.
Create am outbound rule in the Windows Defender Firewall to block port 853 can effectively prevent applications from using DNS over TLS.
Here’s a basic outline of how to do this:
With CleanBrowsing you can customize the service to allow and block specific domains. This section will show you how to automate this process using the CleanBrowsing ashboard API (Reserved for Pro100 + accounts). Via this feature an administrator can create an automation task that keeps the CleanBrowsing current with evolving network needs without having to log into the dashboard directly.
First, create four text files for users to edit and make sure the Users group has permission to edit the files:
Second, write two PowerShell scripts that processes these files. The reason for two separate files is because one script will be ran immediately, and the other will be ran on a delay. There is an option to immediately remove certain domains from the blocklist. Currently this is configured to allow removal of google.com from the blocklist immediately because the Captcha service is hosted on google.com and breaks a lot of sites when google.com is blocked. There could be other uses for this as well.
# Log file path
$logFilePath = "C:\Scripts\Logs\DNSManagement.txt"
# Function to write log messages
function Write-Log {
param(
[string]$Message
)
$Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
$LogMessage = "$Timestamp - $Message"
$LogMessage | Out-File -FilePath $logFilePath -Append
}
Write-Log "Script for immediate actions started."
try {
# Function to send API requests
function Send-APIRequest {
param (
[string]$Action,
[string]$Domain
)
$apiKey = "***YOUR API KEY HERE***"
$uri = "https://my.cleanbrowsing.org/api?apikey=$apiKey&action=$Action&domain_name=$Domain"
Write-Log "Invoking API request: $Action for domain: $Domain"
$response = Invoke-RestMethod -Uri $uri -Method Get
Write-Log "API response: $($response | ConvertTo-Json -Depth 5)"
}
# Function to process actions based on file contents
function Process-Actions {
param (
[string]$FilePath,
[string]$Action
)
if (Test-Path $FilePath) {
$domains = Get-Content $FilePath
foreach ($domain in $domains) {
Write-Log "Processing action: $Action for domain: $domain"
Send-APIRequest -Action $Action -Domain $domain
}
# Clear file after processing
Clear-Content $FilePath
}
}
# Function to immediately remove specific domains from the blocklist if listed
function Unblock-SpecificDomains {
$blockedDomainsPath = "C:\Scripts\RemoveFromBlocklist.txt"
$permissibleDomains = @("google.com") # Extendable list
if (Test-Path $blockedDomainsPath) {
$domainsToUnblock = Get-Content $blockedDomainsPath
foreach ($domain in $domainsToUnblock) {
if ($domain -in $permissibleDomains) {
Write-Log "Approving immediate blocklist removal for domain: $domain"
Send-APIRequest -Action "blocklist/delete" -Domain $domain
}
}
# Optionally clear file after processing
Clear-Content $blockedDomainsPath
}
}
# Process actions for different files
Process-Actions -FilePath "C:\Scripts\RemoveFromWhitelist.txt" -Action "whitelist/delete"
Process-Actions -FilePath "C:\Scripts\AddToBlocklist.txt" -Action "blocklist/add"
# Check and approve specific domains immediately
Unblock-SpecificDomains
Write-Log "Script for immediate actions completed successfully."
}
catch {
Write-Log "Error occurred: $_"
}
# Log file path
$logFilePath = "C:\Scripts\Logs\DNSManagement.txt"
# Function to write log messages
function Write-Log {
param(
[string]$Message
)
$Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
$LogMessage = "$Timestamp - $Message"
$LogMessage | Out-File -FilePath $logFilePath -Append
}
Write-Log "Script for immediate actions started."
try {
# Function to send API requests
function Send-APIRequest {
param (
[string]$Action,
[string]$Domain
)
$apiKey = "***YOUR API KEY HERE***"
$uri = "https://my.cleanbrowsing.org/api?apikey=$apiKey&action=$Action&domain_name=$Domain"
Write-Log "Invoking API request: $Action for domain: $Domain"
$response = Invoke-RestMethod -Uri $uri -Method Get
Write-Log "API response: $($response | ConvertTo-Json -Depth 5)"
}
# Function to process actions based on file contents
function Process-Actions {
param (
[string]$FilePath,
[string]$Action
)
if (Test-Path $FilePath) {
$domains = Get-Content $FilePath
foreach ($domain in $domains) {
Write-Log "Processing action: $Action for domain: $domain"
Send-APIRequest -Action $Action -Domain $domain
}
# Clear file after processing
Clear-Content $FilePath
}
}
# Process actions for different files
Process-Actions -FilePath "C:\Scripts\AddToWhitelist.txt" -Action "whitelist/add"
Process-Actions -FilePath "C:\Scripts\RemoveFromBlocklist.txt" -Action "blocklist/delete"
Write-Log "Script for immediate actions completed successfully."
}
catch {
Write-Log "Error occurred: $_"
}
Save this scripts to a location accessible by the system (e.g., C:\Scripts\DNSManagementImmediate.ps1 and C:\Scripts\DNSManagementDelayed.ps1 )
Set permissions on the files to deny any standard user accounts Modify and below permissions. This will prevent modification and reading of the API key.
It also prevents on demand execution of the file. Admin accounts are part of the Users group, so don’t use that group to deny permissions.
When HTTPS enabled domains are blocked by a policy, CleanBrowsing presents a block page to you which is also
served over HTTPS. This block page is encrypted with a certificate signed by the CleanBrowsing Root CA. In
order to avoid certificate errors when accessing the block page, you must install the CleanBrowsing Root CA
in your browser, or if you have a network of computers, in your users’ browsers.
To avoid these errors entirely you must deploy the CleanBrowsing certifiate to the local root store on all
devices.
A complete Guide to Installing the CleanBrowsing CA
is available.
The Windows App store allows a device user to easily install applications to the device that might otherwise circumvent
the network controls (e.g., VPN, Proxy applications). To prevent this, we recommend blocking the Windows App Store.
This is availalbe with Windows 10 Enterprise.
1. Open Group Policy Editor:
2. Navigate to the Windows Store Policy:
3. Disable the Store Application:
4. Configure the Setting:
Note: The reason this is needed is because there are many applications that can be installed to the users local
profile without requiring admin permissions. Even though Chrome and Edge are locked down, a user could download an alternate
browser to their local profile very easily.
Additionally, there is a more advanced solution called Windows Defender Application Control, and it is more powerful and secure,
but it is harder to configure. I may consider using it in the future though.
1. Open the Local Security Policy Editor
2. Navigate to AppLocker
3. Configure AppLocker Properties (Optional)
4. Create Default Rules
For each rule type (Executables, Windows Installer Files, Script, and Packaged app Rules), you'll want to create default rules.
For Windows Installer Files:
For Scripts and Packaged Apps:
5. Configure Rule Enforcement
6. Configure the Application Identity Service to Start Automatically
Starting with Windows 10, the Application Identity service is now a protected process. As a result, you can no longer manually set the service
Startup type to Automatic by using the Services snap-in. Try either of these methods instead:
sc.exe config appidsvc start=auto
7. Test Your Configuration
8. Monitor and Adjust Rules
Securing your network requires not just filtering at the DNS level but also hardening browser settings, especially when it comes to Secure DNS (DNS-over-HTTPS).
While this feature aims to enhance privacy by encrypting DNS queries, it can inadvertently bypass your network's filtering controls, allowing users to access
restricted content or malicious websites. This creates a significant security gap, especially in environments that rely on DNS-based content filtering. To mitigate
these risks, it's essential to disable Secure DNS and other related settings in browsers like Microsoft Edge and Google Chrome.
For detailed, step-by-step instructions on hardening these browsers, refer to our dedicated guides for
Edge and
Chrome.
Ensuring that your CleanBrowsing DNS resolvers are correctly configured is crucial for maintaining a secure and filtered network. Testing the confgiuration can be achieved by checking what DNS resolver is being used in the browser or in the command line. We offer a comprehensive guide on how to test & verify the configuration<.
Via the Browser you can verify that your network is routing correctly by using the dnsleaktest.com website.
On this website run the standard test. The output of this test should show CleanBrowsing servers like this:
Via the command prompt you can verify that your network is routing correctly by using the nslookup.
nslookup -q=TXT mylocation.whois.dnscontest.cleanbrowsing.org
Server: 185.228.168.10
Address: 185.228.168.10#53
Non-authoritative answer:
mylocation.whois.dnscontest.cleanbrowsing.org text = "CleanBrowsing: dns-edge-usa-west-la, 185.228.168.10"
This shows you that the network is routing to dns-edge-usa-west-la, 185.228.168.10" and the WAN IP of the network is 185.228.168.10.