DNS Server | V2Fly.org (2024)

V2Ray has a built-in DNS server, which has two main purposes: matching routing rules according to the IP resolved from a domain, and traditional DNS function—resolving the target address to connect.

TIP

Due to the complexity of DNS protocol, V2Ray only supports basic IP query function (A and AAAA records). In order to have a complete DNS experience, you may want to use an dedicated DNS serverware, such as CoreDNSopen in new window, together with V2Ray's builtin DNS features.

WARNING

For outbounds with freedom protocol, the default value of domainStrategy is AsIs, therefore the DNS settings will not be applied to this outbound by default. If necessary, it should be configured asUseIP.

# DNS processing flow

When a domain name list assigned by a DNS server matches the domain name currently being queried, V2Ray will use this DNS server first, otherwise, it will query from top to bottom, and only return the IP list which matches expectIPs. The processing flow diagram of the DNS server is as follows:

DNS Server | V2Fly.org (1)

# DnsObject

DnsObject corresponds to the dns field of the configuration file.

{ "hosts": { "baidu.com": "127.0.0.1" }, "servers": [ { "address": "1.2.3.4", "port": 5353, "domains": [ "domain:v2ray.com" ], "expectIPs": [ "geoip:cn" ] }, "8.8.8.8", "8.8.4.4", "localhost" ], "clientIp": "1.2.3.4", "tag": "dns_inbound"}

hosts: map{string: address}

Static IP list, its value is a series of "domain name": "address". The address can be an IP or domain name. When resolving a domain name, if the domain name matches an item in this list when the address of the item is an IP, the resolution result is the IP of the item, and the following servers are not used for resolution; when the address is a domain name, this domain name will be used for IP resolution instead of the original domain name.

The domain name format has the following forms:

  • Pure string: When this domain name completely matches the target domain name, the rule takes effect. For example, "v2ray.com" matches "v2ray.com" but not "www.v2ray.com".
  • Regular expression: Start with "regexp:", and the rest is a regular expression. When this regular expression matches the target domain name, the rule takes effect. For example, "regexp:\\.goo.*\\.com$" matches "www.google.com" and "fonts.googleapis.com" but not "google.com".
  • Subdomain (recommended): Start with "domain:", and the rest part is a domain name. This rule takes effect when the domain name is the target domain name or its subdomain name. For example, "domain:v2ray.com" matches "www.v2ray.com", "v2ray.com", but not "xv2ray.com".
  • Substring: Start with "keyword:", and the rest part is a string. When this string matches any part of the target domain name, the rule takes effect. For example, "keyword:sina.com" can match "sina.com", "sina.com.cn" and "www.sina.com" but not "sina.cn".
  • List of predefined domain names: Start with "geosite:", and the rest is a name, such as geosite:google or geosite:cn. For the name and domain name list, please refer to Predefined Domain Name List.

servers: [string | ServerObject ]

A list of DNS servers, supporting two types: DNS address (string format) and ServerObject. When its value is a DNS IP address, such as "8.8.8.8", V2Ray will use port 53 of this address for DNS query.

When the value is "localhost", it means the machine's preset DNS configuration is used. When the value is in the form of "https://host:port/dns-query", such as "https://dns.google/dns-query", V2Ray will use DNS over HTTPS (RFC8484, short for DOH) to query. Some service providers have certificates of IP aliases, then you can write IP format directly, such as https://1.1.1.1/dns-query. You can also use non-standard ports and paths, such as "https://a.b.c.d:8443/my-dns-query" (4.22.0+).

When the value is in the form of "https+local://host:port/dns-query", such as "https+local://dns.google/dns-query", V2Ray will use DOH local mode for queries, that is, DOH requests will not go through Routing/Outbound and other components, but directly request externally to improve timing. Generally suitable for use on the server side. Non-standard ports and paths can also be used. (4.22.0+)

TIP

When using localhost, the DNS request of this machine is not controlled by V2Ray, and additional configuration is needed to make DNS request forwarded by V2Ray.

The DNS clients initialized by different rules will be reflected in the V2Ray startup log with an info level, such as local DOH, remote DOH and udp and other modes. (4.22.0+)

clientIp: string

The IP address of the current system. It is used to inform server the client's location during DNS queries. It cannot be a private address.

tag: string

(V2Ray 4.13+) The query traffic sent by this DNS, except localhost and DOHL_ modes, will carry this identifier, which can be matched with inboundTag in the routing.

# ServerObject

{ "address": "1.2.3.4", "port": 5353, "domains": [ "domain:v2ray.com" ], "expectIPs": [ "geoip:cn" ]}

address: address

DNS server address, such as "8.8.8.8". For ordinary DNS IP addresses that only support the UDP protocol DNS server, if the address is in the form of a URL beginning with "https://" or "https+local://", DOH mode is used, and the rules are the same as DOH configuration in string mode.

port: number

DNS server port, such as 53. This item defaults to 53 by default. When using DOH mode, this item is invalid, non-standard port should be specified in URL.

domains: [string]

A list of domain names. The domain names contained in this list will be queried by this server first. The domain name format is the same as it in Routing Configuration.

expectIPs:[string]

(V2Ray 4.22.0+) A list of IP ranges, the format is the same as it in route configuration.

When this option is configured, V2Ray DNS will verify the returned IP and only return addresses in the expectIPs list.

If this item is not configured, the IP address will be returned as it is.

DNS Server | V2Fly.org (2024)

FAQs

How do I check DNS server responses? ›

