Advanced 12-minute read

How To Set Up TUN Mode In v2rayN For Windows Step By Step

Learn how to enable TUN mode in v2rayN on Windows. This beginner-friendly guide covers driver installation, administrator permissions, routing options, DNS c…

Enabling TUN mode in v2rayN changes the way Windows applications reach the proxy core. Instead of depending on an application’s own HTTP or SOCKS proxy fields, v2rayN creates a virtual network interface and captures traffic at the operating-system layer. This is useful for applications that do not provide proxy settings, command-line tools that ignore the Windows proxy switch, and software that needs more complete TCP and UDP coverage.

The setup is simple only when the boundaries are clear. TUN mode involves the v2rayN interface, the Xray core, a Windows virtual network driver, administrator permissions, local DNS behavior, routing rules, and possible conflicts with VPN or security software. A browser loading one website successfully is not enough to prove that transparent proxying is working. The correct test should confirm that the TUN adapter exists, the core is running, the intended route is active, and traffic from more than one application is entering the expected outbound.

Article overview

This guide walks Windows users through enabling TUN mode in v2rayN, installing or approving the required Wintun driver, granting elevated permissions, checking local ports and routing, and verifying transparent proxy traffic. It also explains why a successful browser test may still leave DNS, UDP, or command-line traffic incorrectly routed.

Prepare Windows and v2rayN before changing the mode

Start with a v2rayN build that supports TUN mode on your Windows architecture and includes a compatible Xray core. The exact menu wording can differ between v2rayN releases and between classic and newer interface layouts, so look for entries containing TUN, virtual network adapter, Wintun, or core settings. Do not assume that downloading the v2rayN executable automatically means that the TUN driver is already installed. The client and the virtual adapter driver are separate components.

Open v2rayN and first verify ordinary proxy operation. In the server list, select a known-working node, use the command for making it active, and start the core if it is not already running. Confirm that the log window does not show an immediate startup failure. In the normal system-proxy mode, open a test website and check that the connection is stable for at least one or two minutes. This separates a node or core problem from a TUN problem.

Windows baseline

Platform
Windows 10 or 11, 64-bit
Permission
Administrator approval when requested
Adapter
Wintun virtual network driver
Safety
Disable competing VPN adapters temporarily

The Windows account must be allowed to create or modify a virtual network interface.

v2rayN baseline

Client
Current v2rayN 7.x build
Core
Xray selected and executable
HTTP port
Usually 10809
SOCKS port
Usually 10808

Port numbers are examples; use the values shown in your own v2rayN settings.

Before enabling TUN, inspect the local listening ports under the v2rayN settings or status area. Many installations use SOCKS5 on 127.0.0.1:10808 and HTTP on 127.0.0.1:10809, but these values are not universal. TUN mode does not require every application to be manually pointed at those ports. They remain useful for diagnosis, while the virtual adapter becomes the main traffic entry point.

Also decide whether you want the TUN interface to handle all traffic or only traffic selected by routing rules. A global proxy route is easier to test, but it can send local devices, private addresses, update services, and latency-sensitive applications through the proxy. A rule-based setup is safer for long-term use, but it requires correct direct, proxy, and block rules. For the first test, use a simple known route and add exceptions only after the adapter has been confirmed to work.

Practical conclusion: validate the node first

TUN mode cannot repair a stopped Xray core, an expired subscription, or an incorrect VLESS or VMess profile. If ordinary system-proxy mode cannot reach a test site, fix the node and core before changing the Windows network layer.

Enable TUN mode through the v2rayN interface

With v2rayN open, enter the settings area and locate the section named something similar to Parameters Settings, Core Settings, Routing Settings, or TUN Mode. In many builds, the path begins with Settings → Parameters Settings. The control may be presented as a checkbox, a mode selector, or a separate command in the tray menu. If you cannot find it, update the client or confirm that the selected core supports TUN operation; do not create a random JSON file in the program directory and expect the graphical client to load it.

