Read the complete guide

V2Ray Advanced Config: Subscriptions, Routing, DNS, and TUN

Starting with the relationships between configuration objects, this guide covers subscription groups, server filters, routing rules, DNS, TUN, FakeDNS, multiple subscriptions, and custom outbounds. Examples focus on v2rayN, with the corresponding entry points for v2rayNG and v2flyNG.

8 configuration topics v2rayN desktop v2rayNG Android v2flyNG Android

Reading path:Getting Started covers the quick path for importing subscriptions, choosing a server, connecting, and verifying the connection. This page explains why each advanced setting is configured the way it is, how rules are ordered, and which layer to check when something goes wrong. If you are new to the client, complete the quick start first, then use this guide to investigate specific issues.

01 / Configuration baseline

Build a configuration model before changing switches

V2Ray GUI clients are not a separate network protocol. v2rayN, v2rayNG, and v2flyNG handle subscription management, server selection, system interception, and UI controls; the core called by the client actually handles connections, routing, and DNS. A complete connection typically passes through five objects: application traffic enters a local inbound, the DNS module resolves the domain, the routing module evaluates the destination, the outbound module chooses a direct connection, proxy, or block action, and the selected server or local network sends the data. Advanced configuration is not about enabling more options; it is about defining each layer’s inputs and outputs.

Troubleshoot along the same chain. If a browser cannot reach a site, first confirm that traffic entered the client. If it entered but the domain resolves incorrectly, check DNS. If resolution is correct but the wrong route is selected, inspect the matched routing rule. Only after the rule matches correctly but the connection still fails should you check server parameters, server status, and the local network. Blaming every issue on the server often hides differences caused by the system proxy, TUN permissions, or DNS caching. For a layered diagnostic method, continue with the layered approach to slow connections.

Record a working state before making changes

Before adjusting anything, keep a baseline that connects successfully. Record the current subscription group, active server, system proxy state, routing mode, DNS mode, and TUN status. On the v2rayN desktop client, start with TUN disabled, system proxy enabled, and basic routing; the shorter path makes errors easier to isolate. On Android, begin with the client’s system-level network interception, confirm that one server connects, then add custom routing and FakeDNS. Reconnect and verify after each category of change. Do not change subscriptions, DNS, routing, and TUN all at once.

Verification should not rely solely on the client status. A client showing “running” only means that a local service or network interface has been created; it does not prove that the target application uses that entry point. Browsers generally follow the system proxy, some terminal programs require proxy environment variables, and certain apps enter the client only after TUN interception is enabled. Prepare three tests: a familiar webpage to check the browser path, a DNS query to confirm the resolution result, and a terminal request to confirm whether command-line applications inherit the system settings. If the system proxy has no effect, follow the steps in troubleshooting browsers and terminals separately.

Understand how UI settings relate to generated configuration

Options such as “Bypass LAN,” “Global,” “Rules,” “TUN,” and “FakeDNS” in the GUI are high-level settings used by the configuration generator. The client combines subscription servers, user rules, and core templates into a runtime configuration, so one UI change may modify inbound, DNS, and routing settings at the same time. Manual configuration snippets work only when placed in extension points supported by the client. Direct edits to temporary generated files are usually overwritten after a restart or server switch. Rules that need long-term maintenance should be saved through the client’s custom routing, DNS template, or configuration-file entry point.

Configuration layer Primary responsibility Typical symptoms First checks
Subscriptions and servers Provide server address, port, protocol, and transport parameters Authentication failure, connection timeout Subscription update time, server parameters, network reachability
Inbound interception Receive system proxy, application proxy, or TUN traffic Client starts but the application connects directly System proxy, application settings, TUN permissions
DNS Convert domain names into addresses and provide domain information to routing Resolution timeout, unexpected results Resolver, domain matching, cache
Routing Hand requests to proxy, direct, or blocked outbounds Destination takes the wrong route Rule order, domain policy, match logs
Outbound Perform proxy connections, direct connections, or local forwarding Handshake failure, upstream unreachable Outbound tag, server configuration, upstream port

Adopt a change rhythm that can be rolled back

Break adjustments into five steps: save a baseline, change one item, reconnect, verify, and record the result. Give rule files clear names such as “Basic Routing,” “Work Network Additions,” and “TUN DNS,” rather than creating a pile of indistinguishable copies. When something goes wrong, return to the baseline first and confirm that the basic connection still works before restoring advanced settings one by one. If the baseline also fails, the problem is more likely in the subscription, server, or local network than in the routing expression you just changed.

Note: The sample configurations explain structure only. Before importing one, confirm that the client supports the relevant fields and replace the domains, ports, and tags with your own values. Do not concatenate multiple complete configurations, because duplicate top-level fields can make the configuration fail to load.

02 / Subscription cleanup

Subscription groups and server filters

Subscriptions provide servers in bulk, but as the server count grows, selection becomes harder and mistakes become more likely. Effective organization does not mean putting every server into one long list. Group them by source first, then filter by purpose. v2rayN is well suited to keeping default groups, external subscriptions, and self-hosted servers separate. In v2rayNG and v2flyNG, subscription settings and note fields can distinguish sources. Keep group boundaries stable: server notes may change, but source, purpose, and maintenance ownership should not be mixed.

