-
Print
-
PDF
BIND 9.9 redirect zones (for NXDOMAIN redirection)
The ability to configure a redirect zone was first introduced in BIND 9.9.0. (BIND 9 Subscription Version and BIND 9.10 extend this by allowing BIND to provide responses based upon an API to an external user-developed module - for example, DLZ or a coded back-end. For more details, see NXDOMAIN Redirection Using DLZ in BIND 9.10 and later.)
What is NXDOMAIN Redirection?
NXDOMAIN redirection provides the ability for a recursive server to replace an NXDOMAIN response to a query with a configured answer of its own - usually pointing to a helpful service site. This substitute response is returned to the original client in place of the NXDOMAIN response received by the server. Recursive server administrators may use this redirection for their own purposes or to obtain advertising revenue from third parties who specialize in this business.
How is NXDOMAIN Redirection configured?
The zone data within such a zone will often consist of a pair of (A and AAAA) wildcard records for root, but it's also possible to add records specifically for different domains.
The substitution supports all possible types and is not limited to A and AAAA records; any record type may be placed in a redirect zone.
For example, this would be a standard redirect zone configuration from named.conf:
zone "." {
type redirect;
file "db.redirect" ;
};
To redirect any A or AAAA queries to 10.100.100.2 and 2001:ffff:ffff::10.100.100.2 on NXDOMAIN, you would configure the redirect zone like this.
$TTL 300
@ IN SOA ns.example.net hostmaster.example.net 0 0 0 0 0
@ IN NS ns.example.net
;
; NS records do not need address records in this zone as it is not in the
; normal namespace.
;
*. IN A 10.100.100.2
*. IN AAAA 2001:ffff:ffff::10.100.100.2
To redirect all Spanish names (under .ES) use entries like these:
*.ES. IN A 10.100.100.3
*.ES. IN AAAA 2001:ffff:ffff::10.100.100.3
Similarly, to redirect all commercial Spanish names (under COM.ES) create entries like these:
*.COM.ES. IN A 10.100.100.4
*.COM.ES. IN AAAA 2001:ffff:ffff::10.100.100.4
The redirect zone can also hold redirect records for multiple different domains. If the above examples were added to the same redirect zone together, then the most specific matching redirect would be used when forming a query response.