Enable the TUN option and review the related fields before saving. The important choices are the core type, virtual adapter implementation, stack mode, DNS handling, automatic route installation, and whether IPv6 should be included. Xray must be the selected core if the TUN configuration is written for Xray. A configuration generated for one core should not be assumed to work unchanged with sing-box or another engine.

  1. Select a working core

    In v2rayN, open Settings → Parameters Settings and set the core type to Xray if your TUN profile is intended for Xray. Confirm that the core executable starts without an error.

  2. Open TUN options

    Find the TUN or virtual-adapter section. Enable the TUN switch, then review automatic route installation, DNS capture, and IPv6 handling instead of accepting every option blindly.

  3. Approve the driver

    When Windows asks to install or allow the Wintun network driver, approve the request. If the prompt does not appear, restart v2rayN as administrator and repeat the enable action.

  4. Apply and restart

    Save the settings, stop and restart the core, and allow v2rayN to recreate the virtual adapter. Watch the log for adapter creation, route installation, and startup errors.

  5. Test one application

    Open a browser or terminal after the adapter is active. Verify one proxied destination and one local destination before adding more routing rules or enabling IPv6.

Automatic route installation is normally required for transparent capture. Without routes pointing traffic toward the TUN interface, the adapter may appear in Windows while applications continue using the physical network adapter directly. Conversely, overly broad routes can capture traffic needed to reach the node server itself, creating a loop. A correct configuration must preserve a direct path to the proxy server address and to essential local gateway functions.

DNS capture deserves separate attention. If a browser resolves a domain through the physical adapter before the core sees the request, domain-based routing and FakeDNS behavior may not match your expectation. TUN mode should therefore be tested with the DNS settings intended by the selected configuration. Do not add a public DNS address merely because it is familiar; the DNS server, routing rules, and remote resolution strategy must be compatible with the core profile.

Install Wintun and grant the permissions TUN needs

Windows TUN mode depends on a virtual network interface. In common v2rayN deployments, that interface is provided by Wintun. Wintun is not a proxy protocol and does not carry traffic by itself; it gives the core a virtual adapter through which captured packets can be read and written. The client still needs a working Xray configuration and a valid outbound connection.

When the driver is missing, v2rayN may display a prompt, log an adapter-creation error, or silently fail to activate the TUN switch. Run v2rayN with Run as administrator for the first installation or repair attempt. This helps Windows approve driver registration, adapter creation, route changes, and firewall-related prompts. After the driver is installed, some operations may work without elevation, but route and adapter behavior depends on the Windows security policy and the client build.

Open Settings → Network & Internet → Advanced network settings in Windows and inspect the list of network adapters after enabling TUN. The exact adapter name can vary, but it should be possible to identify a new virtual interface associated with Wintun or v2rayN. The adapter should not remain permanently disabled. If it appears and disappears each time the core restarts, compare the timestamps with the v2rayN log and check whether another network program is removing it.

Expected sequence:
v2rayN starts
    ↓
Xray core starts
    ↓
Wintun adapter becomes available
    ↓
Routes and DNS capture are applied
    ↓
Applications send traffic through TUN
    ↓
Xray selects direct, proxy, or block outbound

Security software can interfere at several points. Endpoint protection may block unsigned-looking driver operations, firewall rules may reject the new interface, and another VPN may continuously rewrite the default route. Temporarily pause only the competing network feature for diagnosis; do not permanently disable Windows security protections. After testing, restore the protection and create the narrowest allowed rule that permits the v2rayN core and Wintun adapter to operate.

If the adapter is present but no traffic passes, check whether Windows has assigned an address and whether the route table changed after activation. Use a normal Command Prompt or PowerShell window to inspect the result:

ipconfig
route print
netstat -ano | findstr "10808 10809"

The first command helps confirm the virtual interface, the second shows whether routes were installed, and the third checks whether the local proxy ports are listening. A listening port does not prove TUN capture, but a missing core process or a port already occupied by another program is an immediate local fault.

Why did Windows show no driver prompt?

Restart v2rayN with administrator rights, disable TUN, enable it again, and inspect Advanced network settings for a Wintun-related adapter. If another VPN owns a similar virtual adapter, close it during the installation attempt.

The adapter exists, but websites time out. What now?

