Once you understand this principle, anyone can customize their own modes and methods based on their specific needs to create personalized DNS and network optimization solutions.
- Mosdns as the core DNS processing module
Mosdns handles all DNS resolution on OpenWRT devices, replacing the router’s built-in dnsmasq. It performs front-end DNS traffic routing, forward lookup, DNS cache aggregation, and DNS leak prevention, enabling intelligent traffic routing and efficient resolution for both domestic and international domains. - AdGuardHome handles ad blocking and domain management
AdGuardHome is primarily used to block ads; it offers precise domain blocking and can effectively track and manage the browsing history of all devices in the home. Additionally, its upstream DNS server should be set to Mosdns to ensure optimized DNS resolution. - Passwall Handles Accessing Blocked Websites and Direct BitTorrent Connections
Passwall handles secure internet access and direct BitTorrent connections, while setting its upstream DNS to AdGuardHome, allowing it to take full advantage of AdGuardHome’s ad-blocking and domain management capabilities to further optimize the browsing experience.
With this architecture, Mosdns handles core DNS resolution, AdGuardHome handles ad blocking and domain management, and Passwall ensures unrestricted internet access. The three components work together to deliver an efficient, secure, and seamless online experience.
Note: The original blog post was published by "Old Wang of Tech":https://kjlw.psce.pw/795hmf
Related Reading:
How to Choose Among Three DNS Bypass Solutions?
| Plan | Link | Advantages | Suitable Scenarios |
|---|---|---|---|
| Simplified Approach | Client → dnsmasq → Proxy Plugins | Fewer components, easier to troubleshoot | Beginners and households with limited equipment |
| Filter First | Client → AdGuard Home → MosDNS/Proxy DNS | Intuitive logging and centralized ad filtering | Need whole-home filtration and parental controls |
| Traffic Diversion Priority | Client → MosDNS → Domestic/Proxy Upstream | Flexible rules, robust caching and traffic distribution capabilities | Advanced users who are willing to follow the rules |
The Four Most Important Principles for Configuration
- Keep only one clear entry point:The DNS address assigned by DHCP should point to the component responsible for receiving client requests.
- Avoiding Loops:AdGuard Home, MosDNS, and the proxy plugin cannot be set as upstream for one another.
- Ports must not conflict:Each component listens on a separate port and clearly logs the direction of traffic.
- Connect First, Optimize Later:Start by validating and parsing using the simplest path, then gradually add filtering, caching, and traffic distribution.
Troubleshooting DNS Leaks and Failures
- Has the client obtained the correct gateway and DNS settings via DHCP?
- Is standalone DoH enabled in the browser, bypassing the local area network's DNS?
- Is IPv6 DNS still provided by the main router or the ISP?
- Does the proxy plugin's Fake-IP/Redir-Host mode match the current DNS connection?
- Check the logs for duplicate forwards, timeouts, or request loops.
If you use OpenClash, please continue reading Closed-Loop Configuration of OpenClash, AdGuard Home, and MosDNS; When you need to select a client, you can refer to Cross-Platform Client Comparison。
Original article by Tech.laowang. If you wish to repost this article, please credit the source: https://techlaowang.com/en/istoreos-openwrt-dns/