What this topology solves

Many home networks already have a main router that hands out IP addresses, performs NAT toward the internet, and runs Wi‑Fi for every phone and PC. The idea of a side gateway (sometimes called a side router) is to bolt on a second device—often OpenWrt on inexpensive hardware—whose only job is to run a proxy engine such as Clash Meta (Mihomo) with transparent forwarding, while you never ask it to be the network DHCP server. That single constraint prevents the classic “two routers, two pools, double NAT chaos” story when both boxes try to own address assignment on the same broadcast domain.

Readers search for Clash on OpenWrt when they outgrow a single desktop client but still want YAML policies, node groups, and rule-based splits instead of a plain VPN. Running the core on the router puts policy enforcement next to the traffic path; pairing it with transparent proxy means phones and game consoles you cannot easily configure with manual HTTP proxies still traverse your rules without per-app settings. The remaining hard parts are (1) making sure only one DHCP service answers on the LAN, (2) steering DNS so lookups follow the same policy as TCP flows, and (3) not leaking queries around Clash. Our Fake-IP and DNS leak guide explains the DNS side in depth; this article focuses on the side router wiring you layer on top.

Roles: what runs where

Picture two boxes on 192.168.1.0/24 as a concrete but adjustable example. The main router sits at 192.168.1.1. It should remain the default gateway in DHCP option for every phone and laptop, because it has the true uplink, port forwards you might rely on, and the simplest mental model for family troubleshooting. The OpenWrt side device—often a mini PC with two NICs, or a travel router in “dumb AP plus service host” form—takes a static address such as 192.168.1.2 and does not run a competing DHCP service on that LAN segment.

Clash, usually via OpenClash, ShellClash, or a manually installed mihomo build, lives on the OpenWrt host. Transparent mode here means: packets destined out of the LAN hit iptables or nftables rules that mark or redirect TCP (and, when you configure it, UDP) into Mihomo TPROXY or redirect listeners, so applications need no system proxy. You still keep an explicit mixed port in the profile for LAN-only manual clients or debugging with curl -x.

Winning the DHCP design: one server only

OpenWrt’s default dnsmasq stack often combines DNS and DHCP. On a side box that shares the same Ethernet broadcast domain as the main router, leaving DHCP active on the OpenWrt interface is the fastest way to hand half your devices a lease from a pool they never expected—duplicate addresses, default gateways that do not match your mental map, and streaming boxes that “worked yesterday.” The safe pattern is: disable the DHCP server on the OpenWrt interface that faces your main LAN (or never enable it in the first place), while still using that interface for the services you do want—SSH, the LuCI page, the Mihomo API, and DNS forwarding to Clash if you take that path.

Lua UIs and community packages may label the toggle differently, but the intent is the same. Under Network → Interfaces, edit the lan (or whatever bridge you use toward the home switch) and uncheck the DHCP server for that interface, or in /etc/config/dhcp set the matching dhcp block to option ignore '1' so odhcpd/dnsmasq does not offer leases. Keep a reservation on the main router for the OpenWrt static IP so a future factory reset of either device is less likely to assign 192.168.1.2 to a random tablet.

If you truly need OpenWrt to be the only router for a different VLAN or guest network, you are not in a pure side design anymore; treat that as a second project with routing tables and firewalls, not a quick add-on. This article assumes one flat LAN and one external DHCP voice.

IP addressing, gateway, and optional DNS in DHCP

End devices still need to know that DNS should flow through the policy path you built. The minimal approach: leave the main router as gateway 192.168.1.1 in DHCP, and in manual tests point one laptop’s DNS to 192.168.1.2 to verify the stack. For whole-house operation without per-device static entries, the cleaner approach is to set the DNS server option in the main router’s DHCP to the OpenWrt address 192.168.1.2, or to an upstream you trust, depending on how you chain dnsmasq and Mihomo. What you must not do is leak DNS to your ISP when Clash is supposed to decide domestic versus foreign; that concern is the same as on desktop, only now the resolver sits on a box that must forward into Mihomo. Cross-check your profile’s dns and nameserver-policy with the behavior described in the DNS leak section of the dedicated guide so Fake-IP and redir-host do not fight your router’s cached answers.

When the main router’s DHCP still advertises its own address as the DNS field while OpenWrt hijacks 53 with firewall redirects, you can make that consistent: either (a) have clients receive 192.168.1.2 as DNS from DHCP, or (b) keep clients pointed at the main router but run a forwarder there to the side box. The worst state is a split brain where TCP goes through TPROXY but UDP 53 to 8.8.8.8 still leaks direct—watch for that on Android-style “Private DNS” features which bypass your LAN resolver entirely.

Transparent path: TPROXY, redirect, and kernel expectations

Mihomo’s transparent inbound listens on a loopback or LAN address, commonly paired with a TPROXY or REDIRECT table that matches traffic from the LAN interface. The exact nftables or iptables lines depend on the integration you install; OpenClash, for example, writes rule sets and restarts them when the profile toggles. What matters for your mental model: only traffic that is routed through the OpenWrt box will be steered by those rules. In a side deployment where the default gateway is still the main router, you must policy-route or hotspot-capture traffic to the side box, or the packets never touch OpenWrt and Clash idles. Common ways people solve that:

  • Policy routing on the main router (if firmware allows): send a subset of source IPs or destination regions toward 192.168.1.2 as the next hop. Not every ISP CPE supports this, but pro-sumer and OpenWrt-based primaries do.
  • Default gateway on clients set to the side router for specific devices, with a static route on the side box back to 192.168.1.1 for internet—works when you are comfortable re-homing a few static hosts; phones using DHCP from the main router will still use 192.168.1.1 until you change DHCP.
  • Using the side device as the actual layer-3 default for everyone (main router in bridge or “modem only” style): this is no longer a light side add-on, because OpenWrt must own NAT and full routing; DHCP may legitimately move there. That is a different guide.

