Total 2648 characters, estimated reading time: 7 minutes.
In this era where browsing the web is like walking through a minefield, not only do you have to worry about DNS pollution, advertisement hijacking and privacy leakage, but you also have to be careful about whether there is any “you-know-what” playing behind the pop-ups on the web.

To view, please open this page in an internet environment with access to YouTube.
A full graphic description is provided below and can be read on.
Thus, a set of rules around OpenClash + mosDNS + AdGuardHome The “ultimate three-piece suit” has become a panacea for more and more people's online lives, and it can even be said that it isTop Armor for the New Generation of DIY Internet WarriorsThe
Overall structure in a nutshell: who governs whom? How does it go?
Sort out your brain first:
- OpenClash: Responsible forscientific Internet accessIt is the traffic police of the entire organization. It is the global traffic police, deciding which traffic “goes over the wall” and which is “digested in place”.
- mosDNS: Responsible for DNS distribution, encryption, and anti-pollution, it's like a magician who pulls out a hat, and you'll never guess where the DNS results came from.
- AdGuardHome: At the forefront, it receives client DNS requests, blocks a wave of advertised domains, and then passes them on to mosDNS for further processing.
In short, DNS queries go as follows:
Client --> AdGuardHome --> mosDNS --> OpenClash (forwarding or direct connection) --> Extranet
🔎 Why does it have to be a three piece suit?
If you think the world is safe with just a DNS tool, you probably haven't encountered these situations yet:
- DNS pollution turns your visit to Google into a “broadcast video”;
- AdBlock browser plugin didn't work, more popups than content;
- DNS requests run naked on the public network and anyone can see what you're accessing;
- You want to visit bilibili, but suddenly you find that you are redirected to your own “advise you to learn station” ......

The nodes demoed here are freeSubscription address created by cloudflare Interested in trying it out for yourself.


The principle of the setup here is the same as in our previous Mosdns+AdGuardHome+Passwall Realize Network-wide Adblock DNS Domestic and International Triage is exactly the same, here it is not to re-tell, our main point is to set theOpenclash(used form a nominal expression)nameserver(used form a nominal expression)DNSThe server is port 555 of AdGuardHome on our LAN, and then upstream of AdGuardHome is port 55 of our MosDNS. The diagram below:


Then it's our mosDNS that takes over the banner, doing DNS caching domain name resolution, matching domestic and international forwarding matching rules, and doing an optimal and most efficient triage service.

Each of the three pieces has its own division of labor and complementary strengths:
| module (in software) | duty | analogous role |
|---|---|---|
| OpenClash | Scientific Internet Access, Traffic Diversion, Transparent Proxy | Police + Border Guard Station |
| mosDNS | DNS forwarding, caching, encryption, matching rules, domain name filtering | Magician + Transportation Bureau |
| AdGuardHome | Blocking advertised domains, blocking tracking, protecting privacy and providing a clean front-end | Janitor + Cleaner |
When all three work together, you'll be amazed at how refreshing and orderly the online world can be.
🧩 Module Principle Tutorials
OpenClash: Inside the Walls, Outside the Lines
OpenClash is the OpenWrt port of Clash, based on proxy rules to determine which traffic goes through the proxy (e.g., you visit Google) and which is directly connected (e.g., you visit your local bank), and it also supports modes such as Fake-IP, redir-host, TUN, and so on.
It deals with **“who you are visiting”cap (a poem)“The question of ”how to go "** belongs to the traffic forwarding layer.
DNS, on the other hand, determines exactly who you're accessing.
It's a matter of having a reliable DNS module to work with.

mosDNS: The Integrated DNS Dispatch Specialist + Security Guardian
mosDNS is a modern DNS forwarder featuring:
- Supports encryption protocols such as DoH/DoT to prevent ISPs from peeking;
- You can write rules in YAML to make it easy to do “this domain goes this way, that domain goes that way”;
- Supports concurrent queries, multi-path selection and caching.
AdGuardHome: The First Line of Ad Blocking
AdGuardHome is a Go-based local DNS server that comes with ad filtering rules that can block:
- banner advertisement
- Video Patch Ads
- web tracker
- social button
- Some annoying “endless pop-ups”.”


It also provides a graphical interface with statistics on how many ad requests you've blocked in total, which domains are the most annoying, and which domains your devices have requested - perfect for people who want to snoop on their browsing habits.
However, it is not responsible for scientific internet access, nor can it encrypt DNS requests. Therefore, mosDNS is needed to “back up” and then OpenClash will coordinate the export policy.
To summarize: why is this the networking kit you deserve?
- Enhancing the Web Experience: Scientific Internet access without dropping lines, and extremely fast direct connection to domestic sites;
- Protection of privacy: DNS encryption, full network stealth;
- Clean Internet: There are fewer ads and all the anxiety is gone;
- free and controlledThe powerful Openclash customization allows you to set up your own configurations according to your needs;
- Integrated configuration: The router does one configuration and the whole family of devices gains.









