3

How would I go about setting up an A record for in Bind9 for any negative queries? I want to forward our staff to an informational page if they were to visit a non existent domain. We have an internal caching server.

Kladskull
  • 1,265
  • 5
  • 15
  • 32
  • 7
    Separate from the answer, you should know that NXDOMAIN redirection is an extremely controversial practice. – Hyppy Dec 11 '14 at 18:06
  • Generally speaking, my answers here are as a private individual and not as an employee of ISC. However, in this particular instance I'd like to say, speaking as someone from ISC, that Hyppy is correct on both counts (his answer below, and his comment above.) We added features for NXDOMAIN redirection to BIND because customers were demanding it, not because we think it's a swell idea. But if you must do it, BIND does support it. – Michael McNally Dec 15 '14 at 06:14

1 Answers1

10

There is an article here on setting up NXDOMAIN redirects: BIND 9.9 redirect zones (for NXDOMAIN redirection).

Here is the example as given by ISC, but full explanation is available on their page.

In named.conf, you add a new "zone":

zone "." {
    type redirect;
    file "db.redirect" ;
};

And then in that zone file db.redirect, you populate it with your answer:

$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

Instead of *., you can narrow down TLDs and domains. For example, if you only want failed .co.uk addresses to be redirected to a specific address:

*.CO.UK. IN A 10.100.100.4
*.CO.UK. IN AAAA 2001:ffff:ffff::10.100.100.4
Hyppy
  • 15,458
  • 1
  • 37
  • 59