Peters School of Business · Assiniboine College · NETW-0014
2 hours · Lecture + Lab 4A · Split-horizon concept, ACLs, migrating zones into views
Why split-horizon DNS exists and how BIND9 views implement it
Part 1 — The split-horizon problem (8 min)
Part 2 — BIND9 views (12 min)
view "internal" {
match-clients { 192.168.50.0/24; 127.0.0.1; };
recursion yes;
zone "yourname.net" { type primary; file "...internal..."; };
};
view "external" {
match-clients { any; };
recursion no;
zone "yourname.net" { type primary; file "...external..."; };
};
match-clients { any; }) appeared first, every client would match it, and the internal view would never be reached.acl "internal-nets" { 192.168.50.0/24; 192.168.51.0/24; 127.0.0.1; };
match-clients { "internal-nets"; };
Part 3 — Zone file differences (10 min)
db.yourname.net.internal, external zone → db.yourname.net.external. This makes it immediately obvious which file belongs to which view when listing /etc/bind/.Lab 4A — Migrate yourname.net into BIND9 views with separate internal/external zone files
Part 1 — Backup existing DNS configuration (10 min)
sudo cp /etc/bind/named.conf.local /etc/bind/named.conf.local.pre-views
sudo cp /etc/bind/db.yourname.net /etc/bind/db.yourname.net.pre-views
sudo cp /etc/bind/db.yourname.rev /etc/bind/db.yourname.rev.pre-views
sudo named-checkconf. Fix anything that's broken before the migration.Part 2 — Define the internal-nets ACL (10 min)
/etc/bind/named.conf.options. Before the options { } block, add the ACL definition:
acl "internal-nets" {
192.168.50.0/24;
192.168.51.0/24;
127.0.0.1;
};
sudo named-checkconf. ACL syntax errors are common — the semicolons after each network and after the closing brace are all required.Part 3 — Restructure named.conf.local with view blocks (25 min)
/etc/bind/named.conf.local. Replace its entire contents with the following view structure (using your own domain name and IPs):
view "internal" {
match-clients { "internal-nets"; };
recursion yes;
allow-recursion { "internal-nets"; };
zone "yourname.net" {
type primary;
notify yes;
allow-query { any; };
allow-transfer { 192.168.50.2; };
file "/etc/bind/db.yourname.net.internal";
};
zone "50.168.192.in-addr.arpa" {
type primary;
file "/etc/bind/db.yourname.rev.internal";
};
};
view "external" {
match-clients { any; };
recursion no;
zone "yourname.net" {
type primary;
notify no;
allow-query { any; };
file "/etc/bind/db.yourname.net.external";
};
};
sudo named-checkconf. Common errors at this stage: missing semicolons after zone block closing braces, view block not closed, or file paths that don't exist yet (which is expected — the zone files haven't been created yet). named-checkconf will not complain about missing files — that error appears only when named tries to load them.Part 4 — Create internal and external zone files (35 min)
sudo cp /etc/bind/db.yourname.net /etc/bind/db.yourname.net.internal
sudo cp /etc/bind/db.yourname.net /etc/bind/db.yourname.net.external
sudo cp /etc/bind/db.yourname.rev /etc/bind/db.yourname.rev.internal
sudo named-checkzone yourname.net /etc/bind/db.yourname.net.internal
sudo named-checkzone yourname.net /etc/bind/db.yourname.net.external
sudo named-checkzone 50.168.192.in-addr.arpa /etc/bind/db.yourname.rev.internal
sudo systemctl restart named. Check the journal for both zone load lines — internal and external. Any errors will identify which zone file and what line number.any matches everything), the internal view is never reached, and internal clients get external IPs. View order is not optional.Learning outcomes — by end of Day 1, students can…
Common issues and fixes
| Issue | Likely cause | Fix |
|---|---|---|
| named-checkconf: "view 'internal': zone already in another view" | Old zone declarations still exist outside the view blocks — they weren't removed when the views were added | Edit named.conf.local and ensure there are no zone declarations outside the view blocks. All zones must be inside a view once views are used |
| BIND9 fails to start: "not found" for zone file | Zone file path in the view declaration doesn't match the actual file path/name | Check paths carefully — the file names must include .internal or .external suffix. Verify with: ls /etc/bind/db.* |
| named-checkconf passes but both views return the same response | Both zone files have the same records (internal file not updated) | Verify the external zone file has the external IP (172.17.x.x) for s1, not the internal IP |
| Reverse zone breaks after migration to views | Reverse zone not included inside the internal view block | The reverse zone declaration must be inside one of the view blocks. It typically belongs in the internal view only, since external clients don't need PTR lookups for internal addresses |