Overview
SAM (SmartDNS + AdGuardHome + Mihomo), developed by 5MayRain, is a comprehensive networking, ad-blocking, and transparent proxy suite built for rooted Android platforms. While running standalone instances of DNS engines or proxy tools often leads to port conflicts, DNS routing loops, and battery drain, SAM orchestrates all three tools into a single, cohesive systemless pipeline.
Depending on your requirements, services can be run individually, paired together, or operated concurrently as a full filtering and proxy stack.
Prerequisites & Compatibility
- Root Framework: Magisk, KernelSU, or APatch.
- Port Availability: Ensures ports 53 (DNS), 3000 (AdGuard Home web dashboard), and 9090 (Mihomo control) are not hijacked by other processes.
Conflict Notice
Do not run SAM concurrently with other standalone transparent proxy modules (such as MagicNet or Surfing) or standalone DNS redirectors (such as AdGuardHomeForRoot). Running multiple modules attempting to bind port 53 or route iptables will result in network failure.
Service Topologies & Priority Flow
SAM supports two primary routing structures:
SmartDNS > Mihomo > AdGuardHome:- Queries hit SmartDNS first for intelligent domain resolution and nearest-IP selection.
- Traffic flows through Mihomo for rule-based proxy routing.
- AdGuard Home performs last-mile ad and tracker filtration.
SmartDNS > AdGuardHome > Mihomo:- Traffic hits AdGuard Home for filtering before passing to Mihomo for proxy traversal.
Core Service Behavior
- SmartDNS: Possesses lowest forwarding priority; when other services are active, it acts as an upstream resolver.
- AdGuardHome: Provides systemwide local ad blocking, DNS query logging, and custom blocklist management.
- Mihomo: Serves as the transparent proxy core, routing network sockets through configured proxy nodes.
Configuration & Dashboards
- Flash
SAM-*.zipin your root manager and reboot. - The default web interface credentials for bundled services are:
- Username:
root - Password:
root
- Username:
- Access AdGuard Home web interface at
http://127.0.0.1:3000. - Mihomo core configuration resides at:
/data/adb/modules/SAM/etc/mihomo/base.yaml[!IMPORTANT] Do not delete or indiscriminately modify
base.yaml; SAM relies on specific anchor structures within this file to bind transparent proxy ports. - All module assets and configuration files persist in:
/data/adb/modules/SAM/
Troubleshooting & Verification
- Loss of Internet Connectivity:
- Toggle Airplane Mode on and off to reset Android’s network interfaces.
- Open the AdGuard Home query log (
http://localhost:3000) and check whether queries are being blocked or if the upstream DNS server is unreachable.
- Exempting Specific Wi-Fi Networks: Use SAM’s Wi-Fi blacklist feature to prevent the proxy from engaging when connected to trusted local LANs or enterprise networks.