Skip to main content

DNS and BIND: Create a Caching Name Server

Hands-On Lab

 

Photo of Cara Nolte

Cara Nolte

Linux Training Architect II

Length

00:15:00

Difficulty

Beginner

Creating a caching name server is the most basic BIND configuration. This configuration is the main building block for other more advanced BIND configurations. Students will learn to configure a caching name server and test name resolution with the nslookup command.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

DNS and BIND: Create a Caching Name Server

Introduction

Creating a caching name server is the most basic BIND configuration. This configuration is the main building block for the other configurations that we'll create in this course. Students will learn to configure a caching name server and test name resolution with the nslookup command.

The Scenario

An application team at ABC Company is experiencing slowness in their application. They discovered that delays were the result of name resolution services for their application. They have requested that we configure a caching name server for the local host.

Logging In

Use the credentials provided on the hands-on lab page to get into labserver1 to begin with. Since we need root privileges, let's just run sudo -i right off and become root.

Install the bind and bind-utils Packages

$ yum install -y bind bind-utils

Verify the named Configuration for localhost

We've just got to make sure that the server will be listening on the correct port and IP address (53 and 127.0.0.1, respectively):

$ cat /etc/named.conf

Check the named Configuration with the named-checkconf Command

If this runs without producing any errors, our named.conf is in good shape:

$ named-checkconf

Start and Enable the named Service

We've got to start named up now, then make sure it's going to start after a reboot of the server:

$ systemctl start named
$ systemctl enable named

Test that Records are Returned for google.com Using the /etc/resolv/conf and the localhost Name Server Configurations

Let's peek at a file, to see what our default DNS server is:

$ cat /etc/resolv.conf

This will show us that our name server is sitting at 10.0.0.2. To query it, we'd run:

$ nslookup google.com

Now let's try querying the BIND instance that we just set up:

$ nslookup google.com localhost

And to see if localhost is caching results, let's run nslookup google.com localhost again. The result should come back much quicker.

Conclusion

Well, we've done it. We've fixed our applications team's server having to wait for DNS results from another server. Now, it caches host information locally, which makes for a much speedier process. Congratulations!