Give each subscription a recognizable name, such as “Daily,” “Testing,” or “Self-hosted.” Names should describe the source, not the current server status, because status changes over time. Keep manually added servers in a separate group instead of moving them into an automatically updated subscription group, where updates can make it difficult to tell whether they were overwritten. For subscriptions you no longer use, disable automatic updates and observe for a while before deleting the group; clearing it immediately also removes existing notes and selection history.

What should a filter solve?

Server filters narrow a long list of candidates. Common dimensions include note keywords, protocol type, transport, and subscription source. Filters should be explainable: after entering a keyword, users should be able to see from the server note why an entry matched. Complex regular expressions are flexible, but even small naming changes can cause entries to be missed. A more reliable approach is to keep notes in a consistent format within each subscription, then use region, purpose, or route category as keywords.

Filtering and routing are different tasks. Filtering determines which servers appear in the UI or are included in a batch test; routing determines which outbound handles a request after connection. Do not use server filtering as a substitute for traffic routing, and do not assume that a hidden server has been completely removed from the configuration. Some clients change only the displayed list; the active server may continue to work. Before deleting entries in bulk, confirm the selected items and group scope.

When to use keywords versus regular expressions

Simple keywords work well for everyday selection, such as filtering notes by “Work,” “Self-hosted,” or a protocol name. When you need multiple alternatives, use the regex alternation operator; when excluding test servers, use a negative condition, but validate it on a small set first. Filter entry points and regex support differ between clients, so before copying an expression, confirm whether it applies to the server note, address, or full display name. The expressions below illustrate general ideas and do not depend on any particular server count or speed data.

Work|Self-hosted
^(?!.*Testing).*
(VLESS|VMess|Trojan)

The first line matches entries whose notes contain “Work” or “Self-hosted”; the second excludes names containing “Testing”; the third filters by protocol terms in the display name. If a subscription uses a different naming scheme, inspect the actual notes before adjusting the expression. When no results appear, remove anchors and exclusions first to confirm that the basic keyword matches, then add constraints one at a time. Avoid writing a long expression immediately, or it will be difficult to identify which part caused the mismatch.

Handling updates, duplicates, and invalid entries

Update one subscription group at a time whenever possible. After updating, confirm that entries parsed correctly before switching the active server. The same server may appear more than once because its note differs, or because identical address and port values hide different parameters. When deduplicating, compare more than the domain and port: also check the user ID, protocol, transport, TLS settings, path, and other key parameters. Automatic deduplication is suitable for identical entries; when parameters differ, keeping both and renaming them is safer.

Invalid entries generally fall into three categories: temporarily unreachable, incorrectly configured, and withdrawn by the subscription source. One failed connection is not enough to declare an entry permanently invalid; try another local network or wait for the route to recover. Persistent protocol parsing errors call for checking whether the subscription uses fields unsupported by the current client. Entries that disappear after an update were usually withdrawn by the source, so copying them back into an automatically updated group is not recommended. Speed tests compare response under current network conditions; they are not a permanent ranking system.

Organization tip: Group by source first, filter candidates with keywords, then choose the active server manually. Groups solve maintenance, filters solve discovery, and routing rules solve traffic direction. Keep the three separate.

How the three clients differ in group management

v2rayN offers more desktop list space, making it suitable for managing multiple subscriptions, batch updates, and detailed filtering; it is also the preferred desktop client. v2rayNG uses a touch-friendly list, so keep the number of enabled subscriptions small, use short names, and retain clear prefixes. v2flyNG follows similar Android management habits, but it belongs to a different core family; after importing the same subscription, confirm that protocols and transport parameters were recognized completely. When reinstalling or changing platforms, choose the appropriate client on the download page.

After organizing subscriptions, perform a recovery check. Note the active subscription and server, update one group manually, confirm that the update does not change self-hosted servers, then restart the client to verify that the selection remains. If the active item changes after an update, check whether automatic selection is enabled or whether the current entry was replaced by the subscription. A subscription URL is an ongoing access credential and should not appear in public screenshots, logs, or shared rule files; for troubleshooting, report only the parsing result and error type.

03 / Traffic decisions

V2Ray Routing Rules in Practice

Routing rules send connections to a chosen outbound based on domains, IPs, ports, network types, inbound tags, or protocol characteristics. The most common outbounds are proxy, direct, and block. Rules are normally evaluated in order, with the first match taking effect, so order matters more than the number of rules when a destination satisfies several conditions. Before writing rules, state the operational goal—for example, “direct for LAN, a dedicated outbound for selected work domains, and baseline rules for everything else”—then translate it into match conditions.

A maintainable order usually moves from specific to broad: block clearly identified targets first, then handle LAN and private addresses, followed by user-selected domains and dedicated outbounds, then regional domain or IP rules, and finally the fallback. A broad rule at the top prevents later specific rules from ever matching. After editing, inspect routing results in the client log instead of judging only by whether a webpage opens.

