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

81 lines
1.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-08-25 13:08:29 +00:00
# DNS
2022-07-08 09:01:38 +00:00
### Structure
```json
{
"dns": {
"servers": [],
"rules": [],
"final": "",
"strategy": "",
2022-07-08 09:01:38 +00:00
"disable_cache": false,
2023-03-23 11:08:48 +00:00
"disable_expire": false,
2023-04-25 20:53:25 +00:00
"independent_cache": false,
2023-03-25 04:03:23 +00:00
"reverse_mapping": false,
"client_subnet": "",
2023-03-25 04:03:23 +00:00
"fakeip": {}
2022-07-08 09:01:38 +00:00
}
}
```
### Fields
| Key | Format |
|----------|---------------------------------|
2023-12-14 14:23:52 +00:00
| `server` | List of [DNS Server](./server/) |
| `rules` | List of [DNS Rule](./rule/) |
| `fakeip` | [FakeIP](./fakeip/) |
2022-07-08 09:01:38 +00:00
#### final
Default dns server tag.
The first server will be used if empty.
2022-07-08 09:01:38 +00:00
#### strategy
Default domain strategy for resolving the domain names.
One of `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
2022-08-22 04:43:21 +00:00
Take no effect if `server.strategy` is set.
2022-07-08 09:01:38 +00:00
#### disable_cache
Disable dns cache.
#### disable_expire
2023-03-23 11:08:48 +00:00
Disable dns cache expire.
2023-04-25 20:53:25 +00:00
#### independent_cache
Make each DNS server's cache independent for special purposes. If enabled, will slightly degrade performance.
2023-03-23 11:08:48 +00:00
#### reverse_mapping
Stores a reverse mapping of IP addresses after responding to a DNS query in order to provide domain names when routing.
2023-03-25 04:03:23 +00:00
Since this process relies on the act of resolving domain names by an application before making a request, it can be
problematic in environments such as macOS, where DNS is proxied and cached by the system.
#### client_subnet
!!! question "Since sing-box 1.9.0"
Append a `edns0-subnet` OPT extra record with the specified IP prefix to every query by default.
If value is an IP address instead of prefix, `/32` or `/128` will be appended automatically.
2023-03-25 04:03:23 +00:00
Can be overrides by `servers.[].client_subnet` or `rules.[].client_subnet`.