|
NAMEhosts - enables serving zone data from a /etc/hosts style file.DESCRIPTIONThe hosts plugin is useful for serving zones from a /etc/hosts file. It serves from a preloaded file that exists on disk. It checks the file for changes and updates the zones accordingly. This plugin only supports A, AAAA, and PTR records. The hosts plugin can be used with readily available hosts files that block access to advertising servers.The plugin reloads the content of the hosts file every 5 seconds. Upon reload, CoreDNS will use the new definitions. Should the file be deleted, any inlined content will continue to be served. When the file is restored, it will then again be used. If you want to pass the request to the rest of the plugin chain if there is no match in the hosts plugin, you must specify the fallthrough option. This plugin can only be used once per Server Block. THE HOSTS FILECommonly the entries are of the form IP_address canonical_hostname [aliases...] as explained by the hosts(5) man page.Examples: 127.0.0.1 localhost 192.168.1.10 example.com example ::1 localhost ip6-localhost ip6-loopback fdfc:a744:27b5:3b0e::1 example.com example PTR RECORDSPTR records for reverse lookups are generated automatically by CoreDNS (based on the hosts file entries) and cannot be created manually.SYNTAXhosts [FILE [ZONES...]] { [INLINE] ttl SECONDS no_reverse reload DURATION fallthrough [ZONES...] }
METRICSIf monitoring is enabled (via the prometheus plugin) then the following metrics are exported:
EXAMPLESLoad /etc/hosts file.. { hosts } Load example.hosts file in the current directory. . { hosts example.hosts } Load example.hosts file and only serve example.org and example.net from it and fall through to the next plugin if query doesn't match. . { hosts example.hosts example.org example.net { fallthrough } } Load hosts file inlined in Corefile. example.hosts example.org { hosts { 10.0.0.1 example.org fallthrough } whoami } SEE ALSOThe form of the entries in the /etc/hosts file are based on IETF RFC 952 ⟨https://tools.ietf.org/html/rfc952⟩ which was updated by IETF RFC 1123 ⟨https://tools.ietf.org/html/rfc1123⟩.
Visit the GSP FreeBSD Man Page Interface. |