Domain matching and domain strategy

Domain rules can match an exact domain, a domain suffix, or a predefined domain set. Exact matching suits a single service; suffix matching covers all subdomains, so evaluate its scope carefully. For example, a suffix rule for example.com also affects api.example.com and static.example.com. If a service distributes its pages, APIs, and static assets across different domains, adding only the main domain may load the page shell while its resources fail.

domainStrategy determines whether routing resolves a domain into an IP address for matching. With AsIs, routing keeps the original domain and does not proactively resolve it for IP rules; IPIfNonMatch resolves the domain when no domain rule matches, then tries IP rules; IPOnDemand triggers resolution earlier when IP matching may be needed. Start with IPIfNonMatch in most cases: it supports both domain and IP rules without resolving every request in advance. If DNS is incomplete, strategies that rely on IP matching may increase resolution failures, so validate routing and DNS together.

Basic rule structure

{
  "routing": {
    "domainStrategy": "IPIfNonMatch",
    "rules": [
      {
        "type": "field",
        "ip": [
          "geoip:private"
        ],
        "outboundTag": "direct"
      },
      {
        "type": "field",
        "domain": [
          "full:intranet.example",
          "domain:office.example"
        ],
        "outboundTag": "direct"
      },
      {
        "type": "field",
        "domain": [
          "domain:service.example"
        ],
        "outboundTag": "proxy"
      },
      {
        "type": "field",
        "network": "tcp,udp",
        "outboundTag": "proxy"
      }
    ]
  }
}

The example sends private addresses directly, handles two internal domains, routes one service through a proxy, and uses TCP and UDP rules as a fallback. full: matches only the complete domain, while domain: matches that domain and its subdomains. The domains are included for syntax demonstration only. In a real configuration, outbound tags must exactly match the configured tag; spelling differences are not mapped automatically and generally cause configuration loading to fail or leave the rule without a target outbound.

Ports, network types, and inbound tags

Port rules can send a particular service to a designated outbound, but a port is not an application. Many modern applications use common encrypted ports, so ports alone cannot distinguish traffic. network distinguishes TCP and UDP; after enabling TUN, pay particular attention to UDP because DNS, real-time communication, and some transports use it. If the selected server or upstream outbound cannot handle UDP, route necessary UDP traffic directly or change the DNS transport to reduce the dependency. Do not assume that disabling UDP has no effect on the application.

inboundTag distinguishes different local entry points. For example, you can create one inbound for the browser and another for system traffic, then route them to different outbounds. This design is useful for testing and isolation, but whether a GUI client exposes multiple inbounds depends on its configuration mode. When the client generates the configuration, inspect the actual inbound tags rather than copying names from another environment. If the tag is correct but the rule does not match, check whether traffic entered through the system proxy or the TUN inbound.

Verify that a rule matches

Verify rules in three steps. First, temporarily move the target rule ahead of broad rules so it cannot be intercepted early. Second, increase client log visibility, reconnect, and access only one test target. Third, check the target domain, resolved address, and final outbound tag. If the log shows only an IP and no domain, the application may resolve the name itself or DNS requests may bypass the client. In that case, domain rules may not work; use TUN, adjust DNS interception, or add IP rules.

If traffic still uses the old route after a rule change, also check connection reuse and caches. The browser may retain an existing connection, the system may retain a DNS result, and the core may reuse an existing session. Close the target application’s existing connections, clear relevant caches, reconnect the client, and test again. Do not judge a new rule by repeatedly refreshing an already established session. For more common issues, search the Help Center under “Usage Tips” and “Troubleshooting.”

Rule boundary: Broad fallback rules belong at the end. Every new rule should state its match target, destination outbound, and verification method. Disable historical rules whose purpose you cannot explain instead of adding more exceptions around them.

04 / Name resolution

DNS optimization and split resolution

DNS configuration determines how domains obtain addresses and also affects the handoff between domain and IP rules. System DNS, the client’s built-in DNS, encrypted DNS in the browser, and application-level resolvers may all coexist. When a query does not follow the expected path, you may see “the routing rule is correct, but traffic still uses the wrong outbound.” Before optimizing, identify the query source. A system proxy usually does not intercept every DNS request automatically; TUN is better suited to sending system queries through the client, but browser- or application-initiated encrypted queries still need to be handled.

The basic goal of split DNS is to send different domains to suitable resolvers and route the queries themselves through the correct outbound. Domain classification, resolver selection, and routing outbound are three separate decisions. Assigning a domain to a particular DNS server does not mean its application connection will use the same outbound; routing rules must enforce that separately. Conversely, writing only a business route without handling the resolution path may give the application an unsuitable address, which then triggers the wrong IP rule.

Server order and matching scope

The core DNS module can use multiple servers and attach domain match lists to them. Specific matches should come before general servers. Internal domains can use the LAN resolver, selected external domains can use encrypted queries, and all other domains can go to the default server. If the client supports a control such as skipFallback, it can prevent matched domains from being sent to fallback servers. Before enabling it, ensure that the dedicated resolver is stable; otherwise matched domains will have no fallback answer when that resolver fails.

