Skip to content

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 nameservers and search
  • Managing DNS records with Terraform over signed dynamic updates

Topology ​

NodeImageCPUs / memoryAddressesRole
nsdebian-131 / 1GiBmgmt 10.125.0.11BIND: lab.test and recursion
c1debian-131 / 1GiBmgmt 10.125.0.12Uses ns, search lab.test
c2debian-131 / 1GiBmgmt 10.125.0.13Uses ns, search lab.test

Before you start ​

bash
vz image pull disk debian-13

Run it ​

bash
cd examples/25-dns-server
vz validate
vz up
vz node ls
ssh lab@10.125.0.11        # password: lab

First 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 use tofu instead of terraform)
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 destroy

Notes ​

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