For a pure side node that is not the L3 gateway, some builders place the main router in front but connect certain VLANs with DHCP option 3 (router) pointing to 192.168.1.2. If you go that way, the OpenWrt host must forward return traffic correctly, enable net.ipv4.ip_forward=1 (and IPv6 knobs if you use IPv6), and you must test asymmetric routing carefully—games and VoIP notice broken paths fast.

OpenWrt and Clash integration paths

Three patterns appear most often in community setups. First, OpenClash or similar opkg / feed packages that include LuCI, automatic firewall hooks, a proxy core slot, and subscription refresh—fastest to a working page for many users, at the cost of following that project’s file layout. Second, a manually extracted mihomo or clash-meta binary with a systemd- or procd-style service on OpenWrt, which mirrors what you would run on a headless server but uses OpenWrt’s init. Third, container installs when your router has enough flash and RAM; the networking is trickier, but upgrades stay isolated. Pick one path and keep it, because half-migrated files under /etc confuse both LuCI and your future self.

Regardless of packaging, the profile is still a Mihomo document: proxies, proxy-groups, and rules in YAML. Enable the transparent listener features your build expects, align the TPROXY or redirect target port in the package UI with the port in the YAML, and open the allow-lan analog if the core binds only to 127.0.0.1 (some templates keep loopback until you change them). The TUN mode guide remains useful because many OpenWrt users compare kernel TUN capture with userspace TPROXY when UDP games misbehave; router RAM and kernel versions affect which is smoother.

DNS on the side: split, forward, and avoid leaks

“DNS split” in home labs usually means: domestic CDNs and bank sites resolve to addresses that your domestic exit handles well, while foreign names flow through a tunnel or remote node. In Mihomo, you implement that with the usual mix of nameserver lists, nameserver-policy for specific domains, and rule order that never shortcuts domestic answers through the wrong interface. The OpenWrt piece is to ensure 53/udp and 53/tcp from clients actually reach the local stub that talks to the core, instead of the ISP’s resolver. Either dnsmasq forwards to Mihomo, or redir rules in firewall send DNS to the Clash port you configured, depending on the integration.

When you also care about DNS over TLS on phones, remember that a DoT client to Cloudflare is not “wrong,” but it sidesteps your policy unless you block or redirect those flows intentionally. A pragmatic lab test: capture packets on the OpenWrt WAN while a phone browses, and check whether you still see clear-text UDP 53 when you think everything should be local. If you do, adjust DHCP DNS, disable random third-party resolvers, and revisit firewall redirects.

Test plan you can run tonight

Start from one wired PC with a static address so each variable moves independently. (1) Ping 192.168.1.1 and 192.168.1.2. (2) With Clash off, confirm ordinary browsing works through the main router. (3) Start Mihomo, apply transparent rules, and run curl -4 https://ifconfig.io on the test PC—expect the public IP to match the exit node, not the ISP, when the profile routes that destination through a proxy. (4) Visit a DNS test page in the browser, or use nslookup against the resolver you think is in play. (5) Re-enable phone DHCP, confirm it picks up the DNS values you set on the main router, and re-run the last two tests. Log lines in the Mihomo UI or logread on OpenWrt should show handshakes, not mass silent drops.

Pitfalls that look like “Clash is broken on OpenWrt”

Traffic never hits the side box

Symptoms: no matching chains in the firewall counter, no sessions in the dashboard. The fix is routing, not YAML: ensure packets aimed at the internet actually traverse OpenWrt or point clients at it. Transparent rules cannot catch what never arrives.

Duplicate DHCP or rogue IPv6 RAs

Some networks advertise IPv6 autoconfig while IPv4 is stable. A sudden jump to IPv6-only paths can bypass your IPv4 TPROXY table. Tighten RA or align IPv6 policy deliberately if you use it.

Flash, RAM, and OOM on small routers

Rule providers and large GeoIP databases exhaust flash when you add too many feeeds, and the OOM killer stops Mihomo mid-handshake. Trim providers, or move the core to a larger box. Our headless service guide describes a stable layout if you outgrow the travel-router class hardware.

Closing: side gateway, single DHCP brain

A good Clash OpenWrt side build does not need theatrics. Keep one DHCP authority on the main router, give OpenWrt a static address, turn off competing lease services on the side interface, and wire transparent capture plus DNS that cannot shortcut your policy. When those pieces line up, every TV box and game console on Wi‑Fi inherits the same rule stack you already trust on a laptop, without the fragility of manual proxy fields on every OS.

Compared with jerry-rigging a PC as a 24/7 hop, a small OpenWrt node draws less power, boots quickly after power cuts, and keeps Mihomo in the place where your packets already pass—assuming you line up routing correctly. If you are standardizing on a current Mihomo build with profiles you can carry between desktop and router, download Clash for free from our official page and experience the difference.