Check the Xray log, confirm that the active node works in system-proxy mode, and run netstat -ano for the configured local ports. Then check whether the route to the node server is being captured back into the TUN interface.

Should IPv6 be enabled immediately?

No. First validate IPv4 traffic. Enable IPv6 only when the node, routing rules, DNS behavior, and firewall path support it; otherwise IPv6 can bypass the intended proxy or create apparent partial connectivity.

Can I keep another VPN connected?

It may be possible, but both clients can compete over routes, DNS, and adapter priority. Disconnect the other VPN during initial setup, then reintroduce it only after you understand which application owns the default route.

Verify transparent traffic instead of testing only the browser

Once TUN mode is active, turn off the Windows system proxy temporarily for the first transparent-traffic test, or at least record its previous state. This prevents a browser from reaching the internet through the ordinary HTTP or SOCKS listener while the TUN path is actually broken. Close and reopen the application after changing the mode because some applications cache proxy settings, DNS answers, or existing connections.

Begin with a domain that should use the proxy outbound. Observe the v2rayN log while loading it. A successful result normally includes an accepted connection, a routing decision, and an outbound connection. The exact wording depends on the Xray version and log level. If the page loads but no corresponding connection appears in the core log, the browser may be using an existing connection, a separate proxy, or a cached response.

Next test a local destination, such as the router management address or another device on the LAN. A private address such as 192.168.1.1 should normally remain direct unless your policy intentionally sends it elsewhere. This test checks whether private-network bypass rules are present. If local management pages become unreachable, place private IP rules before the broad proxy fallback and restart the core after applying the change.

Transparent-path checks

Adapter
Wintun is enabled
Route
Traffic points to TUN
System proxy
Disabled for isolation test
Log
Connection appears in Xray

These checks show whether an application is entering the core without manual proxy fields.

Policy checks

Remote site
Uses proxy outbound
Private LAN
Uses direct outbound
DNS
Follows the selected chain
Fallback
Broad rule remains last

A working adapter can still produce the wrong result when routing order is incorrect.

Use a second application that does not inherit browser proxy settings, such as PowerShell. A command like curl.exe can help compare direct and TUN behavior, but remember that a command may use DNS and connection behavior different from a browser. Check the v2rayN log at the same time. For UDP-dependent software, do not infer success from a TCP webpage; validate the actual UDP requirement and confirm that the chosen core and route support it.

DNS leak testing also needs a careful interpretation. A DNS request may be sent directly, captured by TUN, resolved remotely, or handled through a FakeDNS mapping, depending on the configuration. Seeing a resolver address in a test report does not by itself identify the entire proxy path. Compare the DNS settings, Xray DNS log entries, and routing rules. If the goal is domain-based routing, confirm that the core receives the original domain rather than only an already-resolved IP address.

Troubleshoot failures in a fixed order

When TUN mode breaks connectivity, avoid changing the node, DNS server, route rules, and adapter settings at the same time. Disable TUN and return to system-proxy mode first. If ordinary proxy traffic is also broken, investigate the core or node. If ordinary proxy traffic works, enable TUN again and change only one TUN-related setting per test.

common local errors:
failed to open TUN device
access is denied
bind: Only one usage of each socket address
route add failed
failed to start core

access is denied usually points to insufficient permission for adapter or route operations. bind: Only one usage of each socket address indicates that another process already occupies the configured local port; identify it with netstat -ano and either stop the conflicting process or choose an unused port in v2rayN. A route-add failure can result from a disabled adapter, an existing VPN route, or a Windows policy restriction.

After every correction, record three facts: whether the adapter is present, whether the core remains running, and whether a new test connection appears in the log. This creates a clear fault boundary. When TUN mode finally works, export or back up the relevant v2rayN configuration, note the working core and driver state, and avoid enabling multiple experimental DNS or IPv6 options without a specific reason.

Final rule: prove the path, not just the page

A successful webpage proves that one application obtained content. A reliable TUN setup is demonstrated by the combination of an active Wintun adapter, installed routes, a running Xray core, visible log entries, correct private-network bypass, and consistent behavior from applications that have no manual proxy configuration.

Download v2rayN