sing-box/docs/configuration/dns/rule_action.md
2024-11-23 13:29:40 +08:00

1.5 KiB

icon
material/new-box

DNS Rule Action

!!! question "Since sing-box 1.11.0"

route

{
  "action": "route",  // default
  "server": "",
  
  // for compatibility
  "disable_cache": false,
  "rewrite_ttl": 0,
  "client_subnet": null
}

route inherits the classic rule behavior of routing DNS requests to the specified server.

server

==Required==

Tag of target server.

disable_cache/rewrite_ttl/client_subnet

!!! failure "Deprecated in sing-box 1.11.0"

Legacy route options is deprecated and will be removed in sing-box 1.12.0, check [Migration](/migration/#migrate-legacy-dns-route-options-to-rule-actions).

route-options

{
  "action": "route-options",
  "disable_cache": false,
  "rewrite_ttl": null,
  "client_subnet": null
}

disable_cache

Disable cache and save cache in this query.

rewrite_ttl

Rewrite TTL in DNS responses.

client_subnet

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.

Will overrides dns.client_subnet and servers.[].client_subnet.

reject

{
  "action": "reject",
  "method": "default", // default
  "no_drop": false
}

reject reject DNS requests.

method

  • default: Reply with NXDOMAIN.
  • drop: Drop the request.

no_drop

If not enabled, method will be temporarily overwritten to drop after 50 triggers in 30s.

Not available when method is set to drop.