Type “ping” followed by the domain name or IP address of the server you want to test. Press Enter, and you'll see data that includes the time in milliseconds it takes for the server to respond. This gives you an idea of how quickly data can travel to and from that server.

How to check DNS is resolving or not? ›

Check DNS settings
  1. For Linux, use the resolvectl status command to display the configured name resolution servers. ...
  2. For macOS, type scutil --dns to display the configured name resolution servers. ...
  3. For Windows, type ipconfig /all to display the configured name resolution servers.
Aug 2, 2022

How to resolve a DNS problem? ›

DNS failure? Try these DNS troubleshooting basics.
  1. Clear the cache. ...
  2. Reboot your computer. ...
  3. Check your hardware and wires. ...
  4. Run a wizard. ...
  5. Run an antivirus scan. ...
  6. Check DHCP (Dynamic Host Control Protocol) ...
  7. Reach out to the experts.
Jun 5, 2023

What are DNS responses? ›

DNS message is relatively simple: the browser queries a domain name and gets an IP address. If a DNS server doesn't recognize the domain name, it will pass the query along to the following DNS server. Later, when receiving a response, it carries the response to the browser.

Is 1.1 1.1 the fastest DNS? ›

The independent DNS monitor DNSPerf ranks 1.1. 1.1 the fastest DNS service in the world. Since nearly everything you do on the Internet starts with a DNS request, choosing the fastest DNS directory across all your devices will accelerate almost everything you do online.

How do I run a DNS check? ›

Access your command prompt. Use the command nslookup (this stands for Name Server Lookup) followed by the domain name or IP address you want to trace. Press enter.

How to verify DNS? ›

How Do I Check My DNS Settings in Windows?
  1. Open the Command Prompt.
  2. Type ipconfig /all and press Enter.
  3. Look for the DNS Servers entry to check your DNS settings and verify that they are correct. ...
  4. Type nslookup lifewire.com and press Enter.
  5. Verify that the correct IP addresses are displayed.
Feb 12, 2022

What to do if DNS server isn't responding? ›

  1. Try Using A Different Browser. Strictly speaking, switching to another browser won't fix DNS issues. ...
  2. Check The Site From A Different Device. ...
  3. Restart Your Computer. ...
  4. Restart Your Computer In Safe Mode. ...
  5. Turn Off Antivirus Software And/Or Your Firewall. ...
  6. Turn Off Your VPN. ...
  7. Flush DNS Cache. ...
  8. Restart Your Router.
Dec 15, 2023

How do I reset my DNS? ›

To reset your DNS in Windows:
  1. Using the Start Menu at the lower left corner of your screen: ...
  2. Enter CMD into the text box and then select the Command Prompt program.
  3. A new black window will appear. ...
  4. Type ipconfig /flushdns and press ENTER (please note: there is a space between ipconfig and /flushdns)
  5. Restart your computer.

How do I clear my DNS server problem? ›

Browser DNS Troubleshooting
  1. Reset the Browser: The first step is to close or quit the browser and restart. ...
  2. Clear the Browser's Cache: For frequently accessed websites, webpages are cached (stored) on a local computer for faster load times. ...
  3. Use a Different Browser: The final test is to try a different browser.

What is the command to resolve the DNS? ›

Nslookup. The nslookup command is helpful in diagnosing issues with DNS name resolution. This command is comparable to Mac or Linux's dig function. It can find the IP address of a host or perform a reverse DNS lookup (to find the domain name of an IP).

Why can't i connect to the DNS server? ›

What Does “DNS Server Not Responding“ Mean? The “DNS server not responding” error message means that the DNS of the domain you want to reach is unavailable or your browser cannot connect to the internet. Possible fixes include restarting your router or modem, checking for network issues, and updating your browser.

What is the best DNS provider? ›

Best DNS Servers 2024
  • Next DNS (45.90. 28.190) NextDNS takes DNS customization and security to the next level. ...
  • OpenDNS (208.67. 222.222) ...
  • Verisign DNS (64.6. 64.6) ...
  • G-Core (95.85. 95.85) ...
  • Oracle DNS (216.146. 35.35) ...
  • NordVPN (103.86. 96.100) ...
  • Quad9 (9.9. 9.9) ...
  • Google Public DNS (8.8. 8.8)

How to check DNS server status? ›

Run ipconfig /all at a command prompt, and verify the IP address, subnet mask, and default gateway. Check whether the DNS server is authoritative for the name that is being looked up. If so, see Checking for problems with authoritative data.

How do I check DNS activity? ›

To view DNS activity details: In the in the Threat Protection menu of Enterprise Center, select Reports > DNS Activity. Filter events as needed. For more information, see Filter data based on date and time and Filter DNS activity data.

How do I check DNS records? ›

For Windows:
  1. Open Command Prompt.
  2. Enter nslookup domain.com to perform a DNS lookup for the domain.

Top Articles
Latest Posts
Article information

Author: Eusebia Nader

Last Updated:

Views: 6193

Rating: 5 / 5 (60 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Eusebia Nader

Birthday: 1994-11-11

Address: Apt. 721 977 Ebert Meadows, Jereville, GA 73618-6603

Phone: +2316203969400

Job: International Farming Consultant

Hobby: Reading, Photography, Shooting, Singing, Magic, Kayaking, Mushroom hunting

Introduction: My name is Eusebia Nader, I am a encouraging, brainy, lively, nice, famous, healthy, clever person who loves writing and wants to share my knowledge and understanding with you.