Name
dbhosts - serve data from /etc/hosts
Description
The dbhost handler is useful for serving data from a /etc/hosts file. It watches the file and reloads it
when written to. The dbhost handler can only reply to A, AAAA and PTR queries, all others are deferred to
the next handler(s).
The dbhost handler can be used with readily available hosts files that block access to advertising servers.
The hosts file
Commonly the entries are of the form IP_address canonical_hostname [aliases...] as explained by
the hosts(5) man page.
Examples:
# The following lines are desirable for IPv4 capable hosts
127.0.0.1 localhost
192.168.1.10 example.com example
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fdfc:a744:27b5:3b0e::1 example.com example
Reverse lookups
PTR records for reverse lookups are generated automatically.
Syntax
dbhost [FILE] {
ttl TTL
}
- FILE the hosts file to read and parse. If the path is relative the path from the root
handler will be prepended to it. Defaults to
/etc/hosts if omitted.
ttl change the TTL of the records generated (forward and reverse). The default is 3600 seconds (1 hour).
Examples
Load /etc/hosts file.
. {
dbhost
}
Load example.hosts file in the current directory (if root is not set), and only use it for example.org
names:
example.org {
dbhost example.hosts
}
See also
The form of the entries in the /etc/hosts file are based on IETF RFC
952 which was updated by IETF RFC
1123.