{
  "dns": {
    "queryStrategy": "UseIP",
    "servers": [
      {
        "address": "192.168.1.1",
        "domains": [
          "full:intranet.example",
          "domain:office.example"
        ],
        "skipFallback": true
      },
      {
        "address": "https://dns.example/dns-query",
        "domains": [
          "domain:service.example"
        ]
      },
      "localhost"
    ]
  }
}

The example sends internal domains to the LAN resolver, selected services to a sample encrypted resolver, and all other requests to the local resolver. In a real configuration, the encrypted resolver’s own hostname must also resolve and connect. Bootstrap resolution cannot depend on the same encrypted channel before that channel is available. Let the system or a basic DNS resolver resolve the resolver hostname first, or use the client’s supported bootstrap mechanism. If logs repeatedly show that the resolver hostname cannot be resolved, fix this dependency first.

Query strategy and address families

queryStrategy controls which address types are returned. UseIP permits any available address family, UseIPv4 requests IPv4 only, and UseIPv6 requests IPv6 only. Choose based on whether the local network and outbound path fully support the address family. If the system receives an IPv6 address but the proxy path cannot establish an IPv6 connection, the application may wait for failure before falling back, making the first visit noticeably slower. You can temporarily use an IPv4 strategy to verify the cause, but the long-term fix is to check IPv6 handling across the local network, server outbound, and routing rules.

Do not hide every resolution problem behind a fixed address family. Some services provide different access through different families, and internal LAN services may work only over one. After changing the setting, test internal domains, common public domains, and direct IP connections separately. If only one application is affected, check whether it has its own DNS or connection-optimization feature, because its queries may never enter the client.

How DNS and routing work together

A DNS query is also a network request, so routing determines whether it goes direct or through a proxy. When encrypted DNS uses an ordinary TCP or HTTPS connection, route it by resolver hostname or IP as needed. If the query goes through a proxy, make sure that outbound already has a reachable server address before resolution begins. This is especially important when a subscription server uses a hostname. The most reliable startup path lets a basic DNS resolver resolve the server hostname, then uses the established proxy for later dedicated queries.

With IPIfNonMatch, a domain-rule miss triggers DNS resolution before IP rules are evaluated. The addresses returned by DNS therefore directly affect routing. If a domain has multiple address sets, changing cached results can send traffic to different rules. Prefer stable domain rules where possible, and reserve IP rules for regional sets, private addresses, and targets that genuinely require address-based matching instead of manually maintaining addresses for every domain.

Caches, leak paths, and verification

When verifying DNS, disable the browser’s independent resolver or explicitly include it in the test. Reconnect the client, clear relevant system and browser caches, and perform a completely new query. Logs should show the domain, selected DNS server, returned address, and the routing result for the subsequent application connection. A web-based detection tool cannot reveal every system query path because it observes the current browser, not terminals, background services, or other applications.

If DNS is still handled by the local network under a normal system proxy, that reflects a difference in interception scope and is not necessarily a configuration error. Enable TUN only when you need broader interception, then define explicit DNS inbounds and routes. If enabling TUN causes a resolution loop, check whether DNS requests re-enter TUN, whether the resolver lacks a direct or proxy exception, and whether FakeDNS overlaps with real resolution rules. For a complete split-resolution example, see the detailed V2Ray DNS split-resolution configuration guide.

Configuration order: Make one basic DNS setup stable first, then add domain groups and encrypted queries, and finally connect it with TUN and FakeDNS. At each step, record the resolver, returned address, and application outbound instead of checking only whether a webpage opens.

05 / System interception

v2rayN TUN mode: interception scope and setup order

TUN mode receives more system traffic through a virtual network interface. It is useful for applications that ignore the system proxy, cannot configure a proxy separately, or need UDP handling. TUN and the system proxy are not stronger and weaker versions of the same feature; they operate at different interception layers. A system proxy relies on the application following proxy settings, which keeps the path clear and troubleshooting simple. TUN captures traffic at the network layer and covers more applications, but adds variables such as routing tables, virtual interfaces, DNS interception, and system permissions. For a first setup, prove that the system proxy works before enabling TUN.

v2rayN is the preferred desktop client. Before enabling TUN, confirm that the client’s installation location is writable, the system permits creation of a virtual interface, and other tools that modify system routes or network interfaces are disabled. Windows, macOS, and Linux use different authorization methods; the UI may require administrator privileges or system network approval. When permission is denied, the local proxy may still start normally while the TUN interface is not created. Check the interface and routes rather than relying only on the connection status in the main window.

Recommended enablement order

First, keep one verified working server, basic routing, and a single reliable DNS setup. Second, exit potentially conflicting network tools and record the current system proxy state. Third, enable TUN and wait for the virtual interface and routes to be created. Fourth, test the browser, terminal, and one application that previously ignored the system proxy. Fifth, restore DNS split routing, FakeDNS, and custom routes one at a time. If all network access stops after enabling TUN, disable it immediately, confirm that system routes have recovered, then check permissions, stack type, and DNS.

