BIND’s views are a feature some people like using because they allow a single server instance to respond distinctly depending on, say, the source address used to query the instance. I actually quite dislike BIND views because they complicate configuration, and as such I typically advise against using them. (If you’re ever really bored, try configuring AXFR from one view to the other; it’s possible, and it’s horrid. ;-)

Hidden in the depths of the Unbound version 1.6.0 Changelog which I’ve only just looked at, I find the word view. I actually groaned, but I thought I’d give it a peek even so.

Unbound’s views can be used to serve local data depending on the source address a query is received on. Let’s look at a small example:

     access-control-view: intview

     local-zone: "aa." static
     local-data: "my.aa. IN A"

     name: "intview"
     local-zone: "aa." static
     local-data: "my.aa. 90 IN A"

I define local-zone and local-data globally, so queries to this instance should return the following for my.aa/A:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6565
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

my.aa.			3600	IN	A

;; Query time: 8 msec

The view named intview defines an alternative response, which is used when a query comes in to 127/8, as defined in the access-control-view statement:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 14806
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

my.aa.			90	IN	A

;; Query time: 0 msec

There may be multiple view clauses, and options from views matching an access control statement will be used and override global options. On the other hand, global options are used if no matching view is found.

It doesn’t appear to be possible to use views other than for local data, which is fine, if you ask me. :-)

Further reading:


blog comments powered by Disqus