To block a wildcard domain on Windows:
We can use Acrylic DNS Proxy (free and open source). It creates a proxy DNS server on your computer with its own hosts file, which supports wildcards.
1. Download and Install Acrylic DNS Proxy
Download Acrylic DNS Proxy from the official website and install it: https://infra.lecuong.info/acrylic-dns-proxy
2. Edit Network Adapter Settings to Point to Acrylic DNS Proxy (127.0.0.1)
Set the Preferred DNS server to 127.0.0.1
IPv4 or IPv6
By completing this step, your system will route all DNS queries through Acrylic DNS Proxy.
3. Configuring Acrylic DNS Proxy to Block a Wildcard Domain
To block a wildcard domain, such as *.youtube.com, follow these steps:
-
Open Acrylic DNS Proxy.
-
Go to Files → Open Acrylic Hosts (or press Ctrl + F2).
-
Add the following line to the end of the file:
0.0.0.0 >youtube.com -
Restart the Acrylic DNS Proxy service by going to Actions → Restart Acrylic Service.
With this configuration, all traffic to *.youtube.com will be completely blocked.
Bonus: Here is a batch file to Quick remove/set DNS servers for a network card: