Running a proxy on a router is not about installing a desktop client on a smaller device. The core, system routing, firewall, and DNS must work together. This guide is for users with a working connection configuration who want to route traffic for their LAN: compare primary-router and secondary-router setups, check CPU architecture and available resources, then verify the forwarding path with one test device. That way, a change to the network gateway won’t leave the entire LAN without an easy way to troubleshoot.
Routers run the core, not a desktop client
v2rayN is a desktop client for managing configurations and connections. v2rayNG is an Android client that uses the Xray core, while v2flyNG uses the V2Fly core. These clients provide subscription management, configuration generation, and a user interface. Routers typically run the Xray or V2Fly command-line program directly, with startup handled by the firmware’s service manager. A desktop client’s “System Proxy” toggle does not enable proxying for every device on a router.
The core accepts inbound connections, applies routing rules, and establishes outbound connections. System forwarding, firewall rules, and policy routing determine which device traffic reaches the core. Starting the process alone—even if the logs show that it is listening—does not mean TVs, computers, or other devices on the same subnet are using the proxy.
- Explicit proxy settings: Enter the router’s address and SOCKS or HTTP port in a proxy-enabled app. Start with one app to keep the scope of changes small.
- Transparent proxying: Redirect selected traffic to the core using mechanisms such as redirection or TPROXY. This requires compatible system modules, firewall rules, and inbound settings.
- Per-device routing: Choose which devices or subnets to intercept, then let the core’s domain and IP rules determine the outbound route.
Primary router or secondary router: assess the impact of failure first
The primary router usually handles the internet connection, address assignment, default gateway, and firewall. Centralizing everything can make the traffic path more direct, but a core update, forwarding-rule change, or memory shortage could affect the entire LAN. A secondary router puts proxy functions on a separate device, preserving the primary router’s basic internet access. The tradeoff is that return traffic, address assignment, and DNS need more deliberate planning.
Secondary router: start with one test device
RecommendedKeep the primary router responsible for the internet connection and DHCP. Change only the test device’s gateway or proxy settings. If anything goes wrong, switch that device back to the primary router. This makes it easier to test each step without affecting other devices.
Best for: users with a stable primary router who are trying gateway-based routing for the first time and need a clear rollback path
Run the core directly on the primary router
Traffic interception and egress are handled on one device, making forwarding easier to manage centrally. However, you must keep a way to access the router for administration and ensure the CPU, memory, storage, and firmware modules can handle the additional workload.
Best for: users familiar with the firmware firewall who can restore the configuration and schedule maintenance
Example setup: keep the primary router and test a separate secondary router
Primary router: 192.168.10.1
- Continues to handle internet access and DHCP.
- Reserve 192.168.10.2 for the secondary router to avoid an address conflict.
- Leave other devices’ default gateways unchanged for now.
Secondary router: 192.168.10.2
- Set its default route to 192.168.10.1.
- Enable IP forwarding and configure the firewall if traffic needs to be forwarded.
- Configure the test device to use the gateway and DNS service required by the setup.
These addresses are examples for devices on the same subnet. Before applying them, check your network’s subnet, DHCP pool, and existing static addresses.
A secondary router with one network port can work, but you must account for return traffic: direct traffic may return to the device through the primary router, bypassing the secondary router. Decide whether source NAT is needed based on connection tracking, firewall rules, and return routes; don’t copy a generic rule without checking. Multiple network ports do not automatically solve configuration issues. Make sure you can explain the ingress, egress, and return path at every hop.
Choosing hardware: match the architecture, leave enough memory, and account for storage writes
Check the device’s system details before choosing a binary. A processor’s product name alone does not establish compatibility: check the ARM bitness and instruction set, or the MIPS endianness and build requirements. A 64-bit-capable processor does not mean the firmware has a 64-bit userland. Dynamically linked programs also depend on the system libraries and loader. If you see “cannot execute,” check compatibility before suspecting the node or subscription.
# Check system details and resources in the device terminal; command options vary by firmware
uname -m
uname -a
free -m
df -h
ip route show
ip -6 route show
| Check | What to verify | Why it matters |
|---|---|---|
| CPU and system | For example, aarch64, armv7l, or x86_64; also check the firmware package architecture | Determines which core builds can run; the device model alone is not enough |
| Available memory | Check metrics such as available before startup, after loading rules, and as connections increase | Rule sets, connection counts, DNS cache, and other services all use memory |
| Writable storage | Check the partitions containing the core, rule files, temporary update files, and logs | Downloading new files and replacing old ones may require extra space |
| System capabilities | Firewall backend, policy routing, and required transparent-proxy modules | Determines how traffic can be intercepted; confirming that the program starts is not enough |
| Network and cooling | Port speed, driver stability, temperature under sustained load, and CPU usage | Affects long-term stability; throughput cannot be estimated from core count alone |
When buying a device, use 512 MB or more as an initial screening point for a lightweight gateway, and reserve 1 GB or more for setups running several services. These are resource-planning guidelines, not minimum requirements or performance guarantees for the core. Existing devices with less memory may still work with a lean configuration, but reduce unnecessary rules and background services, and watch for processes being killed due to memory pressure. Swap space is not a substitute for insufficient memory.
Make the call: test with your intended rule set before upgrading hardware
On the same device, record resource use when idle, after loading rules, and during typical use by multiple devices. If the core reports no errors but CPU usage stays high, check encryption and forwarding load. If the system kills the process, start with the memory logs. A slow node connection alone does not prove the router lacks capacity.
Ports, DNS, and transparent proxying: test each part of the path separately
A working explicit proxy is a useful starting point, but it does not prove that transparent proxying is configured correctly. Start with a SOCKS inbound bound for testing only, verify outbound traffic with one app, then add gateway forwarding. The three ports below are examples of different roles, not universal defaults for any client or firmware. Use the configuration and system output to confirm the actual listening ports.
- Check the listening address: If the service listens only on
127.0.0.1, other devices on the LAN cannot connect to it directly. If you need to offer a LAN proxy, bind to an appropriate address and restrict access with the firewall. Never expose proxy ports to the internet. - Exclude the proxy’s own traffic: Make sure interception rules do not recapture outbound connections opened by the core. Depending on the setup, exclude traffic by process, user, mark, or destination address, and ensure the server address remains reachable.
- Handle TCP and UDP separately: A redirection method that supports TCP does not necessarily handle UDP. TPROXY also requires policy routing and the appropriate modules; adding a port-forwarding rule alone is not enough.
- Plan the DNS bootstrap path: Decide how the server hostname is resolved before deciding where queries for other domains should go. If establishing the proxy requires resolving a hostname, but DNS can only work through that proxy, startup will get stuck in a dependency loop.
- Test IPv6 separately: If you configure rules only for IPv4, IPv6 connections may take a different path. Decide whether to route IPv6 traffic and check the routes and DNS information advertised to client devices.
Migrate the connection settings; rebuild the router’s local configuration
A working node in a desktop client can be a reference for migration, but don’t copy the entire configuration to the router. A runtime configuration generated by v2rayN may contain local ports, file paths, or client-management fields. Subscription data may not be a core-ready JSON configuration either. Separate server connection parameters from local runtime settings, then rebuild the configuration to match the target core’s specification.
- Record the connection details: Address, port, protocol, identity parameters, transport, and security layer. Check fields such as TLS serverName, WebSocket path and Host, and the REALITY server public key and shortId against your setup. These fields are not interchangeable.
- Check the target core: Confirm that it supports the protocol, transport, and security-layer combination. Importing a subscription into one client only proves that client can handle it; it does not mean another core accepts the same configuration.
- Rebuild the local configuration: Set the listening address, inbound ports, routing rules, and DNS. Update rule-file references to valid paths on the device. Check that the service user has permission to read the files and perform the required operations.
- Validate before enabling: Use the core’s configuration test command to check fields and referenced files, then start it in the foreground and review the logs. A successful test only confirms that the configuration loads; you still need to test a real connection.
- Add service management last: Let the firmware’s native service manager start and restart the core. Don’t configure multiple startup methods. Record the backup location, recovery steps, and how to stop the service.
# Assuming the executable is named xray and the configuration is stored at this path
# Check the help output to confirm which command options this build supports
xray help run
xray run -test -config /etc/xray/config.json
# After validating the configuration, start in the foreground and review the logs
xray run -config /etc/xray/config.json
When using V2Fly, check the help output for that specific build. Don’t assume Xray commands or fields are universal. Automatic subscription updates are not a built-in feature that comes with starting the core; they require a controlled workflow to fetch, convert, validate, and replace configurations. If an update fails, keep the last working configuration rather than overwriting it with an empty result.
Common issues: find the broken link before changing the configuration
Change one variable at a time. First confirm that the device itself can resolve names and make outbound connections. Then test the core connection, and finally check forwarding from the client device to the gateway. If you change DNS, routing rules, and protocols all at once, you’ll have a hard time finding the cause—even if service comes back—and won’t know whether the setup will survive a reboot.
The program says it cannot execute. Did I download the wrong file?
Run uname -m and check the firmware package architecture first. Then verify execute permissions, the dynamic loader, and runtime library requirements. “Exec format error” usually points to an architecture or file-format issue, before any connection attempt; there’s no need to change server parameters yet.
The secondary router connects, but a computer using it as its gateway can’t load websites. What should I check?
Check IP forwarding, firewall forwarding rules, the default route, and the return path. Then use the computer to connect explicitly to the example SOCKS port, 1080. If that works, troubleshoot the transparent-proxy path before importing the node again. Test DNS, TCP, and UDP separately afterward.
Only some websites have problems. Should I switch protocols?
First check which rules match, the DNS responses, and the IPv6 path. Look for destinations incorrectly routed directly, UDP traffic that isn’t intercepted, or an MTU issue. Comparing explicit proxy and transparent proxy behavior on the same device will help pinpoint the problem more than switching protocols straight away.
It stops working after every reboot. Should I add another startup script?
Check the service status, startup logs, and configuration file permissions first. Then confirm that the network, time synchronization, and rule files are ready when the service starts. Avoid duplicate startup methods that can cause port conflicts. Fix the existing service’s dependencies and configuration paths instead of adding a second process.
Before going live: verify recovery as well as connectivity
Before adding more devices, test a device reboot, stopping the core, and restoring a configuration. Make sure the test device can switch back to the original primary router and that the admin page remains accessible. Then adjust DHCP options gradually. Don’t combine your first network-wide interception with your first upgrade.