Main router or secondary router: first check where traffic flows
For your first setup, test the core, configuration, and outbound connection on a single device using an explicit proxy. Then decide whether to route all of that device’s traffic through mihomo. mihomo is the name of the core continued from Clash Meta. A running process only confirms that the core has started; it does not make the device a gateway for your LAN or automatically change the DNS settings on other devices.
| Deployment location | How devices connect | What to check first |
|---|---|---|
| OpenWrt main router | Devices continue to use the main router as their default gateway, and the router selects which traffic to send through the transparent proxy. | Check for conflicts with existing firewall rules, DNS redirects, and policy routing. Changes may affect the entire LAN. |
| Secondary router on the same subnet | Use the secondary router’s explicit proxy on one device, or set that device’s IPv4 default gateway to the secondary router. | Check that the secondary router’s own default route still points to the main router, and verify that the test device’s DNS and IPv6 paths behave as expected. |
For example, the main router is 192.168.1.1 and the secondary router is 192.168.1.2, both on 192.168.1.0/24. Assign the secondary router a static address, then reserve it on the main router or exclude it from the DHCP pool. Keep the main router’s DHCP service enabled during testing; don’t run a second DHCP server on the same broadcast domain. With an explicit proxy, the test device doesn’t need to change its default gateway. With a transparent proxy, first confirm that the test traffic actually reaches the secondary router.
Check OpenWrt architecture, kernel support, and writable storage
Don’t choose a binary based on the router’s product name. First check the architecture and version reported by the installed firmware, then match them to the Linux builds available for mihomo. These commands only read the device’s current state:
uname -m
cat /etc/openwrt_release
df -h /overlay /tmp
ls -l /dev/net/tun
- Architecture:
x86_64usually maps to Linux amd64, andaarch64to Linux arm64. Forarmv7l, check whether a compatible 32-bit ARM build is available. For MIPS devices, verify the endianness and floating-point ABI. Firmware support does not guarantee that a runnable binary is available for your device. - Firewall: OpenWrt 22.03 and later use firewall4, which is based on nftables by default. Custom firmware may differ. Before enabling transparent interception, check which firewall backend is actually in use; don’t copy firewall3 rules from older versions as-is.
- TUN support: If you plan to use TUN, check for
/dev/net/tun. If the device node is missing, first confirm that the current firmware provides akmod-tunpackage compatible with its kernel. Having the node doesn’t guarantee the service has permission to create interfaces or change routes. - Storage: Keep the binary, configuration, and persistent data on writable storage that survives reboots. OpenWrt’s
/tmpis stored in memory and cleared on reboot. Leave space for rule-set updates, too.
If you keep the working directory and configuration in /etc/mihomo and have added mihomo to your command search path, you can record the version and then validate the configuration. A subscription containing only proxy nodes still needs a base configuration to reference them; a node list is not a complete configuration with inbounds, proxy groups, and rules.
mihomo -v
mihomo -t -d /etc/mihomo -f /etc/mihomo/config.yaml
A valid configuration doesn’t prove that a proxy node is reachable or that device traffic is being intercepted. First confirm that the running process loaded this configuration, then connect from a test device.
Choose a proxy entry point: explicit proxy, TUN, or transparent port
Start by testing a complete connection through an explicit proxy
Set mixed-port to a sample port such as 7890, then allow access from test devices on a controlled LAN. mixed-port provides HTTP and SOCKS proxy access; 7890 is just an example, not a fixed port for every installation. Check allow-lan, the listen address, and inbound firewall rules. Don’t expose the proxy port or controller interface to the WAN.
Run the request below from a test computer with curl installed, and check mihomo’s connection log at the same time. After a successful request, verify which rule matched and which outbound was used. Matching DIRECT only tests the proxy entry point and direct connection path.
curl --proxy http://192.168.1.2:7890 --max-time 15 --head https://example.com/
Then choose one transparent interception method
- TUN:
tun.enableenables the virtual interface, whiletun.auto-routeconfigures routes automatically. On Linux,tun.auto-redirectdepends onauto-routeand uses nftables for redirection. Once enabled, verify forwarded traffic from a test device. A test run on the router itself won’t confirm that the LAN forwarding path works too. - Firewall forwarding to a transparent port:
redir-porthandles transparent TCP proxying; don’t use it as a UDP entry point if you need to intercept UDP.tproxy-portsupports both TCP and UDP, but Linux also needs matching firewall rules, packet marks, and policy routing. Setting a listen port won’t automatically send forwarded traffic to it.
DNS setup: distinguish device queries from proxy-node resolution
Map out the query path first. For example, a device sends DNS queries to OpenWrt’s dnsmasq, which forwards upstream queries to mihomo listening locally at 127.0.0.1:1053. Here, 1053 is only an example. Let dnsmasq continue serving port 53 to the LAN, so the two services don’t have to listen on the same address and port. Don’t also configure mihomo to send queries back to that dnsmasq instance, or they’ll create a DNS resolution loop.
- Regular DNS queries: Check
dns.enable,dns.listen, anddns.nameserver. If devices receive other DNS servers through DHCP or IPv6 router advertisements, their queries may bypass the DNS chain on the secondary router. - Resolver and proxy-node hostnames:
dns.default-nameserverresolves the hostnames of DNS servers themselves;dns.proxy-server-nameservercan specify a resolver for proxy-node hostnames. In particular, avoid making the DNS queries needed to resolve a node depend on a connection to that node before it’s established. - Regular and encrypted DNS: In TUN mode,
dns-hijackonly handles queries that enter the relevant interception path and match its settings. Matching port 53 won’t intercept DNS queries sent by browsers over HTTPS or automatically cover queries sent over IPv6 to another router.
To troubleshoot, query the same domain from a test device using the expected DNS server, then compare the result with the resolver’s logs. If the domain resolves but the connection matches an unexpected proxy group, check the order of the Clash rules, the destination hostname or IP in the logs, and what the final MATCH rule points to. Don’t judge the routing result just by whether a page opens in the browser.
Verify the secondary router: IPv6, return paths, and recovery
- Check both default routes. On a Linux test device, use
ip routeandip -6 routeto inspect them separately. If you change only the IPv4 gateway to the secondary router, the main router may still advertise the IPv6 default route. Test IPv4 and IPv6 connections separately; don’t assume the result for one applies to the other. - Verify the actual forwarding path. When a secondary router on the same subnet forwards a connection that isn’t intercepted, the main router may send the reply directly to the device, bypassing the secondary router. If problems occur only in transparent mode or with certain connections, compare the paths on the device, secondary router, and main router before changing the network layout or firewall. Don’t treat enabling NAT as a universal fix.
- Separate listener, DNS, and outbound failures. If a device can’t connect to
7890, check the proxy process, bind address, and LAN inbound rules first. If hostname lookups fail, check the DNS chain. If DNS works but the core logs showdial timeout, identify whether the timed-out destination is the proxy node or the target site, then check the relevant route and connectivity. - Test reboot recovery and rollback. Before making changes, save the original gateway and DNS settings, and confirm you can still access the router’s admin interface from the LAN. Restart mihomo first, then verify that the service, listener, and firewall interception recover after a device reboot. If testing disrupts the connection, restore the test device’s original gateway and DNS settings, and remove its explicit proxy settings.
Expand access only after testing is complete. If an older router runs low on memory while loading rules or handling concurrent connections, remove unneeded rule sets and monitor resource usage. If routing and proxy services still interfere with each other, moving mihomo to a dedicated secondary router is usually easier to troubleshoot than adding more interception rules to the main router.