The system proxy and TUN can be enabled together in some configurations, but during testing they should not both handle the same application. A browser may enter through the system proxy while another application enters through TUN; if routing distinguishes inbound tags, the two paths may produce different results. To isolate the cause, disable the system proxy and test TUN alone first. Once complete, decide whether to keep the system proxy entry for daily use.

Strict routing and bypass rules

Common TUN settings include auto route, strict route, interface selection, and LAN bypass. Auto route adds system routes. Strict route more forcefully prevents traffic from bypassing the virtual interface, which suits environments requiring consistent interception but is more likely to conflict with virtual machines, containers, enterprise networks, or local sharing services. Validate with auto route first, then evaluate strict route based on actual leak paths. Do not enable several forceful options at once without understanding the existing routing table.

LAN and private addresses should usually connect directly; otherwise printers, router administration pages, file shares, and internal services may become unreachable. There are two layers: whether system routing lets private addresses bypass TUN, and whether routing inside the core sends private addresses to a direct outbound. Both layers must be correct for stable access. In an enterprise network, internal addresses may use more than common private ranges and may depend on internal DNS or specific routes. Add explicit internal domains and networks beyond the basic private-address rules.

MTU, protocol stacks, and performance

MTU sets the maximum size of an individual packet on the virtual interface. If it is too large, some paths cannot carry packets correctly, so small webpages may open while large files or specific requests stall. If it is too small, fragmentation and processing overhead increase. Without clear symptoms, use the client default. Lower it gradually only after confirming a path-MTU problem, and test webpages, file transfers, and real-time connections after each change. Do not copy a value directly from another network environment.

TUN stacks differ in compatibility, UDP handling, and system integration. The client default generally covers common environments; change stacks only as a targeted troubleshooting step. If DNS works after switching but one type of connection fails, compare TCP and UDP logs. If every application fails, check whether the interface has an address, whether the default route points to TUN, and whether the server hostname is incorrectly sent back through the proxy, creating a loop.

Platform differences and sources of conflict

Platform Key checks Common conflicts Verification method
Windows Virtual interface, administrator privileges, system routes Other virtual adapters, enterprise security policies Check the adapter and routing table, then test different applications
macOS Network extension approval, current network service Stale authorization, other network extensions Confirm system approval and establish the connection again
Android System network-interception approval, background restrictions Battery-saving policies, other always-on connections Keep the client in the foreground for testing, then check background behavior
Linux TUN device permissions, route and DNS management services Container bridges, firewall rules Check the interface, policy routes, and resolution service

On Android, v2rayNG and v2flyNG use the system’s network-interception mechanism, so troubleshooting should focus on permissions, background operation, and battery restrictions. Desktop v2rayN is better suited to inspecting routing tables and DNS services in detail. When synchronizing configuration across platforms, do not assume TUN parameters can be copied exactly. Synchronize the routing intent, then choose the interface, permissions, and stack implementation again for each platform.

Restore system networking after shutdown

An abnormal exit can leave system proxy, DNS, or route settings behind. The normal recovery order is to restart the client, disable TUN and the system proxy, then exit the client. Check afterward that system network settings have returned to automatic configuration. If domains fail but IP addresses work, focus on restoring DNS. If every destination is unreachable, check the default route and virtual interface. If only the browser is affected, check where its proxy setting comes from. Reinstalling the client repeatedly usually does not fix leftovers at the system layer; first identify which layer failed to recover.

Troubleshooting principle: When TUN causes problems, return to the system-proxy baseline first. Confirm that the server, subscription, and basic routing work, then check the interface, permissions, DNS, and strict routing. Do not keep adding rules on top of a failed state.

06 / Domain mapping

How FakeDNS works and where it fits

FakeDNS returns temporary addresses from a reserved pool for domains and stores the mapping between each domain and address inside the core. When an application connects to the temporary address, the core restores the original domain from the mapping and then performs routing and the real connection. This mainly solves cases where an application performs its own DNS lookup and then gives only an IP connection to TUN, causing the core to lose the original domain and domain rules to miss. FakeDNS preserves domain information until the connection stage, making split-routing decisions more reliable.

FakeDNS is not a replacement for a regular DNS server and does not improve every resolution path automatically. After the core restores a domain, the actual connection still needs to be resolved according to the configuration or passed to the appropriate outbound. If routing, real DNS, or the outbound is wrong, FakeDNS only makes the problem harder to observe. Enable it after the TUN baseline and ordinary DNS are stable, and define which queries enter FakeDNS and which internal domains must return real addresses.

Address pool and mapping capacity

FakeDNS configuration includes an address pool and mapping capacity. The pool must use a dedicated reserved range and must not overlap with the LAN, enterprise network, container network, or an existing virtual interface. With an overlap, the system may send a temporary address onto the real network or mistakenly send a real internal address to FakeDNS. Capacity determines how many domain mappings can be retained at once. When it is too low, old mappings are evicted and applications holding those addresses may no longer recover the domain. Keep the client default for normal use; adjust it only after confirming high concurrent domain volume and mapping eviction in the logs.

