|
1 | 1 | # DNS |
2 | 2 | service.dns |
3 | 3 |
|
4 | | -The DNS server is the built-in host name resolution component. |
| 4 | +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. |
| 5 | + |
| 6 | +:::tip |
| 7 | +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 [CoreDNS](https://coredns.io), together with V2Ray's builtin DNS features. |
| 8 | +::: |
| 9 | + |
| 10 | +:::warning |
| 11 | +For `outbound`s 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 as`UseIP`. |
| 12 | +::: |
| 13 | + |
| 14 | +## DNS processing flow |
| 15 | + |
| 16 | +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: |
| 17 | + |
| 18 | + |
5 | 19 |
|
6 | 20 | > `nameServer`: [ [NameServerObject](#NameServerObject) ] |
7 | 21 |
|
@@ -31,20 +45,52 @@ Disable the fallback query step. |
31 | 45 |
|
32 | 46 | > `address`: string |
33 | 47 |
|
| 48 | +The network address or URL of Domain Name Service Service Server. |
| 49 | + |
| 50 | +Following Types are supported: |
| 51 | + |
| 52 | +* Standard DNS: An address like `1.0.0.1:53` specifies an UDP DNS Server. This the most common type of DNS Server. |
| 53 | +* DNS over TCP: An address like `tcp://host:port` specifies an TCP DNS Server. Currently DNS over TCP in V2Ray have performance implications. |
| 54 | +* DNS over Local TCP: An address like `tcp+local://host:port` specifies a TCP DNS Server send over local network. The communication with remote DNS server will be send from client's network environment directly without dispatch over routing component. |
| 55 | +* DNS over HTTPS: An address like `https://host:port/dns-query` specifies an DNS over HTTPS Server. |
| 56 | +* DNS over Local HTTPS: An address like `https+local://host:port/dns-query` specifies an DNS over HTTPS Server over local network. The communication with remote DNS server will be send from client's network environment directly without dispatch over routing component. |
| 57 | +* DNS over Local QUIC: An address like `quic+local://host:port/` specifies an DNS over QUIC Server over local network. The communication with remote DNS server will be send from client's network environment directly without dispatch over routing component. |
| 58 | + |
34 | 59 | > `clientIp`: string |
35 | 60 |
|
36 | | -> `skipFallback`: true|false |
| 61 | +The client IP address indication send to the DNS Server. The server may return a localised result based on this address. |
| 62 | + |
| 63 | +> `skipFallback`: true | false |
| 64 | +
|
| 65 | +Prevent fallback to this DNS Server. |
37 | 66 |
|
38 | 67 | > `prioritizedDomain`: [ [PrioritizedDomainObject](#PrioritizedDomainObject) ] |
39 | 68 |
|
| 69 | +The domains that should be send to this server. If the domain being queried match one of the specification, then the query will be send to this server first. |
| 70 | + |
40 | 71 | > `geoip`: [ [GeoIPObject](geo.md#GeoIPObject) ] |
41 | 72 |
|
| 73 | +The IP address expected from this server. If the result is not from the given IP address range, it will be discarded. |
| 74 | + |
42 | 75 | ## StaticHostsObject |
43 | 76 |
|
44 | 77 | > `type`: `Full` | `Subdomain` | `Keyword` | `Regex` |
45 | 78 |
|
| 79 | +Static Hosts supports different types of matching method. |
| 80 | + |
| 81 | +* Full: Requires an exact match. 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". |
| 82 | +* Subdomain: Matches a domain and all its subdomain. This rule takes effect when the domain name is the target domain name or its subdomain name. For example, "v2ray.com" matches "www.v2ray.com", "v2ray.com", but not "xv2ray.com". |
| 83 | +* Keyword: Matches any domain with a keyword. When this string matches any part of the target domain name, the rule takes effect. For example, "sina.com" can match "sina.com", "sina.com.cn" and "www.sina.com" but not "sina.cn". |
| 84 | +* Regex: Matches domain based on Regular Expression. When this regular expression matches the target domain name, the rule takes effect. For example, "\\\\.goo.*\\\\.com$" matches "www.google.com" and "fonts.googleapis.com" but not "google.com". |
| 85 | + |
46 | 86 | > `domain`: string |
47 | 87 |
|
| 88 | +The domain matching specification. Its interpretation is based on the `type` of the rule. |
| 89 | + |
48 | 90 | > `ip`: string |
49 | 91 |
|
| 92 | +The static host IP address. If configured, this IP address will be used as the domain name resolution result for matching domains. |
| 93 | + |
50 | 94 | > `proxiedDomain`: string |
| 95 | +
|
| 96 | +The replacement domain. If configured, this domain name's resolution result will be used as the domain name resolution result for mathcing domains. |
0 commit comments