· Advanced · About 9 min

v2rayN TUN Mode Setup: Route All Traffic Through a Virtual Adapter

Learn how v2rayN TUN mode differs from system proxy settings, what permissions it needs, and how to configure routing and DNS for full-device traffic capture.

At a Glance

v2rayN is a desktop client. TUN captures traffic from apps that don't use the system proxy. This guide focuses on Windows: verify a node first, grant the required permissions, enable the virtual adapter, then check routing. It also covers DNS, LAN access, and restoring your network after exiting. Authorization differs across desktop platforms, so don't apply Windows administrator steps elsewhere.

1. TUN Virtual Adapters vs. System Proxy

A system proxy gives apps a proxy endpoint. Browsers and other apps that respect system settings send requests to a local proxy port. Apps that make connections on their own or ignore those settings may connect directly. So if a browser works but a command-line tool doesn't, the node may be fine—the two apps may simply be using different network paths.

TUN creates a virtual interface at the system network layer and uses routing rules to pass matching IP packets to the proxy core. Apps usually don't need a proxy address configured individually. “Full traffic capture” describes which traffic enters TUN; it doesn't mean every connection must go through a remote node. Connections entering TUN can still be routed directly, proxied, or blocked according to your rules.

App sends a request System routing directs traffic TUN adapter captures it Rules select a route Direct or proxied

v2rayN handles the interface, configuration generation, and process management; the core handles traffic forwarding. Common desktop releases use sing-box for TUN, though the exact combination depends on the version and configuration. Enabling TUN does not automatically enable every Xray feature. VMess and VLESS are node protocols; REALITY is a secure transport. None of them is a virtual network adapter driver, and switching to TUN doesn't require you to generate a new subscription.

What to checkSystem proxyTUN mode
Traffic entry pointApp proxy settingsSystem routing and virtual interface
App requirementsMust read or be manually configured to use the proxyUsually requires no app-specific configuration
UDP supportDepends on the proxy endpoint and app; an HTTP proxy alone won't cover all trafficAlso depends on the core, node, and server
PermissionsUsually doesn't require creating a virtual adapterRequires permission to create an interface and modify routes

2. Before You Start: Check Your Node, Permissions, and Local Proxy

Turn off TUN and use the system proxy to verify that a node can open an HTTPS site. Adding a virtual adapter only adds more variables if the node itself isn't working. For help importing a subscription, see the subscription setup guide. If the connection fails, start with the log-reading tips in Troubleshooting.

  1. Note your current settings: Record the active node, routing mode, local listening ports, and custom DNS settings. Keep subscription URLs and node credentials on your own device; don't post them publicly.
  2. Disconnect other network-routing tools: Temporarily turn off other VPN connections and tools that modify the default route. If your organization requires remote access, check whether network changes are allowed first.
  3. Check permissions: On Windows, exit v2rayN completely, right-click the app, select “Run as administrator,” and approve the prompt. Closing the window may only minimize the app to the tray; use the tray menu to exit.
  4. Check the app files: If the log reports a missing TUN-related core or driver file, use a complete release package for your system architecture. Don't download individual DLLs from untrusted sources.
10808
Example local proxy endpoint; check your actual settings
53
Common destination port for traditional DNS
443
Common destination port for HTTPS

These three numbers distinguish the local proxy endpoint, DNS lookups, and website connections. They are not firewall ports that all need to be opened. In particular, don't change the local listening address from 127.0.0.1 to 0.0.0.0 just to troubleshoot. TUN captures apps on this device; it doesn't require exposing the proxy endpoint to your LAN.

3. How to Enable TUN in v2rayN

Menu locations vary between desktop versions. In many builds, look under “Settings” → “Parameter Settings” for “TUN Mode Settings”; the main window may also have an “Enable TUN” switch. Follow the feature names rather than a specific screenshot. If you can't find the option, check your version and platform instead of changing unfamiliar fields based on instructions for another release.

  1. Select a verified node. Confirm the active node is correct and that a website loads through the system proxy.
  2. Use one network path at a time. Set the system proxy to “Clear system proxy” while leaving the client core running. A brief loss of access to proxied destinations is expected; TUN will take over in the next step.
  3. Keep the default TUN settings. When enabling TUN for the first time, don't change the stack, MTU, interface name, and DNS policy all at once. Start with the defaults for your version to establish a repeatable baseline.
  4. Turn on “Enable TUN.” Check the logs for interface creation, core startup, or route initialization. An enabled switch only reflects the UI state; test an actual connection to verify TUN is working.
  5. Check for the virtual interface. In Windows, open “Settings” → “Network & Internet” → “Advanced network settings” to view network adapters. You can also use the read-only commands below.
  6. Test before making changes. Confirm websites and the target app can connect, then restore custom routing settings one at a time. Test after each change to avoid altering multiple variables at once.
Get-NetAdapter | Select-Object Name, InterfaceDescription, Status
Get-NetRoute -AddressFamily IPv4 |
  Sort-Object RouteMetric |
  Select-Object -First 20 DestinationPrefix, InterfaceAlias, NextHop, RouteMetric

