43 lines
1.9 KiB
Markdown
43 lines
1.9 KiB
Markdown
# Hybrid
|
||
|
||
One process can be Primary for some zones, Secondary for others, forward private domains
|
||
and recurse for everything else:
|
||
|
||
```yaml
|
||
recursion: { enabled: true, allowed_clients: ["acl:lan"] }
|
||
zones:
|
||
- { name: example.com, type: primary, file: zones/primary/example.com.zone }
|
||
- { name: example.net, type: secondary, primaries: ["192.0.2.10:53"] }
|
||
forward_zones:
|
||
- { domain: corp.internal, upstreams: ["10.0.0.53"] }
|
||
resolution:
|
||
default: recursive
|
||
views:
|
||
- { name: lan, clients: ["10.0.0.0/8"] }
|
||
- { name: world, clients: [any] }
|
||
```
|
||
|
||
## Precedence (tested in `crates/dns-server/tests/resolver.rs`)
|
||
|
||
0. **Hosts files** (`hosts.files`, only for clients in `recursion.allowed_clients`) – a name
|
||
listed there is answered from the files (NODATA for other types); see [hosts.md](hosts.md).
|
||
1. **Local authoritative zones** – the most specific zone visible in the client's view wins
|
||
(`example.com` beats a forward rule for `com`); NXDOMAIN inside a local zone is final and
|
||
the name is never sent upstream.
|
||
2. **Recursion permission** – clients outside `recursion.allowed_clients` get REFUSED.
|
||
3. **Local-only names** (`localhost`, `local`, `test`, `invalid`, `home.arpa`, `onion`,
|
||
RFC 1918/6303 reverse zones, plus `recursion.local_only_suffixes`) → NXDOMAIN locally.
|
||
A forward rule for such a name takes precedence (e.g. forwarding `home.arpa` to a router).
|
||
4. **Allow/block policy.**
|
||
5. **Conditional forwarding** – longest matching suffix (and client ACL).
|
||
6. **Default resolution.**
|
||
|
||
Data spaces are separate: authoritative zones are never cached; each forwarding rule and
|
||
the recursive resolver use their own cache namespace.
|
||
|
||
## Views (split horizon)
|
||
|
||
`zones[].views: [lan]` makes a zone visible only to clients of that view; the same zone
|
||
name can be defined twice with different files for different views. Views are matched in
|
||
order; the first match wins.
|