· Platforms · About 8 min read

Running the V2Ray Core on a Secondary Router: Soft Router and Linux Mini PC Setup Guide

Learn how to split routing between your main and secondary routers, run the V2Ray Core, plan gateway and DNS settings, and share a network exit across your home.

At a glance

This guide is for home network administrators with an existing main router who want to add a soft router or Linux mini PC. Start by routing one device through a LAN proxy without changing the gateway for your whole home. Then decide which devices need the secondary router, and document where gateway, DNS, and fallback traffic should go.

Main and secondary routers: decide what handles forwarding

Keep your existing internet connection, LAN DHCP, and default gateway on the main router. Connect the Linux mini PC to its LAN, assign it a fixed local IP, and leave its default gateway pointing to the main router. The V2Ray Core accepts traffic sent to its inbound and selects an outbound according to its routing rules. Starting the core does not change other devices' default routes or take over their DNS queries.

Explicit proxy: connect devices as needed

Recommended

Enter the mini PC's address and the relevant port in apps that support proxies. Setting up a proxy in a browser does not mean other apps on the same device will use it; traffic from apps not configured to use the proxy continues through the existing gateway.

Best for: first-time setups, a few devices, and keeping existing network settings

Secondary gateway: route selected devices

Send traffic from selected devices to the mini PC first, then let the operating system's routing and firewall rules determine what reaches the core. Forwarding, return paths, and traffic capture each need to be tested separately. Changing a device's gateway alone will not automatically send its traffic to the proxy.

Best for: devices without proxy settings and networks where you can maintain gateway forwarding rules

Keep the main router's DHCP settings for now

If all apps that need the shared network exit can be configured to use a proxy, there is no need to switch the gateway for your whole home. Get one device working and test the fallback first; then decide whether to maintain a second forwarding path.

Run the V2Ray Core on a Linux mini PC: configuration and listener checks

First, make sure the core and its configuration come from the same implementation. v2rayN is a desktop client; v2rayNG and v2flyNG are Android clients that use the Xray and v2fly cores, respectively. This guide runs the V2Ray Core from V2Fly directly, without a graphical interface. A subscription URL or individual share link from a client is not a core configuration file. Do not reuse an Xray configuration just by renaming it; check its protocol, transport, and security-layer fields first.

192.168.50.1
Example main router address
192.168.50.2
Example mini PC address
10808
Choose a SOCKS5 inbound port
10809
Choose an HTTP inbound port

The ports in the table are planning examples, not core defaults. In this example, both devices are on 192.168.50.0/24. If your home network uses a different subnet, update the addresses and firewall source ranges together.

  1. Check the system environment

    Run uname -m to check the system architecture, such as x86_64 or aarch64, and choose the matching Linux core binary. In the main router's admin interface, use DHCP address reservation to assign a fixed address to the mini PC's wired network interface. Menu names vary by brand. After saving, reconnect the mini PC and verify its actual address to avoid setting a static IP that conflicts with the DHCP pool.

  2. Configure inbounds and outbounds

    In the V2Ray configuration's inbounds, declare the required inbound type, listen, and port. For local testing only, you can listen on 127.0.0.1. For LAN access, use the mini PC's LAN address and allow only trusted devices through the host firewall. Do not create a public port forward for the proxy port. Then check outbounds and the routing rules to ensure outboundTag points to an outbound that is actually defined.

  3. Validate before starting

    For example, with the V2Fly V2Ray v5 command line, check the configuration at the example path with v2ray test -c /etc/v2ray/config.json, then start it in the foreground with v2ray run -c /etc/v2ray/config.json. If the configuration references domain or IP rule databases, make sure the runtime account can read those files too. Passing the config check only confirms that the core accepts the configuration; it does not prove that the remote node is reachable.

  4. Test from one device

    On the mini PC, run ss -ltn to verify the listening address and port. If the test device's app labels its proxy option HTTP, enter 192.168.50.2:10809. Use the relevant inbound only if the app explicitly supports SOCKS5. Visit a known reachable site and check the core's access log, if enabled, or its error log. Once the connection works, configure startup with your system's service manager and test again after a reboot.

Plan and verify gateway and DNS separately

The gateway determines the next hop for packets; DNS determines where domain names are resolved. A device can use the proxy on the mini PC while keeping the main router as its default gateway and retaining its existing DNS settings. Conversely, changing a device's DNS to the mini PC will not automatically route web traffic through the proxy. The mini PC also needs a DNS listener that serves the device before it can accept queries.

Connection methodDevice default gatewayDevice DNS
Explicit proxy in an appKeep the main router: 192.168.50.1Keep the current settings at first, then check whether the app resolves names locally or sends them to the proxy
Secondary gateway pilotChange the test device only to 192.168.50.2Keep a reachable resolver at first; point DNS to the mini PC only if it provides DNS service

The dns field in a V2Ray configuration is for name resolution within the core. Adding this field alone does not start a DNS service on the LAN. If you deploy a separate resolver, run nslookup example.com 192.168.50.2 on a test device to check whether the specified server responds. Then run a query without a server address to check the device's current default settings. If an app uses its own encrypted DNS, verify the actual resolution path in the app as well.

Test and plan a fallback before expanding access

An explicit proxy is a good place to start with a minimal test. If you switch to a secondary gateway, also check that ordinary forwarded traffic and traffic routed through the core follow the expected paths. On the same subnet, the main router may send return traffic for some directly forwarded connections straight to the device, bypassing the mini PC. If you rely on a stateful firewall or NAT, verify traffic in both directions; seeing the first packet reach the mini PC is not enough.

Common questions about secondary router setups

Why isn't the core receiving requests after changing the gateways?

First check the device's actual default route, then see whether the mini PC receives the test traffic. If ordinary forwarding works but the proxy inbound has no connections, check whether the system has a rule that sends the intended traffic to that inbound. HTTP and SOCKS5 inbounds cannot accept arbitrary raw forwarded packets directly.

Why can the mini PC connect locally, but other devices can't reach its port?

First check whether ss -ltn shows only a loopback address, then verify the LAN address and firewall allowlist. If the test device is on a guest network, check whether wireless client isolation prevents it from reaching the main LAN. Do not disable the entire firewall to fix this.

The router's admin page opens, but websites don't. What should I check first?

Being able to reach the admin page only confirms that LAN access works. First run nslookup example.com to see whether the device can resolve the domain. If you're using an app proxy, check that the proxy type in the app matches the port, then check the core logs to see whether the inbound failed to connect or the outbound connection failed. Change one setting at a time and test again.

Do all devices in the home need to switch gateways at once?

No. Devices that support proxies can share an inbound on the mini PC while other devices keep using the main router. Switch devices one at a time only if they need gateway routing and you've tested the fallback. Before expanding the setup, note which devices will lose network access if the mini PC goes offline.

Download v2rayN