Run the commands above in PowerShell; they only read adapter and route information. Interface names vary by core, and traffic capture may use multiple, more-specific route prefixes. Don't judge success only by whether a 0.0.0.0/0 route appears. Check the interface status, startup logs, and actual connection logs together.

4. Configure Routing and DNS Together

Keep sensible traffic rules after enabling TUN. LAN devices, corporate network resources, and connections to the node server itself need the right route. Sending every address back through the proxy endpoint can create a routing loop. Common versions handle interface selection or bypassing for proxy outbound traffic, but custom configurations, multiple virtual adapters, and complex policy routing can still disrupt this behavior.

Routing checklist

Local network
Make sure private addresses and the actual LAN subnets use a direct route
Proxied destinations
Match proxy traffic using the active rule set
Default route
Specify how unmatched traffic should be handled
Node connection
Prevent connections to the node server from looping back through the proxy

Start with the built-in routes, then add only the LAN subnets you actually need.

DNS checklist

Direct DNS
Choose a resolution path reachable on the current network
Proxied DNS
Make sure the DNS server is reachable through the chosen outbound route
Initial resolution
Node hostnames must not rely on a proxy connection that hasn't been established yet
IPv6
Make sure DNS results match the network's actual IPv6 routing capability

Keep the default DNS setup while troubleshooting; adjust it only after you have a working connection.

A common DNS pitfall is a dependency loop: the node hostname must be resolved before connecting, but the DNS request is configured to go through that same node. Give the node hostname a working initial resolution path instead of repeatedly switching public DNS servers. With encrypted DNS, also consider how the DNS server's own hostname gets resolved initially.

5. Verify TUN Is Working—Don't Just Check the Switch

Test both traffic capture and correct routing. First, clear the system proxy and make sure the target app has no proxy configured manually. Then visit a known-working site. Otherwise, a successful browser test may simply use the old proxy endpoint and won't prove that TUN is capturing traffic.

  1. Test HTTPS: Open an accessible HTTPS site and check whether the corresponding connection appears in the client logs. Browser cache can hide a connection failure; if needed, load a page you haven't visited before.
  2. Test the target app: Open an app that doesn't normally use the system proxy, then check its connection and the client logs. Don't assume the host's TUN will capture traffic from a virtual machine or container with its own network.
  3. Test routing rules: Visit a LAN address that should go direct and a domain that should use the proxy, then compare the matched rules and outbound routes in the logs. A public IP lookup shows only the route used for that request, not the route used by every app.
  4. Test UDP: Check UDP only if the target app needs it. A working TCP connection to a website doesn't prove UDP works; server policies or node transport capabilities may limit it.
curl.exe --noproxy "*" -I --connect-timeout 10 https://example.com/

Don't treat one latency test as a speed verdict. Latency shown in a node list usually reflects a specific probe, not video throughput or game round-trip time. For a useful comparison, keep the node, network, and destination the same, and switch only between system proxy and TUN to isolate the difference.

6. Common Questions: No Internet After Enabling TUN

The internet stops working as soon as I enable TUN. What should I change first?

Turn off TUN and restore the system proxy to verify the node. If connectivity immediately returns, check administrator permissions, virtual interface creation, and route conflicts. If it still fails, check the node and local core first. Change one thing at a time; don't start by deleting every network adapter.

The log says “access denied.” Will restarting the app help?

The app may not have elevated permissions. Exit it completely from the tray, then run it as administrator. If the error persists, check whether access was denied when creating an interface, modifying routes, or reading a file. On managed devices, check security policies; don't disable the entire firewall as a test.

Websites work, but my printer and company network are unreachable. What should I check?

Make sure private addresses use a direct route and check which subnets your company actually uses. Some corporate networks require additional routes or dedicated DNS, so covering only the common private ranges may not be enough. Turn off TUN to compare, then add routes that meet your organization's network requirements.

The logs keep showing DNS timeouts. Switching nodes didn't help. What now?

Restore the default DNS configuration for your version and make sure your local network and DNS outbound route are reachable. Check for an initial DNS resolution loop with the node hostname, then review browser secure DNS and IPv6 settings. A failed ping alone doesn't prove DNS or the proxy is down; the destination may not respond to ICMP.

TUN stopped working after waking from sleep. Do I need to reinstall?

Turn TUN off and back on so the core can detect the physical interface again. Switching Wi-Fi, plugging in or unplugging Ethernet, and waking from sleep can change the outbound interface. If it still fails, exit the client normally and restart it. Keep the logs from before and after the network change; there's no need to reinstall right away.

7. When to Use TUN and How to Exit Safely

If only your browser needs a proxy, the system proxy is usually enough and requires less setup. Consider TUN when several desktop apps ignore system settings, you need consistent traffic routing, or an app requires UDP. TUN expands which traffic is captured; it won't increase node bandwidth or fix an unreachable server, expired subscription, or incorrect protocol settings.

The success criteria are simple: with the system proxy cleared, the target app still connects as expected, destinations meant to go direct stay direct, and your system network works normally after exit. Once all three are true, add custom rules gradually; they're easier to maintain than a complex setup from the start.

Download v2rayN · Choose a platform