- Table of Contents
- Copyright
- About the Lead Authors
- About the Contributing Authors
- Acknowledgments
- Tell Us What You Think!
- Introduction
- I. Red Hat Linux Installation and User Services
- Chapter 1. Introduction to Red Hat Linux
- Chapter 2. Installation of Your Red Hat System
- Chapter 3. LILO and Other Boot Managers
- Chapter 4. Configuring the X Window System, Version 11
- Chapter 5. Window Managers
- Chapter 6. Connecting to the Internet
- Chapter 7. IRC, ICQ, and Chat Clients
- Chapter 8. Using Multimedia and Graphics Clients
- II. Configuring Services
- Chapter 9. System Startup and Shutdown
- Chapter 10. SMTP and Protocols
- Chapter 11. FTP
- Chapter 12. Apache Server
- Chapter 13. Internet News
- Chapter 14. Domain Name Service and Dynamic Host Configuration Protocol
- A Brief History of the Internet
- A Word About This Chapter's Examples
- Important DNS Facts and Concepts
- DNS Server Configuration Files
- Configuring resolv.conf with linuxconf
- A Trivial Caching DNS
- Configuring DNS Server Master Zones
- Delegating Authority
- Adding a Slave DNS Server
- Troubleshooting DNS
- DNS Resources
- Automatically Configuring Clients with DHCP
- Summary
- Chapter 15. NIS: Network Information Service
- Chapter 16. NFS: Network Filesystem
- Chapter 17. Samba
- III. System Administration and Management
- Chapter 18. Linux Filesystems, Disks, and Other Devices
- Chapter 19. Printing with Linux
- Chapter 20. TCP/IP Network Management
- Chapter 21. Linux System Administration
- Chapter 22. Backup and Restore
- Chapter 23. System Security
- IV. Red Hat Development and Productivity
- Chapter 24. Linux C/C++ Programming Tools
- Chapter 25. Shell Scripting
- Chapter 26. Automating Tasks
- Chapter 27. Configuring and Building Kernels
- Chapter 28. Emulators, Tools, and Window Clients
- V. Appendixes
- A. The Linux Documentation Project
- B. Top Linux Commands and Utilities
- C. The GNU General Public License
- D. Red Hat Linux RPM Package Listings
A Trivial Caching DNS
A normal Red Hat 7 installation includes a caching DNS implementation. Depending on the exact install method, and post-install configuration activities, this installation-default setup may have a flaw, making it excessively slow on any reverse DNS lookup (more on reverse DNS later in the Configuring DNS Server Master Zones section of this chapter). This problem can be verified by using telnet to access the newly installed machine. If this flaw exists, telnet will typically take 30 seconds or more to ask for the username and may time out entirely. Note that it's possible for slow telnet to be caused by flawed forward (name to number) resolution, although this is less common.
The following code contains the installation-default /etc/resolv.conf file for the new host:
search domain.cxm nameserver 192.168.100.1
The resolv.conf file configures the DNS client, not the DNS server, even though in many cases they coexist on the same computer. The first line of resolv.conf defines domain.cxm as the client's default domain. That's the domain that's appended to machine names. The second line defines the IP address of the DNS server used by the client.
Listing 14.2 contains the installation-default /etc/named.conf file for the new host.
Example 14.2. The /etc/named.conf File
// generated by named-bootconf.pl
options {
directory "/var/named";
/*
* If there is a firewall between you and nameservers you want
* to talk to, you might need to uncomment the query-source
* directive below. Previous versions of BIND always asked
* questions using port 53, but BIND 8.1 uses an unprivileged
* port by default.
*/
// query-source address * port 53;
};
//
// a caching only nameserver config
//
zone "." {
type hint;
file "named.ca";
};
zone "0.0.127.in-addr.arpa" {
type master;
file "named.local";
};
In this file, anything preceded by // or enclosed in /* */ is a comment. In English, the preceding file says the following:
- All zone data files mentioned in named.conf shall be relative to directory /var/named.
- zone "." is the root of the DNS tree, hints to which are given in file named.ca, which is a list of the root servers.
- Any IP address in subnet 127.0.0 shall be resolved according to zone data file named.local, which is used, but not created, by the DNS server. Had it been type slave instead of type master, the file would have been created by the DNS server out of data from a zone transfer from a master zone on another computer.
When you're working with named.conf, remember that syntax is important. Make sure all quotes, braces, and semicolons are in place. If you prefer, everything between braces may be placed on a single line.
Testing Your Caching DNS
First, verify that telnet logs in properly. Run this command on another machine:
# telnet 192.168.100.1
If it takes about a second for the username prompt to appear, so far so good. If it takes 20 seconds or more, there's still a reverse DNS problem.
Testing Non-Local Lookup
The time has come to test the lookup capability of your caching DNS. Although a caching-only DNS server cannot provide lookup for the local network, it can refer any queries for the Internet at large to the proper Internet DNS servers. You'll remember that /var/named/named.ca was simply a list of the world's root DNS servers. These servers are "consulted" unless your cache "remembers" a lower-level server that's authoritative over the domain.
Start by verifying a good Internet connection with the ping command. Remember that DNS cannot work without a good network connection. ping the IP addresses of several Web sites that are known to be up most of the time. If you cannot ping these addresses, look for network, PPP, or routing problems.
If you're using PPP, sometimes you'll need to make a new default route corresponding to your PPP.
With PPP connections, routing is often the cause. While pppd is running, start with the ifconfig ppp0 command:
# /sbin/ifconfig ppp0
ppp0 Link encap:Point-to-Point Protocol
inet addr:10.37.60.188 P-t-P:10.1.1.1 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:7 errors:0 dropped:0 overruns:0 frame:0
TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:10
If you can ping the ppp0 inet address and the IP address following P-t-P (which stands for Point To Point) but cannot ping other Internet addresses, suspect routing. With pppd running, issue this command:
# /sbin/route add default gw 10.1.1.1 ppp0
Obviously, substitute the P-t-P address given by the ifconfig command. Try your ping again.
Once you can ping using IP addresses, you're ready to test your caching DNS itself by accessing a URL with ping. Try this command:
# ping www.mcp.com
If all is well, the preceding ping command will display replies from http://www.mcp.com. If not, carefully review the files and commands discussed up to this point. Once you can ping the URL, you know your caching DNS works.
If you have lynx installed, you can actually use it to browse the Web:
# lynx http://www.mcp.com
After a suitable delay, the Macmillan Publishing Web site should appear in your lynx browser.
Addressing Special PPP Considerations
The preceding was an example. To reduce bandwidth, in real life you'd let your ISP do all your DNS by telling your DNS client that the nameserver is the ISP's nameserver. Simply put a
nameserver ###.###.###.###
line in your /etc/resolv.conf file above all other nameserver lines. The ###.###.###.### represents your ISP's primary DNS. You can also place the secondary DNS there. However, your DNS client will honor only three nameserver lines.
If you find that the additional nameserver(s) slows your normal network activities, you can have two different files you copy to /etc/resolv.conf: one for when you're online and one for when you're not.
Caching Server Summary
As installed, Red Hat 7 comes configured as a caching server. Depending on the installation procedures and post-installation configuration activities, it's possible that a reverse DNS flaw, or even a forward DNS flaw, can cause problems on programs like telnet, ftp, and sendmail. In such a case, the simple addition of reverse DNS resolution for the network subnet, or possibly forward DNS resolution for the domain, gives you a completely functioning caching-only server capable of resolving all Internet domain names, but not any that are declared locally.
Caching-only servers are the simplest and least authoritative of the three server types. The other two, master and slave, are discussed in the sections Configuring DNS Server Master Zones and "Adding a Slave DNS Server."
Configuring DNS Server Master Zones | Next Section

Account Sign In
View your cart