Platforms8-minute read
Running the mihomo Core on an OpenWrt Side Router: Setup and Key Considerations
Learn how to split routing duties, choose between a standalone core and a LuCI plugin, and configure gateways, DNS, and transparent proxying on your LAN.
Who Should Use a Side Router? Start with One Device
An OpenWrt side router can apply the same routing rules to devices like TV boxes that can’t easily run a client, while leaving your main router in charge of the internet connection and Wi-Fi. If only one computer needs a proxy, a desktop client is usually simpler: troubleshooting stays on that machine, rather than spanning your LAN’s gateway, DNS, and firewall.
The examples below use the LuCI interface in OpenWrt 24.10.0 and IPv4 addresses. The version is included to clarify the menus and firewall environment, not as an installation recommendation. Assume the main router is at 192.168.1.1/24 and its DHCP pool runs from 192.168.1.100 to 192.168.1.199. Check your actual subnet and which addresses are in use before adapting the examples.
| Device | Example address | Role |
|---|---|---|
| Main router | 192.168.1.1 | Connects to the internet and continues assigning addresses to regular devices. |
| OpenWrt side router | 192.168.1.2 | Runs mihomo; its own default gateway still points to the main router. |
| Test device | 192.168.1.20 | Uses an available static address for staged proxy, gateway, and DNS tests. |
Connect the OpenWrt LAN port to a LAN port on the main router. In LuCI, go to “Network” → “Interfaces” → “LAN” → “Edit”; confirm the protocol is set to static address, then enter the side router’s address and upstream gateway. Under the interface’s “DHCP Server” tab, disable the IPv4 DHCP server. It’s best to configure the side router offline before connecting it, to avoid an address conflict with the main router or two DHCP servers assigning settings to clients.
Standalone Core or Plugin: Which One Handles Traffic?
Standalone Core: Verify the Setup with an Explicit Proxy
First, run uname -m on OpenWrt to check the device architecture. For example, if the output is aarch64, choose the Linux ARM64 build from the mihomo releases. Once the configuration file is ready, test whether it loads with the matching binary: mihomo -t -f /etc/mihomo/config.yaml. This assumes the binary is in your command search path. A successful test doesn’t mean the proxy nodes are reachable; make a real request and check the connection log as well.
For the initial test, limit the listener to your LAN and use mixed-port: 7890 in the configuration. Point one computer’s browser or system proxy to 192.168.1.2:7890, leaving its default gateway and DNS unchanged for now. This lets you check separately whether requests appear in mihomo’s connection list, which rule matches, and which outbound is selected. Running the core manually also means setting up startup on boot, restart handling, and log rotation yourself.
Plugin Management: Check What It Changes
If you want to manage subscriptions, routing rules, and service startup through LuCI, choose a plugin that explicitly supports your OpenWrt version and device architecture. Before installing, find out which core it runs, where it writes the generated configuration, whether it takes over DNS, and whether it creates transparent proxy rules automatically. Subscription updates may regenerate the active configuration, so manual edits to generated files may not survive. For persistent changes, use the plugin’s override mechanism where available.
Client Gateway and DNS: Change Them Separately
- Start by changing the test device’s IPv4 gateway. Turn off the explicit proxy from the previous test and set the default gateway to
192.168.1.2, leaving DNS at192.168.1.1for now. Check that ordinary forwarding works. The default gateway only changes how IPv4 traffic destined beyond the local subnet reaches the internet; devices like printers and NAS units on the same subnet are usually accessed directly. - Next, verify the side router’s DNS service. If clients will use
192.168.1.2for DNS, first confirm that something is listening on port53at that address. One example is to keep OpenWrt’s dnsmasq handling queries, then use explicit forwarding rules to send queries that mihomo should handle to a listener on loopback, such as127.0.0.1:1053. Don’t let both services bind to the same address and port. - Finally, enable transparent proxying and test again. Open a regular website and access a local device, then check that mihomo logs the expected connections and policies. If changing DNS leaves you able to reach sites only by IP address, troubleshoot name resolution first rather than changing proxy groups.
DNS loops are a common pitfall: dnsmasq forwards a query to mihomo, which then sends the same query back to the local dnsmasq instance. Pay particular attention to how proxy node hostnames are resolved before the proxy is up. mihomo’s proxy-server-nameserver lets you specify a resolver just for node hostnames. That resolver must be reachable during startup and must not depend on a node that isn’t connected yet. Local hostnames should still be answered by the local resolver that holds those records.
Once the pilot works, consider having the main router’s DHCP server assign the gateway and DNS settings to selected devices. If the main router can’t assign settings per device, keep configuring a small number of clients manually. There’s no need to change the default gateway for the entire network just to support a few devices.
Transparent Proxying and TUN: Check Return Traffic and IPv6
Transparent proxying lets applications connect without entering a proxy address. TUN is one way to intercept traffic: the core uses a virtual network interface to handle IP traffic routed to it by the system. Being able to create a TUN interface doesn’t mean OpenWrt is sending LAN clients’ traffic through it. Before deployment, check that /dev/net/tun is available and determine which component handles forwarding, policy routing, and firewall rules. If a plugin uses TProxy or another interception method, don’t also enable mihomo’s TUN auto-route by default.
- Return traffic on the same subnet: After a test device sends direct traffic through the side router to the main router, the main router may send replies straight back to the device on the same subnet, bypassing the side router. If interception or connection tracking requires both directions to pass through the same device, consider using a separate test subnet and configure a return route. If you must use source NAT on the same subnet, be aware that upstream devices will see the side router’s address, which affects per-device statistics.
- Test IPv6 separately: Even after manually changing the IPv4 gateway, a client may still get its IPv6 default route from the main router’s router advertisements. If some sites bypass your rules, test IPv4 and IPv6 separately first. If the side router doesn’t handle IPv6 router advertisements, don’t enable another set of advertisements on the same subnet.
- Test UDP separately: A working website only confirms that this particular connection works. If you need to proxy voice calls, games, or apps that use QUIC, check that the interception mode, outbound protocol, and node all support the relevant UDP traffic.
Side Router Troubleshooting and Rollback
- No internet even after disabling the proxy: First check the client’s subnet mask, default gateway, and the side router’s LAN address. Then confirm that OpenWrt itself can reach the internet through the main router and that the firewall permits the required forwarding. Don’t change several proxy settings at once while basic forwarding is still broken.
- Connected, but domain names won’t resolve: On a device with
nslookup, runnslookup example.com 192.168.1.2to test the side router’s DNS directly. Getting a response only confirms that this query returned a result; a browser using its own encrypted DNS may follow a different resolution path. - Explicit proxy works, but transparent proxying shows no connections: Make sure the test device is no longer using an explicit proxy, then check whether its traffic actually passes through the side router. Next, verify that the interception scope includes the interface and address used by the test device, and check whether the connection uses IPv4 or IPv6. If connections are logged, troubleshoot rule matching and outbound errors separately.
- Stops working after a reboot or subscription update: Check whether the core starts automatically, whether its listening port conflicts with another service, and whether configuration overrides and firewall rules are reloaded. Repeat the test with the same device; an existing connection may still work even when the configuration hasn’t recovered.