5

I have a BIND 9 server running, currently serving several domains. For one of these domains I would like to differentiate the answers depending of the asking IP address.

I know this can be done by views. But I only would like to split one domain into two versions. I would like to prevent copying all the other domains to both views.

So is there a way I can define a zone that is then visible identical in all views? Or do I really add all the zones to both views?

masegaloeh
  • 17,978
  • 9
  • 56
  • 104
Teddy
  • 175
  • 2
  • 7
  • 1
    As far as I know there is no way other then using views on bind. But when you are using 'view' statements, all zones must be in views. The zone for which do you need such behavior is authoritative? – ALex_hha Aug 30 '13 at 10:07

1 Answers1

11

If you split your common zones into a separate configuration file, then you can use the 'include' directive to include that file in each of your views.

All your non-split zones go in /etc/named/common-zones.conf:

zone "example.com" IN {
        type master;
        file "zones/example.com.db";
};

Then include that file in /etc/named.conf:

view "dmz" {
    match-clients { dmz_clients; };
    include "/etc/named/common.zones.conf";
    zone "other-zone.com" IN {
        type master;
        file "zones/other-zone_DMZ.com.db";
   };
}
view "lan" {
    match-clients { lan_clients; };
    include "/etc/named/common.zones.conf";
    zone "other-zone.com" IN {
        type master;
        file "zones/other-zone_LAN.com.db";
   };
}
fukawi2
  • 5,327
  • 3
  • 30
  • 51
  • 5
    This will not work if your bind server is a slave and writes the zones from the two different views - then you are required to configure the separate zones with different names. Completely bogus that bind does this now... :( – Eirik Toft Aug 04 '15 at 22:36