Running the mihomo core on a secondary router: OpenWrt plugins and Docker deployment
Compare main-router and secondary-router setups, plus OpenWrt plugins, Docker containers, and standalone binaries for running mihomo.
Main Router or Secondary Router? Decide Which Devices Use mihomo
Your main router is already the default gateway for your LAN. Running mihomo on it makes it easy to manage all connected devices from one place, but kernel upgrades, DNS changes, or firewall updates can affect the entire network. A secondary router is a device connected to your existing LAN. You can route just one test device through it while leaving the rest on their current gateway and DNS settings. Choosing Docker is a separate decision from choosing a network topology.
Example: A Secondary Router on the Same Subnet
- Main router:
192.168.10.1/24, still responsible for internet access and DHCP. The example DHCP pool runs from192.168.10.100to192.168.10.199. - Secondary router:
192.168.10.2/24, outside the DHCP pool; make sure the address is unused. Set the secondary router's default gateway to192.168.10.1. Keep the main router's DHCP service running on the shared broadcast domain. - Test device: Leave its default gateway unchanged at first and enter the secondary router's explicit proxy address only in the app you want to test. To test transparent proxying, change this device's IPv4 gateway to
192.168.10.2on its own. Don't change DHCP options for the whole network yet.
OpenWrt Plugins: Check the Core, Config Source, and Firewall Support
For a home network already using OpenWrt as its gateway, consider a plugin managed through LuCI. Plugins bring config imports, process controls, DNS, and firewall settings together for easier troubleshooting. A plugin's claim to support Clash configs doesn't mean it's running mihomo. Before installing, check the release notes for supported OpenWrt versions, package architectures, and available cores.
- Check platform support. Run
ubus call system boardto see the firmware version and device target. On common OpenWrt 23.05 or 24.10 setups, check whether the plugin supports the nftables-basedfirewall4. An installable package doesn't guarantee that the plugin's dependencies or traffic-redirection rules are compatible. - Import first, then confirm which file is active. Note the selected config, subscription update time, and version of the core actually running. Many plugins generate a runtime config from the subscription, so editing the imported source file may not change the active rules. Put local overrides in a plugin-supported location, then check that they remain in effect after saving, applying, and restarting.
- Check the logs before enabling traffic interception. In LuCI, open Status โ System Log to see whether the process keeps exiting. You can also run
logreadto check for port conflicts or config parsing errors. Confirm that the logs show the expected config loaded and listeners started before enabling transparent proxying as documented by the plugin. Don't have a second service manage another set of traffic-redirection rules at the same time.
Docker Deployment: Understand Port Publishing vs. Traffic Interception
If your secondary router is a Linux mini PC running Docker, mihomo can run separately from the host's services. Pin the image version and mount the config and any data that needs to persist. After recreating the container, check the startup logs to see which config path it actually loaded. A YAML file on the host doesn't mean the container is using it.
| Network mode | Use case | What to check |
|---|---|---|
| Bridge network | Apps explicitly use an HTTP or SOCKS proxy | The proxy inside the container must listen on an address reachable through the published port. When publishing the port on the host, you can bind it to 192.168.10.2:7890 and restrict access by source address in the host firewall. |
| Linux host network | Direct access to the host network is required, and you can review routes and permissions | The container and host share a network namespace, so no ports need to be published. Check for port conflicts. If using TUN, verify /dev/net/tun and NET_ADMIN are available as required by your setup. |
Suppose the config sets mixed-port: 7890. This port provides an explicit HTTP or SOCKS proxy; publishing it does not automatically route the entire LAN through mihomo. Even if a TUN interface appears inside the container, check which network namespace it belongs to and whether traffic forwarded by the host reaches it. For explicit proxy use only, keep the bridge network and avoid granting the container extra routing privileges.
Standalone Binary: Control Core Versions, Maintain System Integration Yourself
A standalone binary suits environments where you have Linux service-management experience and want to control when mihomo is upgraded. Run uname -m to check the CPU architecture, then choose a release that matches the device's supported instruction set. Use mihomo -v to record the core version in use. If you keep runtime configs under /etc/mihomo, check a specific file with this command before starting the service:
mihomo -t -d /etc/mihomo -f /etc/mihomo/config.yaml
After the check passes, use the platform's service manager to run the process: systemd on common Linux distributions and procd on OpenWrt. Keep the service's working directory, data directory, and file permissions consistent with those used during the check. A valid config only means the core accepts it; it doesn't prove that nodes are reachable, rules match as intended, or transparent forwarding will survive a reboot.
When migrating from a desktop client, first identify what you exported: Clash YAML, a subscription URL, or client-specific overrides. Keep portable rules and policy groups separate, then check referenced group names, provider file paths, and whether the current mihomo version supports each config field. Don't put subscription credentials or the control API secret in a publicly accessible backup. Bind the control API to loopback whenever possible.
Test in Order: Explicit Proxy, DNS, Then Transparent Forwarding
- Test the explicit proxy first. Leave one device on its existing gateway and point a single app's HTTP or SOCKS proxy to
192.168.10.2:7890. Test one service expected to connect directly and another expected to use the proxy. Check the connection logs at the same time to confirm the matched rule type, policy group, and actual egress. A page loading successfully doesn't tell you whether its traffic went through the proxy. - Next, test DNS. If your setup provides DNS on the secondary router's LAN address, run
nslookup example.com 192.168.10.2to test its53port. If mihomo's DNS listens only on127.0.0.1:1053, check that the DNS forwarder on the secondary router accepts queries on port53and forwards selected queries to the core. Then query using the device's default resolver and compare which server it actually uses. Test separately if the browser has its own encrypted DNS enabled. - Finally, test transparent forwarding. Clear any explicit proxy settings in the test app and change only the test device's IPv4 gateway. Test LAN services, external TCP connections, and any UDP apps you need; check IPv4 and IPv6 separately. If a secondary router on the same subnet sees traffic in only one direction, check whether replies are going straight from the main router to the device and whether your setup requires source NAT. Don't assume forwarding works just because TUN is enabled.
- Keep a rollback path. Leave a device available to access the main router's admin page, and note the test device's original gateway and DNS settings. If testing breaks connectivity, restore the device's original DHCP or manual network settings first, then remove any traffic-interception rules added to the plugin or host. Test a reboot with one device before expanding the rollout.
Choosing a Deployment: Start with Your Platform and Maintenance Needs
If your main router runs OpenWrt and you want centralized management in LuCI, choose a plugin that explicitly supports your current system version and mihomo. If a separate mini PC already runs Docker and you only need a proxy for a few apps, start with bridge networking and a fixed port. Choose a standalone binary when you want to manage the core version, service permissions, and upgrade schedule yourself. For transparent forwarding, verify firewall rules, DNS routing, and IPv6 separately no matter which approach you choose. Deployment determines who maintains these parts; each still needs to be tested.