DNS and BIND: Configuring Multiple Domains

30 minutes
  • 11 Learning Objectives

About this Hands-on Lab

Creating multiple domains allows users to configure separate groups of IP addresses. One use case for this scenario is grouping IPs for different environments such as prod, dev, qa, etc into different domains and zones with different zone rules. In this lab, students will learn to configure multiple domains for the same name server in the `/etc/named.conf`. We will then create the associated zone flies and test the configuration using the `nslookup` command.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Install the bind and bind-utils Packages with YUM
$ yum install bind bind-utils -y
Configure Zones for localdomain.com and domain2.com in the /etc/named.conf File
vim /etc/named.conf
zone "localdomain.com" {
        type master;
        file "fwd.localdomain.com.db";
        allow-update { none; };
};
zone "1.0.10.in-addr.arpa" {
        type master;
        file "1.0.10.db";
        allow-update { none; };
};
zone "domain2.com" {
        type master;
        file "fwd.domain2.com.db";
        allow-update { none; };
};
Check the named.conf File for Syntax Errors
named-checkconf
Create the Forward and Reverse Zone Files in /var/named
$ cd /var/named
$ touch fwd.localdomain.com.db 1.0.10.db fwd.domain2.com.db
$ ls -al
$ chown named:named *.db
Populate the Forward Zone File for localdomain.com with TTL, SOA, NS, and A, and CNAME Records
 $ vim /var/named/fwd.localdomain.com.db

 $TTL 86400
@       IN      SOA ns.localdomain.com.     root.localdomain.com.      (
                                10030   ;Serial
                                3600    ;Refresh
                                1800    ;Retry
                                604800  ;Expiry
                                86400   ;Minimum TTL
)
; Name Server
@       IN      NS  ns.localdomain.com.
;A Record Definitions
ns  IN  A   10.0.1.201
; Canonical Name/Alias
dns     IN      CNAME   ns.localdomain.com.
Run the named-checkzone Command to Check the Forward Zone File for localdomain.com for Syntax Errors
$ named-checkzone localdomain.com fwd.localdomain.com.db
Populate the Forward Zone File for domain2.com with the TTL, SOA, NS, A, and CNAME Records
$ vim fwd.domain2.com.db

 $TTL 86400
@       IN      SOA     ns.localdomain.com.     root.localdomain.com.      (
                                10030   ;Serial
                                3600    ;Refresh
                                1800    ;Retry
                                604800  ;Expiry
                                86400   ;Minimum TTL
)
; Name Server
@       IN      NS      ns.localdomain.com.
;A Record Definitions
server1 IN      A       10.0.1.220
server2 IN      A       10.0.1.221
; Canonical Name/Alias
prod     IN      CNAME   server1.domain2.com.
Check the Forward Zone for domain2.com for Syntax Errors
$ named-checkzone domain2.com fwd.domain2.com.db
Populate the Reverse File for Both Zones with the TTL, SOA, NS, and PTR Records
 $ vim 1.0.10.db

 $TTL 86400
@       IN      SOA     ns.localdomain.com.     root.localdomain.com.      (
                                10030   ;Serial
                                3600    ;Refresh
                                1800    ;Retry
                                604800  ;Expiry
                                86400   ;Minimum TTL
)
; Name Server
@       IN      NS      ns.localdomain.com.
;PTR Records
201     IN      PTR     ns.localdomain.com.
220     IN      PTR     server1.domain2.com.
221     IN      PTR     server2.domain2.com.
Start the named Service
systemctl start named
Use the nslookup Command to Verify the Records That Were Configured Resolve
$ nslookup ns.localdomain.com localhost
$ nslookup server1.domain2.com localhost
$ nslookup server2.domain2.com localhost
$ nslookup 10.0.1.220 localhost

Additional Resources

ABC Company has hired us to create a nameserver to host two different domains: one called localdomain.com where DNS records for local office resources will reside, and another called domain2.com for their production environment.
To complete this, we will have to install the bind and the bind-utils packages, create the forward zones for localdomain.com and domain2.com, create a reverse zone where all IPs for ABC Company will reside, and test the configuration with the nslookup command.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?