25 DNS server
An authoritative and recursive BIND server for the zone lab.test, used by two clients.
What you practice
- Forward and reverse zones in BIND
- Recursion through a forwarder (the switch's DNS proxy)
- Pointing clients at your own DNS server with
nameserversandsearch - Managing DNS records with Terraform over signed dynamic updates
Topology
| Node | Image | CPUs / memory | Addresses | Role |
|---|---|---|---|---|
ns | debian-13 | 1 / 1GiB | mgmt 10.125.0.11 | BIND: lab.test and recursion |
c1 | debian-13 | 1 / 1GiB | mgmt 10.125.0.12 | Uses ns, search lab.test |
c2 | debian-13 | 1 / 1GiB | mgmt 10.125.0.13 | Uses ns, search lab.test |
Before you start
bash
vz image pull disk debian-13Run it
bash
cd examples/25-dns-server
vz validate
vz up
vz node ls
ssh lab@10.125.0.11 # password: labFirst boot installs packages; give it a minute or two after vz up returns.
Try it
bash
ssh lab@10.125.0.12 'host c2; host www; host 10.125.0.13; host debian.org'
ssh lab@10.125.0.12 'dig @10.125.0.11 lab.test SOA +short'The zones take dynamic updates, so edit them with a tool rather than by hand (or sudo rndc freeze lab.test, edit /var/lib/bind/db.lab.test, sudo rndc thaw lab.test).
Terraform
On the Mac:
- terraform:
brew install hashicorp/tap/terraform(or OpenTofu:brew install opentofu, then usetofuinstead ofterraform)
bash
cd terraform
terraform init
terraform apply # app, api and a PTR record
dig @10.125.0.11 api.lab.test +short # app.lab.test., 10.125.0.20, 10.125.0.21
dig @10.125.0.11 -x 10.125.0.20 +short
terraform destroyNotes
The TSIG secret in init/ns and terraform/main.tf was generated for this example and is public now.
Clean up
bash
vz down
vz destroy --yes # deletes the overlays and state of this lab