When you open a core config exported by v2rayN, first check the local listening port, then follow the rule tags to find the actual outbound. Using an example with both direct and blocked traffic, this guide explains how to identify the default outbound, tell DNS issues from routing issues, and decide whether to change a client setting or check the core logs.
V2Ray JSON Example: Trace the Connection Flow
Think of the config as a path a connection takes. inbounds define where the core accepts connections, routing decides where each connection goes, and outbounds define what happens next. log and dns are supporting settings, not two more stops every connection passes through.
This example uses the traditional V2Fly V2Ray JSON format. It needs no remote account and does not rely on rule data files. An app must explicitly connect to the local SOCKS inbound to use this route; starting the core does not change the system proxy. The example port is for illustration only and is not necessarily v2rayN's default.
{
"log": {
"loglevel": "warning"
},
"inbounds": [
{
"tag": "local-socks",
"listen": "127.0.0.1",
"port": 10808,
"protocol": "socks",
"settings": {"auth": "noauth", "udp": false}
}
],
"outbounds": [
{"tag": "direct", "protocol": "freedom"},
{"tag": "reject", "protocol": "blackhole"}
],
"routing": {
"domainStrategy": "AsIs",
"rules": [
{
"type": "field",
"inboundTag": ["local-socks"],
"domain": ["full:example.org"],
"outboundTag": "reject"
}
]
},
"dns": {
"servers": ["localhost"]
}
}
The app settings saved by the client, subscription data, and JSON read by the core at startup are separate layers. If v2rayN regenerates the core config after you switch the active profile, manual edits may be overwritten. Check which config is actually loaded; the filename alone does not tell you which JSON is in use.
inbounds and outbounds: Check the listening address and outbound protocol
If an app cannot connect, check the inbound first. This example listens only on the IPv4 loopback address 127.0.0.1. Set the app to SOCKS5; don't configure the same port as an HTTP proxy. noauth means this inbound does not require SOCKS authentication, so it should not be exposed directly to your local network. With udp: false, this example cannot be used to test SOCKS UDP forwarding.
App side: SOCKS inbound
- listen
127.0.0.1- port
10808- protocol
socks- tag
local-socks
The app connects to the listening address and port, not the inbound tag.
Core side: direct outbound
- protocol
freedom- tag
direct- Array position
outboundsfirst entry
The tag is a reference name; the protocol and its settings determine how traffic is handled.
If an exported config contains a vmess or vless outbound, distinguish the local port the app connects to from the remote server port in the outbound config. settings varies by protocol, while streamSettings describes transport and security options. For remote connections, these settings must match the other end. Don't swap the protocol field from one outbound while keeping the settings structure from another. V2Fly and Xray may also support different fields and values, so check the core and version actually in use.
routing: Rules are checked in order; unmatched traffic uses the default outbound
For the standard outbound rules in this example, the core checks rules in array order, and the first match determines where traffic goes. Within a rule, inboundTag and domain must both match; outboundTag specifies the action. full:example.org matches only that exact domain, not its subdomains.
| Destination received by the core | Example outcome | Why |
|---|---|---|
example.org | reject | The request came through the specified inbound and matched the exact domain. |
www.example.org | direct | The subdomain does not match the exact-domain rule, so the first outbound is used. |
| The app supplied a destination IP resolved in advance | direct | Sniffing is disabled in this example, so a destination IP alone will not match this domain rule. |
If a rule doesn't match, first check whether the core received a domain or an IP
To test a domain rule, have the app send the SOCKS request using the domain name. If the app resolves it first and sends only the IP to the core, change the test method before loosening the routing rule.
When reading a config with multiple rules, check not only that the tags are spelled correctly, but also whether a broad rule earlier in the list already catches the request. For example, a rule that only specifies an inboundTag can take over connections from that inbound before a later domain rule gets a chance to match. If no rule matches, this example uses the first entry in outbounds. Move the reject outbound to the first position, and unmatched connections will be rejected instead.
dns: Distinguish local resolution, routing lookups, and outbound resolution
dns.servers specifies the resolvers used by the core's built-in DNS module. Here, localhost means to use the system's local resolver; it does not require a separate DNS service on the loopback address or automatically take over DNS for apps. Whether this module is used depends on the core's routing and outbound settings.
- App resolves the domain first: The app may obtain an IP address before connecting to SOCKS. Changing the core's
dns.serverswon't affect a lookup that has already happened. - Routing resolves for matching:
AsIsdoes not resolve a domain to an IP just to match IP rules.IPIfNonMatchallows a domain target to be resolved after the initial match fails, then tries matching IP rules. These options change routing decisions; they are not system DNS switches. - Outbound resolves when connecting: Even if routing doesn't look up DNS, a direct outbound still needs the destination IP to connect. Where the destination domain is resolved depends on the outbound's own settings, not the routing strategy.
For troubleshooting, keep the same app, inbound, and test domain throughout. First determine whether the failure happens during DNS resolution or after an outbound has been selected. If the logs show the request reached reject, revisit the routing rules instead of switching resolvers. Conversely, reaching an IP address does not prove domain resolution works, or that TLS verification will succeed when connecting by domain.
log and config troubleshooting: From startup errors to rule matches
This example sets log.loglevel to warning, which is useful for checking warnings and errors but won't show routing details for every connection. For more information, temporarily set it to info in a test copy, reproduce the issue once, then restore the previous level. Core logs may include destination domains, addresses, and connection times. Remove sensitive details before sharing, and never include subscription URLs or account fields.
- Core fails to start: Check standard JSON syntax first. Object keys and strings must use double quotes, and the last item must not have a trailing comma. Then confirm that the core supports the protocol, transport, and fields in use. Valid JSON does not necessarily mean the core can load the config.
- Core starts, but the connection is refused: Check the actual listening address, port, and proxy type. If the logs say the address is already in use, check whether an existing v2rayN core process or another app has taken the example port. If you change the port, update it in both the core and the test app.
- App uses the wrong outbound: Confirm that the app is actually using this SOCKS inbound, then review
rulesone by one, checking the inbound tag, destination format, and outbound tag. For unmatched requests, check the first entry in the outbound array. - Settings revert after saving: First check whether you changed a persistent client setting or a temporary file generated at startup. Maintain commonly used routing rules in the client's routing settings. Save test JSON as a separate copy, change one thing at a time, and verify the result in the logs.