{
  "fakedns": [
    {
      "ipPool": "198.18.0.0/15",
      "poolSize": 65535
    }
  ]
}

198.18.0.0/15 is a commonly used reserved range for benchmarking, and many implementations use it for virtual mappings. Still, check whether the local network or other tools already use it. This snippet represents only the core’s FakeDNS object. For queries to actually enter it, you also need matching DNS settings, inbound sniffing, and TUN interception. Adding the object alone does not change the system query path.

Sniffing and destination overrides

Inbound sniffing identifies domain or protocol information from connections. With FakeDNS, common destination overrides include HTTP, TLS, and FakeDNS mappings. Whether to enable destination overrides depends on the client template: they let routing use the restored domain, but may also change how special connections are handled. Start with the client’s standard FakeDNS mode, inspect the generated configuration, and customize only afterward. Do not enable every protocol-identification option at once.

{
  "inbounds": [
    {
      "tag": "tun-in",
      "protocol": "tun",
      "sniffing": {
        "enabled": true,
        "destOverride": [
          "http",
          "tls",
          "fakedns"
        ],
        "routeOnly": true
      }
    }
  ]
}

routeOnly means that the identified result is used primarily for routing and does not directly replace the final connection destination. This suits environments that want to minimize the impact of destination rewriting. Whether the field is supported depends on the current core and the client’s configuration method; use the client’s generated result as the authority. If the configuration reports an unknown field, remove the custom snippet, use the FakeDNS option in the UI, and then check that the core family matches the configuration format.

Targets that should not use FakeDNS

LAN domains, enterprise internal domains, printing, and discovery services usually need real addresses and should bypass FakeDNS in favor of the internal resolver. Applications that depend on local address checks, certificate binding, or special resolution results may also be unsuitable for virtual mappings. Keep exclusions specific: start with clearly identified internal domains and reserved suffixes, then observe for additional symptoms. Excluding every broad domain range defeats the purpose of retaining domains with FakeDNS.

Some applications validate the addresses returned by DNS, bypass system resolution, or use their own encrypted queries. The first two cases may prevent FakeDNS from working; the third may send the query into TUN as an ordinary HTTPS connection, leaving the core to infer the domain from connection characteristics. If FakeDNS queries do not appear in the logs, do not repeatedly change the address pool. First confirm whether the application’s query enters the client.

A practical order for diagnosing common failures

If resolution stops completely after enabling FakeDNS, first check whether DNS sends queries to FakeDNS. If a temporary address is returned but the connection fails, check whether TUN intercepts that address range and whether the inbound can restore the domain. If only internal services fail, check internal-domain exclusions and the LAN resolver. If failures appear intermittently after some use, check mapping capacity, application caches, and resume-from-sleep behavior. Each symptom belongs to a different layer; changing the DNS server cannot solve them all.

During verification, check whether queries return reserved addresses, then confirm in core logs that the same address maps back to the original domain and inspect the final outbound. Do not use a system tool to connect directly to a temporary address as a server-reachability test; it does not represent the real server. After disabling FakeDNS, clear relevant application and system DNS caches so applications do not continue using expired temporary addresses.

When to use it: FakeDNS is best suited to a stable TUN setup with many domain rules and applications that submit only IP connections. If a normal system proxy already preserves the destination domain, FakeDNS usually offers little additional benefit.

Using FakeDNS alongside real DNS split routing

A mature configuration often uses FakeDNS and real DNS together: public domains can receive temporary addresses to preserve their names, internal domains can query the LAN resolver for real addresses, server hostnames can use basic DNS during startup, and selected services can use dedicated encrypted queries. Give each domain group a clear priority so the same target is not matched by the internal resolver and FakeDNS at the same time. After changes, test public webpages, internal services, server reconnection, and system sleep and resume separately to confirm that mappings can be rebuilt throughout their lifecycle.

07 / Source governance

Managing, updating, and migrating multiple subscriptions

The challenge of managing multiple subscriptions is not importing more addresses; it is defining source boundaries, update ownership, and failure isolation. Each subscription should have its own name, group, and update policy. Self-hosted servers belong in a separate group, and temporary testing subscriptions should have automatic updates disabled by default. When an update makes servers disappear, changes notes, or leaves parameters unparsed, this structure makes the impact easy to identify instead of forcing a comparison across one mixed list.

Subscription names should remain stable over time, while server names can be updated by the source. Use short “purpose–source” names and leave dates, speeds, and online status out of the subscription name. For backup URLs from the same source, enable only one primary entry and keep the backup in your records rather than updating both; otherwise the client may import many duplicate servers. Across multiple devices, consistent group names help comparison, but active servers and update frequency should be set separately for each device’s network environment.

Automatic update timing and failure handling

