If OpenWrt and your main router are already working and you want to move proxying from an endpoint to the network gateway, start by testing the core and a single-device gateway, then verify which traffic the transparent proxy captures. This guide separates config files, process listeners, and firewall rules to help pinpoint issues such as settings lost after reboot, pages that keep loading, or limited memory.
Main Router vs. Side Router: Decide Who Assigns Addresses
A side router on the same subnet does not automatically receive all device traffic. The main router continues to handle internet access, address assignment, and outbound NAT. Traffic from a test device reaches the side router first only after you set it as the IPv4 default gateway. Connections to devices on the same subnet, such as printers and admin pages, usually go directly from the endpoint without passing through the default gateway.
Test One Device Before Changing DHCP
Change the default gateway on just one device, and note how to switch it back to automatic configuration. If that device cannot reach both the main router’s admin page and external websites, do not change the gateway advertised by the main router yet.
The example above uses 192.168.1.0/24. Choose a static address for the side router outside the main router’s DHCP pool, or reserve it on the main router, to avoid an address conflict. If OpenWrt is the main router, you do not need to add a second gateway. You can still test from a single endpoint first to avoid disrupting the whole network.
Xray or V2Fly: Choose a Core That Matches Your Outbound Settings
A router runs a core process, not a desktop client. First confirm the protocol, transport, and security settings used by your current server, then check whether the firmware’s package repository offers a core built for your device architecture. Config fields and commands are not necessarily compatible between the two cores, so do not replace the router’s entire config with one exported from a desktop client.
Xray
RecommendedIf your existing outbound uses VLESS and REALITY, choose an Xray version that supports the required transport, based on your server settings, then verify the listener and outbound connection.
Best for: Using existing server settings to route traffic from selected devices through OpenWrt
V2Fly
If you already maintain a VMess config based on V2Fly, you can stick with the core you know. Still, check JSON fields and routing resource paths against the installed version.
Best for: Keeping a proven VMess outbound and continuing with the same config
From Config File to a Single-Device Test
Set a Static Address for the Side Router
In the side router’s LuCI, go to “Network” → “Interfaces” → “LAN” → “Edit” → “General Settings” and check the static address, subnet mask, and IPv4 gateway. Using the example, set the side router to
192.168.1.2/24and the gateway to192.168.1.1. Save, then reopen the admin page at the new address.Check DHCP Settings
On the same edit page, open “DHCP Server” and make sure this LAN interface on the side router does not assign IPv4 addresses; let the main router handle DHCP. Also check the IPv6 default route actually received by the client. Disabling DHCPv4 does not disable IPv6 router advertisements.
Find the Config Entry Point
If the package provides
/etc/init.d/xray, first check which config arguments its startup script passes to the core. For a manual setup, you can use/etc/xray/config.json, but you must explicitly point the service to it. If the script generates a file from UCI or a config directory, edit its source instead of a temporary file that will be overwritten on restart.Test the Outbound First
For Xray versions that support it, test the config with
xray run -test -config /etc/xray/config.json. Substitute the actual file path, and checkxray help runon your device for the supported syntax. A successful test only confirms that the config loads. To test the outbound separately from transparent forwarding, temporarily expose an explicit proxy inbound on the router’s loopback address and send a request from the router itself. Remove the test inbound afterward.Route One Device Through the Side Router
In the test device’s IPv4 network settings, set the default gateway to the side router’s address, keeping a non-conflicting address on the same subnet and the correct subnet mask. Initially limit transparent interception to that device’s source address. Until the rules are ready, leave the main router’s DHCP gateway option unchanged and do not expose the test port to the WAN.
Transparent Forwarding: Listeners, Traffic Capture, and Policy Routing
An Xray listener only means a process is waiting for traffic on the device. With TPROXY, the firewall must also match selected traffic in the forwarding path and use packet marks with policy routing to send it to the local transparent inbound. OpenWrt has used nftables-based fw4 by default since 22.03, but custom firmware may differ. Check the active backend before choosing rule syntax. Do not mix an entire legacy iptables tutorial into a running fw4 ruleset.
| Check | What to verify |
|---|---|
| Transparent inbound | The transparent inbound port matches the firewall rules. Enable a method that preserves the original destination, and match only the TCP or UDP traffic that the inbound actually supports. |
| Marks and routing | The firewall mark, mark match in ip rule, and separate routing table must agree. The table needs a local-delivery route; marked traffic must not be sent back to the main router. |
| Direct connections and exclusions | Do not capture loopback, local management, or other destinations that should stay direct. If the rules also match traffic generated by the router itself, exclude the core’s own outbound traffic to prevent loops. |
| DNS and IPv6 | Check the DNS server used by the endpoint and its IPv6 default route separately. Changing only the IPv4 gateway does not change an IPv6 route the endpoint may have received from the main router. |
When troubleshooting, start a new connection and check the relevant rules. If a configured rule counter does not increase, check the endpoint’s gateway, ingress interface, and source address first. If the rule matches but the core receives nothing, check whether another rule overwrites the mark, whether policy routing is loaded, and whether the relevant protocol is listening.
Persist Config and Check Device Resources
After saving the config, confirm the startup script uses the same path. Then check “System” → “Startup” in LuCI to see whether the service is enabled, provided the package registered one. Temporary firewall changes may disappear after a reload; manage them through the existing fw4 persistence mechanism and verify them again after reloading. If your config references domain or IP rule lists, make sure the files are readable and in a directory the core actually searches.
df -h /overlay /tmp
free -m
logread -e xray
ip rule show
- Flash storage: On devices with
/overlay, note the available writable space before and after installation. The core, rule lists, and retained old files all use storage. Do not estimate upgrade headroom based on the downloaded package size. - Memory:
/tmpusually uses a memory-backed filesystem, so moving rule lists and logs there will not save RAM. Compare memory usage before startup, while idle, and during sustained browsing. If the process exits unexpectedly, check the system log for out-of-memory messages. - Logs: Use
logread -e xrayif the service sends logs to the system logger; if it uses a separate log file, check that file instead. Turn off verbose logging after troubleshooting to avoid recording excessive request details or filling writable storage.
Common Problems: Trace the Path from the Endpoint to the Side Router
The side router has internet access, but my computer isn’t using it. Why?
Check the computer’s default route and confirm its IPv4 next hop is the side router, not the main router. Also make sure the browser is not using a separately configured proxy. Test with a new connection and check whether OpenWrt logs a rule match for the computer’s source address. Do not treat a successful request from the side router itself as proof that the endpoint is routed through it.
Some websites load, but others keep spinning. What should I check?
First check the DNS address assigned to the endpoint and the results of A and AAAA lookups. Then test the same dual-stack site over IPv4 and IPv6 separately. If the results differ, check whether IPv6 is bypassing the side router. If the problem occurs only in apps that use UDP, check UDP interception and outbound support before changing rules for every domain.
It works when started manually, but stops working after a reboot. Why?
First, go to “System” → “Startup” and confirm the service is enabled. Then compare the config paths used by the startup script and the manual command. If the port is listening but requests are not reaching the core, check that the transparent rules and ip rule show are restored. Rules and policy routes added temporarily from the endpoint will not persist automatically.
I changed the gateway and now my printer can’t be found. What should I do?
First switch the endpoint back to automatic addressing and check whether device discovery and printing work again. If the endpoint and printer are on the same subnet, check the manually entered subnet mask for mistakes. If they are on different subnets, check routes, firewall zones, and the scope of the discovery protocol under the new gateway. Do not try to fix the problem by capturing more traffic.