sing-box/docs/configuration/dns/server.md

108 lines
2.8 KiB
Markdown
Raw Normal View History

---
icon: material/new-box
---
!!! quote "Changes in sing-box 1.9.0"
:material-plus: [client_subnet](#client_subnet)
2022-07-08 09:01:38 +00:00
### Structure
```json
{
"dns": {
"servers": [
{
"tag": "",
"address": "",
"address_resolver": "",
"address_strategy": "",
"strategy": "",
"detour": "",
"client_subnet": ""
2022-07-08 09:01:38 +00:00
}
]
}
}
```
### Fields
#### tag
The tag of the dns server.
#### address
==Required==
2022-07-08 09:01:38 +00:00
The address of the dns server.
2023-12-14 14:23:52 +00:00
| Protocol | Format |
|--------------------------------------|-------------------------------|
| `System` | `local` |
| `TCP` | `tcp://1.0.0.1` |
| `UDP` | `8.8.8.8` `udp://8.8.4.4` |
| `TLS` | `tls://dns.google` |
| `HTTPS` | `https://1.1.1.1/dns-query` |
| `QUIC` | `quic://dns.adguard.com` |
| `HTTP3` | `h3://8.8.8.8/dns-query` |
| `RCode` | `rcode://refused` |
| `DHCP` | `dhcp://auto` or `dhcp://en0` |
| [FakeIP](/configuration/dns/fakeip/) | `fakeip` |
2022-07-08 09:01:38 +00:00
!!! warning ""
2023-12-03 06:53:22 +00:00
To ensure that Android system DNS is in effect, rather than Go's built-in default resolver, enable CGO at compile time.
2022-07-27 04:03:07 +00:00
!!! info ""
the RCode transport is often used to block queries. Use with rules and the `disable_cache` rule option.
| RCode | Description |
|-------------------|-----------------------|
| `success` | `No error` |
| `format_error` | `Format error` |
| `server_failure` | `Server failure` |
| `name_error` | `Non-existent domain` |
| `not_implemented` | `Not implemented` |
| `refused` | `Query refused` |
2022-07-27 04:03:07 +00:00
2022-07-08 09:01:38 +00:00
#### address_resolver
==Required if address contains domain==
2022-07-08 09:01:38 +00:00
Tag of a another server to resolve the domain name in the address.
#### address_strategy
The domain strategy for resolving the domain name in the address.
One of `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
2022-07-08 10:48:43 +00:00
`dns.strategy` will be used if empty.
2022-07-08 09:01:38 +00:00
2022-08-22 04:43:21 +00:00
#### strategy
Default domain strategy for resolving the domain names.
One of `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
Take no effect if overridden by other settings.
2022-08-22 04:43:21 +00:00
2022-07-08 09:01:38 +00:00
#### detour
Tag of an outbound for connecting to the dns server.
2023-04-25 21:34:13 +00:00
Default outbound will be used if empty.
#### client_subnet
!!! question "Since sing-box 1.9.0"
Append a `edns0-subnet` OPT extra record with the specified IP address to every query by default.
Can be overrides by `rules.[].client_subnet`.
Will overrides `dns.client_subnet`.