Automatic updates suit stable subscriptions but should not run too frequently. Subscription content rarely changes minute by minute; overly frequent updates create noisy failures and may repeatedly overwrite the current list when the network is recovering. On desktop, update at a fixed interval while keeping a manual update option. On mobile, account for background restrictions: the client may update only in the foreground or when the system permits background activity. After seeing “update successful,” verify the entry count and parsing status instead of checking only that the request completed.

Update failures fall into network-request failures, invalid content format, and partial entry parsing failures. When a request fails, preserving the old list matters most; do not immediately delete and recreate the group. For a format error, check whether the subscription returned the expected content. For partial parsing failures, check for protocols or fields unsupported by the client; successfully parsed entries can still be used. After repeated failures, verify the basic connection on the same network, then switch networks to determine whether the subscription endpoint is unreachable or the client is failing to parse it.

Merge strategy and duplicate servers

Avoid permanently merging multiple subscriptions into a group whose sources cannot be traced. A merged list may be convenient in the short term, but later you cannot tell which source should be updated or removed. A better approach is to retain source groups and use filters to create temporary candidate lists. If the client supports cross-group filtering, filter by protocol, purpose, or note keyword. If it does not, use consistent prefixes within each group to reduce switching overhead.

Compare the complete connection identity when deciding whether servers are duplicates. Matching address and port do not necessarily mean duplication because the user ID, TLS server name, transport path, and protocol may differ. Matching notes also do not prove matching parameters. Delete duplicates only when all key fields are identical. If two subscriptions continuously provide the same server, choose one as the primary source and keep the other as an independent backup rather than letting automatic updates produce persistent visual duplicates.

Subscription overwrites and local changes

Server parameters in automatic subscriptions are normally controlled by the source. A locally edited note may survive an update or be overwritten; server-parameter changes are even more likely to disappear at the next update. Entries that require lasting customization should be copied into a “Self-hosted” or “Local changes” group with their purpose in the name. Once copied, they no longer receive source updates automatically, so changing server parameters becomes a manual task. Do not modify both the subscription entry and its copy, or it will be difficult to tell which one is active during troubleshooting.

Keep routing, DNS, and TUN settings as independent of specific servers as possible. As long as outbound tags and the client’s generation logic remain stable, switching subscriptions should not require rewriting the entire routing setup. If a server category lacks support for a particular network type, handle it with a separate configuration file or group policy rather than adding many server-name conditions to general routing. Fewer dependencies make migration and rollback easier.

The minimum set for cross-device migration

When migrating, prioritize subscription sources, manual servers, user routes, DNS rules, and necessary client settings. Do not rely on copied runtime caches, logs, or temporary generated configuration. v2rayN, v2rayNG, and v2flyNG differ in UI and core family, so a complete configuration is not guaranteed to import directly across clients. Migrate the subscription first and confirm a single-server connection, then rebuild advanced settings in the order “routing, DNS, TUN, FakeDNS.”

Sensitive fields should not appear in public backups, screenshots, or shared documents. When sharing troubleshooting information, keep the protocol type, transport, rule structure, and error category, while hiding server addresses, user IDs, subscription URLs, and authentication data. To compare two devices, record the client name, platform, interception mode, DNS strategy, and rule-match results. This is usually enough to locate the difference.

Post-update acceptance checklist

After every important update, confirm in order: the subscription name still identifies the correct source; the self-hosted group was not overwritten; the active server still exists; new entries are recognized by the client; filters still match notes; routing and DNS do not depend on deleted outbound tags; and the old list remains usable if automatic updating fails. Finally, restart the client and make a new connection so that you do not validate only an old in-memory configuration.

Migration tip: Between clients, migrate the configuration intent rather than copying a temporary generated file. Restore the basic connection first, then restore advanced settings layer by layer so any problem can be rolled back accurately.

If many entries become unrecognized after an update, first confirm that the client and target platform are correct. Choose v2rayN for desktop; on Android, choose v2rayNG or v2flyNG according to the core you need. Installation entry points are collected on the V2Ray client download page, organized by Windows, macOS, Android, and Linux.

08 / Outbound orchestration

Custom outbounds, chained forwarding, and systematic troubleshooting

An outbound is the final target of a routing decision. Common outbounds include proxy servers, direct connections, blocks, and forwarding to a local or upstream SOCKS service. Custom outbounds are useful for sending a specific workload through a dedicated exit, reusing an existing local service, or creating a clear test path. The essentials are unique tags, complete protocol parameters, and no circular dependencies. Routing references outbounds only by tag, so renaming one requires updating every rule that uses it.

GUI clients generally generate the primary proxy outbound from the active server and add direct and block outbounds. When extending the configuration manually, do not overwrite these base objects unless you have confirmed how the client merges them. A safer approach is to use the client’s custom configuration, preconfiguration, or template entry point, create a unique tag, and test it with one specific route. Direct edits to runtime files disappear after a server switch or restart and may also make the UI state disagree with the actual configuration.

Add a local SOCKS upstream

{
  "outbounds": [
    {
      "tag": "local-socks",
      "protocol": "socks",
      "settings": {
        "servers": [
          {
            "address": "127.0.0.1",
            "port": 1081
          }
        ]
      }
    }
  ]
}

