· Platforms · 9 min read
OpenWrt Mihomo Bypass Router: Setup Options and Network Topologies
Learn how to run mihomo on an OpenWrt router or bypass router, route traffic through a gateway, set up transparent proxying, and check requirements before deployment.
Deployment options: test on one device before changing the gateway
If your main router is already running reliably, first connect a computer explicitly to the proxy port on the bypass router. Confirm that the configuration works and traffic can reach its outbound destination before routing that computer through the bypass router. mihomo accepts connections, applies routing rules, and establishes outbound connections. It runs on OpenWrt, but starting the process alone does not change how other devices on your LAN route traffic.
| Option | How devices connect | Best for |
|---|---|---|
| Bypass router as an explicit proxy | Enter the bypass router's address and port in proxy-enabled apps; leave the default gateway unchanged. | Testing the core, configuration, or an outbound route with minimal impact. |
| Bypass router as the gateway for selected devices | Set the bypass router as the default gateway on selected devices; it then handles eligible traffic. | Routing only selected devices through a transparent proxy without configuring proxy settings in each app. |
| Run on the OpenWrt main router | Devices keep using the main router as their gateway, and it handles traffic passing through it. | OpenWrt already serves as the network's gateway, and you can maintain internet access and restore the configuration if needed. |
Each option can run the core directly or use a management plugin with a LuCI interface. LuCI is OpenWrt's web-based management interface. With a direct setup, you manage the configuration directory, logs, and service lifecycle yourself. Plugins usually handle these for you and may also take over firewall and DNS settings. Check exactly what a plugin manages, and avoid having both a plugin and custom scripts modify the same traffic-handling rules.
Bypass router on the same subnet: which gateway to set on the main router and devices
Here's an IPv4 single-interface bypass router example: the main router and bypass router share a LAN, and the bypass router receives device traffic through the same LAN interface before forwarding traffic that needs internet access to the main router. The two routers are not connected in series to create separate subnets. The addresses below are examples; check that they don't conflict with existing devices or the DHCP range before using them.
Main router LAN: 192.168.10.1/24, connected to the internet
Bypass router LAN: 192.168.10.2/24, default gateway 192.168.10.1
Test device: 192.168.10.50/24, default gateway 192.168.10.2
Other devices: keep using the main router at 192.168.10.1
- Keep DHCP on the main router. DHCP automatically assigns addresses and gateways to devices. Don't let both routers assign addresses on the same LAN. If the main router's address pool is
192.168.10.100through192.168.10.199, the example addresses.2and.50are outside that range; still check that neither is already in use. - Keep the main router as the bypass router's upstream gateway. In LuCI, open “Network → Interfaces → LAN → Edit” and check the static IPv4 address and IPv4 gateway. After changing the management address to
192.168.10.2, apply the settings and reopen LuCI at the new address. Make sure you can access both routers' management pages before changing the test device's gateway. - Change the gateway on the test device only. Set IPv4 manually, or change only the test device in a DHCP service that supports per-device gateway assignments. Don't change the network-wide default. Devices on the same subnet usually communicate directly; being able to open the bypass router's management page doesn't prove that internet traffic from the test device is going through it.
Transparent proxy flow: from device connection to mihomo outbound
Understand the difference between a proxy listener and traffic interception
For an explicit proxy, you can use mixed-port to accept HTTP and SOCKS5 proxy connections on the same port. For example, if the configuration uses 7890, enter 192.168.10.2:7890 in a proxy-enabled app on the test device and select the right protocol. For connections from other devices, make sure the core allows LAN access, listens on an address reachable through the bypass router's LAN, and the firewall allows the test device to reach that port. Allow access only from the LAN devices that need it; don't expose the proxy port or management interface to the public internet. Use the port in your current configuration: 7890 does not automatically intercept packets passing through the router.
Transparent interception needs to be configured separately. TUN creates a virtual layer 3 network interface; the system routes selected IP traffic through it to mihomo. Another option is TPROXY, where Linux firewall rules and policy routing send selected packets to a transparent proxy listener while preserving their original destination. With either approach, define exactly which traffic to intercept. A browser connecting to the mixed port does not mean that forwarded LAN traffic is also reaching the core.
Check outbound routes, return paths, and exclusions
For rule-based routing, traffic from the test device first reaches the bypass router. If it matches the interception criteria, it enters mihomo, where the rules determine whether it connects directly or uses a proxy outbound. Both direct connections from the core and connections to a proxy server need a working upstream route. If the core's own outbound traffic gets sent back into the transparent proxy, connections may time out or loop. Check how your setup excludes the core's outbound traffic, and make sure the router's management address and local network remain accessible.
On a single-interface setup with both routers on the same subnet, check the return path for connections that are forwarded without interception: the main router may send packets directly to the device, so replies might not pass through the bypass router. If your firewall or traffic statistics require both directions to pass through the bypass router, verify the path first. Then consider source NAT for specific forwarded traffic or a separate downstream subnet. With source NAT, the upstream router sees the bypass router's address instead of the original device's address; it is not a universal fix.
Before deployment: check firmware, device resources, and DNS
- Check the firmware and architecture. OpenWrt
24.10, for example, uses firewall4 (fw4), based on nftables, by default. Make sure your management plugin supports your firmware; firewall3 and iptables instructions may not apply to fw4. Check the firmware version under LuCI’s “Status → Overview.” Over SSH, runubus call system boardto verify the device model and firmware target. Before choosing a kernel package, check the system bitness and target architecture:arm64andamd64are not interchangeable. - Check storage and runtime requirements. Run
df -hto check available space on the partition where your configuration and rule files are stored, then runfreeto check available memory. For TUN, verify kernel support and check for/dev/net/tun. If you need to installkmod-tun, it must match the kernel in your currently running firmware. Don't decide whether deployment is possible based on the device's advertised flash size alone. - Map the DNS forwarding chain. DNS resolves domain names to IP addresses. First check whether the test device uses the main router's DNS, the bypass router's DNS, or encrypted DNS configured in the browser. OpenWrt's dnsmasq usually listens on the local
53port. To forward queries to mihomo, you can have the core listen at127.0.0.1:1053on the bypass router, and make sure mihomo's upstream doesn't send queries back to the same dnsmasq instance. This loopback address is only accessible from the bypass router itself; don't enter it on LAN devices. Before making changes, see the DNS configuration guide. - Test startup separately from automatic launch. Don't rush to enable startup on boot during your initial tests. A subscription URL retrieves remote configuration or proxy lists and may contain access credentials. Restrict access to saved configurations and logs, and hide subscription URLs in screenshots before sharing them. Enable startup only after confirming the configuration loads, outbound connections work, and you can roll back the changes.
Test in order: ports, routing, DNS, and rollback
- Test the explicit proxy first. Keep the test device's default gateway at
192.168.10.1. Temporarily configure a proxy in an app and make a request. Check mihomo's logs for the source, matched rule, and outbound route. If the request fails and the core logs no connection, check the listening address, port, and firewall before trying different outbound routes. - Then test transparent interception. Remove the app's proxy settings and change only the test device's IPv4 gateway to
192.168.10.2. On Windows, useipconfigto check the default gateway; on Linux, useip route get 1.1.1.1to check the next hop for that destination. If the gateway is correct but no traffic appears in the logs, check whether LAN-forwarded traffic is being intercepted and whether the test request falls under the local network or another exclusion. - Separate DNS failures from connection failures. Run
nslookup example.comto see which server the device actually queries and what response it gets, then visit the domain in a browser and compare the result with the core's connection logs. If the name resolves but the site won't load, check the rules, outbound route, and return path. If only apps with encrypted DNS enabled in the browser behave differently, compare their actual DNS path with the system's. - Test rollback before expanding coverage. Keep one management device on the main router, and save the original network, firewall, and DNS settings. If the test device loses internet access, restore its original gateway and DNS settings (if DHCP assigned them, switch back to automatic), then use the management device to undo the bypass router's traffic interception. Don't just stop mihomo: rules that still point to the process may continue to intercept traffic.