// The phonebook of the internet.
DNS IS THE BACKBONE OF THE WEB.
Every time you type a URL, DNS translates that human-readable domain into an IP address. Without DNS, you'd be typing "142.250.185.78" instead of "google.com".
WHY RUN YOUR OWN DNS?
Self-hosted DNS gives you complete control over your domain, faster resolution, privacy from third-party DNS providers, and the ability to create custom internal domains for your network.
TAKE BACK CONTROL.
Learn to configure BIND, manage DNS records, set up DNSSEC, and implement DNS caching. Become the authority for your own domains.
12 lessons. Complete DNS control.
How domain names work and DNS fundamentals
BeginnerSet up your own DNS server
Beginnernamed.conf and zone file structure
BeginnerCreate and manage DNS zone records
IntermediateMaster zones and record types
IntermediateConfigure secondary DNS servers
IntermediateSecure DNS with DNSSEC signatures
AdvancedSpeed up DNS resolution
IntermediateDifferent DNS responses for different networks
Advanceddig, nslookup, and DNS debugging
AdvancedInternal vs external DNS configuration
AdvancedGlobal DNS with BGP routing
AdvancedThe Domain Name System (DNS) is often called the "phonebook of the internet." It translates domain names like "google.com" into IP addresses like "142.250.185.78" that computers use to identify each other.
DNS is hierarchical and distributed. Root servers (.) sit at the top, followed by TLD servers (.com, .org, .net), then authoritative nameservers for specific domains. This distributed architecture is what makes the internet scalable.
Running your own DNS server gives you:
The internet can't exist without DNS. Now you understand how it works.
DNS (Domain Name System) is the phonebook of the internet. It translates human-readable domain names like example.com into IP addresses like 93.184.216.34 that computers use to communicate.
When you type a URL in your browser:
| Record | Purpose |
|---|---|
A |
IPv4 address |
AAAA |
IPv6 address |
CNAME |
Alias to another domain |
MX |
Mail server |
NS |
Name server |
TXT |
Text records (SPF, DKIM) |
1. DNS translates domain names to _____.
Hint: Numbers computers use
2. A records map to _____ addresses.
Hint: 32-bit addresses
3. MX records specify _____ servers.
Hint: Email
4. CNAME creates an _____.
Hint: Points to another name
BIND (Berkeley Internet Name Domain) is the most widely used DNS server software. It's free, open-source, and runs on most Unix-like systems.
1. DNS translates _____ to IP addresses.
Hint: Like google.com
2. The root of DNS hierarchy is marked by _____.
Hint: Dot
3. An A record maps a domain to an _____ address.
Hint: Version 4
4. MX records are used for _____.
Hint: Mail exchange
5. CNAME creates an _____.
Hint: Canonical name
6. The dig command is used for _____ queries.
Hint: DNS lookup
7. A _____ record holds authority information.
Hint: Start of Authority
8. AAAA records store _____ addresses.
Hint: Version 6
BIND configuration is split across multiple files. Understanding this structure is essential for effective DNS administration.
The primary configuration file that includes other files:
Global options for the DNS server:
Allow recursive queries (for caching resolver):
Who can query this server:
Upstream DNS servers for queries:
Interfaces to listen on:
1. BIND stands for _____ Internet Name Domain.
Hint: University name
2. On Ubuntu, BIND is installed with _____.
Hint: Package manager
3. On CentOS, the package is called _____.
Hint: Not bind9
4. The BIND service is called _____.
Hint: Name daemon
5. The main config file is _____.
Hint: In /etc/bind/
6. dig @127.0.0.1 tests _____ DNS.
Hint: Local server
7. BIND runs as the _____ user by default.
Hint: Named user
8. bind9-utils contains _____ tools.
Hint: Helper programs
Zone files contain DNS records for a domain. They define how to resolve your domain name to IP addresses and other information.
Create /var/cache/bind/db.example.com:
For 192.168.1.0/24, create /var/cache/bind/db.1.168.192:
1. The main BIND config file is _____.
Hint: In /etc/bind/
2. The _____ directive allows recursive queries.
Hint: For caching
3. Forwarders send queries to _____.
Hint: External DNS
4. To test config, use _____.
Hint: Check configuration
5. listen-on specifies _____ addresses.
Hint: Network interfaces
6. allow-query controls who can _____.
Hint: DNS queries
7. The directory option sets the _____.
Hint: BIND working dir
8. After config changes, _____ named.
Hint: systemctl reload
After creating zone files, you need to declare them in BIND configuration.
Secure your zones by controlling who can transfer:
1. Zone files contain _____ records.
Hint: DNS information
2. The SOA record contains _____ information.
Hint: Start of Authority
3. The serial number should _____ on updates.
Hint: Increment
4. CNAME creates a _____.
Hint: Canonical name
5. MX records are for _____.
Hint: Mail exchange
6. PTR records provide _____ DNS.
Hint: IP to name
7. To test a zone, use _____.
Hint: Check zone file
8. TXT records are commonly used for _____.
Hint: Sender Policy Framework
Slave zones receive zone transfers from master servers, providing redundancy and load distribution.
IP addresses of master servers:
Accept NOTIFY messages from:
Generate a TSIG key for secure zone transfers:
Add to both master and slave:
Master configuration:
Slave configuration:
1. Zones are declared in _____.
Hint: Local config
2. A master zone is _____.
Hint: Authoritative
3. A slave zone _____.
Hint: From master
4. allow-transfer controls zone _____.
Hint: AXFR
5. also-notify notifies _____ servers.
Hint: Slave servers
6. Reverse zones use _____ notation.
Hint: Reverse DNS
7. The serial should _____ on updates.
Hint: Increment
8. To test config, use _____.
Hint: Check configuration
DNSSEC (DNS Security Extensions) adds cryptographic signatures to DNS records, preventing DNS spoofing and cache poisoning attacks.
Without DNSSEC, an attacker can:
DNSSEC authenticates that DNS responses actually came from the authoritative server.
In named.conf.options:
Enable automatic signing in zone configuration:
DS (Delegation Signer) records are used to chain trust from parent to child zone:
Add to your registrar's DNS management:
For more control, use dnssec-signzone:
1. Slave zones receive _____ from masters.
Hint: Zone transfers
2. AXFR is a _____ transfer.
Hint: Complete zone
3. IXFR is an _____ transfer.
Hint: Partial
4. NOTIFY messages initiate _____.
Hint: Zone transfers
5. TSIG keys provide _____ transfers.
Hint: Authenticated
6. The masters directive lists _____ servers.
Hint: Primary servers
7. allow-notify controls _____ notifications.
Hint: Notify messages
8. Slave zones save to _____.
Hint: Zone file
DNS caching reduces query latency and reduces load on upstream servers by storing query results temporarily.
A basic caching-only DNS server:
Forward specific domains to different servers:
1. DNSSEC adds _____ to DNS records.
Hint: Cryptographic
2. DNSSEC prevents DNS _____ attacks.
Hint: Cache poisoning
3. DS records chain _____ from parent to child.
Hint: Delegation
4. dnssec-validation enables _____.
Hint: DNSSEC checking
5. Keys are stored in _____ files.
Hint: Key files
6. RRSIG records contain _____.
Hint: DNSSEC signatures
7. DS records are added to the _____ zone.
Hint: TLD registrar
8. dnssec-signzone is used for _____ signing.
Hint: Manual zone signing
Split DNS (or split horizon) serves different DNS answers based on who's asking. This is useful for internal vs. external clients.
1. DNS _____ reduces query latency.
Hint: Cache storage
2. Forwarders send queries to _____.
Hint: External DNS
3. max-cache-ttl sets maximum _____.
Hint: Time to live
4. rndc _____ clears the cache.
Hint: Clear cache
5. Forward zone type uses _____.
Hint: Upstream servers
6. rndc _____ generates statistics.
Hint: Statistics
7. Queries can be logged in the _____ category.
Hint: Query logging
8. max-ncache-ttl caches _____ responses.
Hint: NXDOMAIN
Understanding common DNS issues and how to debug them is essential for DNS administration.
Enable query logging for debugging:
1. Split DNS serves _____ answers based on client.
Hint: Multiple
2. Views are matched using _____ criteria.
Hint: Client matching
3. Internal clients get _____ IP addresses.
Hint: 192.168.x.x
4. External clients get _____ IP addresses.
Hint: External IPs
5. Views are defined in _____.
Hint: Main config
6. match-clients can use _____.
Hint: Access control lists
7. Each view must have _____ zones.
Hint: All defined zones
8. Split DNS is also called split _____.
Hint: Split horizon
Split-horizon DNS provides different DNS responses depending on the client's location - internal vs external. This is essential for enterprise networks that need both public and private resolution.
BIND uses views to implement split-horizon DNS:
Large organizations need hierarchical DNS infrastructure:
1. NXDOMAIN means the domain _____.
Hint: Not found
2. REFUSED means the query was _____.
Hint: Denied
3. +trace shows full _____ path.
Hint: DNS resolution
4. To check config, use _____.
Hint: Check config
Anycast DNS uses the same IP address on multiple servers worldwide. The network routes queries to the nearest server automatically, providing global load balancing and improved performance.
Deploy Anycast DNS infrastructure across regions:
Announce Anycast IPs via BGP to upstream providers:
Deploy servers across multiple regions:
1. Anycast uses the same _____ on multiple servers.
Hint: Shared address
2. _____ routes traffic to the closest server.
Hint: Border Gateway Protocol
3. Anycast provides automatic _____.
Hint: Redundancy
4. Anycast helps mitigate _____ attacks.
Hint: Distributed denial