The example creates an outbound named local-socks and sends connections to the SOCKS service listening on port 1081 on the local machine. Before using it, confirm that the port is listening and prevent its traffic from being captured by the same TUN and sent back to itself. If the upstream requires authentication, add the actual credentials in a configuration structure supported by the client and keep them local. During testing, point one clearly identified domain to this outbound instead of switching all traffic at once.

{
  "routing": {
    "rules": [
      {
        "type": "field",
        "domain": [
          "domain:service.example"
        ],
        "outboundTag": "local-socks"
      }
    ]
  }
}

Tags in rules must exactly match outbound tags. If the configuration fails to load, first check the JSON structure, duplicate commas, and field placement. If it loads but does not use the upstream, check rule order and domain matching. If it matches but the connection fails, check the local port, upstream authentication, and routing loops. Layered checks are faster than repeatedly changing servers.

Risk control for chained forwarding

Chained forwarding makes one outbound establish its connection through another outbound. It suits environments with a clearly defined network topology, but adds resolution dependencies, connection layers, and failure points. Before starting, draw the path: which inbound receives the application, which business outbound the route selects, which front outbound that outbound uses, and who resolves the server hostname. Any segment that returns to an earlier entry point can create a loop.

Do not implement a chain through vague global rules. Give the front and business outbounds explicit tags, route upstream server addresses directly or through a designated outbound as needed, and keep a basic connection outside the chain for fallback. When a timeout occurs, test each hop separately before combining them. If every hop works alone but the combination fails, focus on DNS bootstrap dependencies, UDP support, and TUN recapturing the upstream connection.

Direct and block outbounds

Direct outbounds are for LAN targets, internal services, and destinations that do not need a proxy. Block outbounds explicitly reject connections. Block rules should be specific and placed before broad proxy rules. Broad classifications can affect login, payment, updates, or embedded resources, so verify both the page’s main domain and its resource domains after adding one. If the goal is only to keep one application off the proxy, prefer process rules or inbound isolation. If the client and core cannot identify processes reliably, use explainable domain and IP conditions instead.

Direct does not necessarily mean bypassing every client layer. Traffic may enter TUN first and then be sent by the core to a direct outbound, or it may bypass TUN at the system-routing layer. These approaches differ in their effects on logs, DNS, and compatibility with local services. If you need unified routing and logging, let traffic enter the core and then connect directly. Traffic sensitive to LAN discovery or device access is usually better bypassing TUN at the system-routing layer while retaining direct rules for private addresses.

Build a troubleshooting matrix from the logs

Advanced configuration troubleshooting should answer four questions: did traffic enter the client, who resolved the domain, which route matched, and did the final outbound establish a connection? Increase log verbosity only during troubleshooting and restore the normal level afterward to keep logs manageable. If no target request appears, check the system proxy, application proxy, or TUN. If there is a request but no domain, check DNS interception and sniffing. If the routing tag is wrong, adjust rule order. If the outbound connection fails, check the relevant server and upstream.

Symptom Possible layer First check Next step
Client runs but the application connects directly Inbound interception Whether the application follows the system proxy Set an application-specific proxy or test TUN
Domain fails, IP connects DNS Whether the query reached the expected resolver Check cache, address family, and query routing
Destination takes the wrong route Routing First matching rule Adjust the order of specific rules and the fallback
Correct match but connection times out Outbound or upstream Object corresponding to the outbound tag Test the server, local port, and network separately
Everything stops after enabling TUN Interface and system routes Virtual interface and default route Disable strict routing and check DNS
FakeDNS returns an address but the connection fails Mapping and inbound Whether TUN intercepts the address pool Check domain restoration and sniffing settings

Build a configuration that remains maintainable

A maintainable configuration should minimize dependencies on server names, temporary addresses, and UI ordering. Routing should reference stable outbound tags, DNS should use explicit domain groups, subscriptions should preserve source boundaries, and TUN and FakeDNS should be enabled only when needed. Document the purpose of every custom object and keep a working baseline. When a failure occurs, disable the most recently added object, confirm that the baseline returns, and narrow the issue to one rule or outbound.

After completing the configuration, perform four acceptance rounds: restart the client to confirm that the configuration loads; switch servers to verify that routing does not depend on the old server; update subscriptions to confirm that custom groups and tags were not overwritten; and restart the system to verify that TUN, DNS, and the system proxy are established and restored correctly. One successful webpage visit is not enough. For internal networks, also test LAN services, internal domains, and recovery from system sleep.

Final check: Subscriptions provide servers, filters narrow the candidates, DNS resolves names, routing selects outbounds, TUN expands interception, FakeDNS preserves domains, and custom outbounds complete specific paths. When each layer is recorded separately, even complex configurations remain reproducible and easy to roll back.

If the issue is still unclear, return to the quick-start path and verify the minimum connection, then check the Help Center for installation, configuration, and troubleshooting entries. For system proxy, DNS, or speed differences, continue with the layered case studies in the site’s technical notes.