Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Absolute BSD - The Ultimate Guide To FreeBSD (2002).pdf
Скачиваний:
25
Добавлен:
17.08.2013
Размер:
8.15 Mб
Скачать

Chapter 12: Finding Hosts With DNS

The Domain Name Service (DNS) is one of those quiet, behind−the−scenes programs that doesn't get half the attention it deserves. Although most users have never heard of it, DNS is what makes the Internet, as we know it, work. DNS, or nameservice as it's also called, provides a map between hostnames and IP addresses. Without DNS, your Web browser or email programs wouldn't use convenient names like http://www.cnn.com/; instead, you'd have to type in IP addresses. This would greatly reduce the Internet's popularity.

Any Internet service you implement will require DNS. We'll discuss how DNS works, how to check DNS, how to configure your FreeBSD system to use DNS, and how to build your own DNS server.

How DNS Works

DNS simply maps IP addresses to hostnames, and hostnames to IP addresses. For example, a user doesn't want to know that http://www.absolutebsd.com/ is actually 209.69.178.25; she just wants to type the URL into her Web browser and go. DNS does the translation. As the system administrator you must be able to install, inspect, and verify DNS information, and you must understand how your system will perform those same operations.

DNS information can be available in any number of places: on the local system, on a local DNS server, on a remote nameserver. UNIX systems use a resolver to provide this information, a program that knows about all these information sources and interfaces with them. When a program wants to know the IP address of a host or the hostname for an IP address, it asks the resolver, which consults the appropriate information sources and returns the information to the program that needs it. We'll look at how to configure the resolver later in this chapter.

Most commonly, a resolver will direct a DNS query from a program to a nameserver, a computer running a program designed to gather DNS information from other computers on the Internet. Once a DNS request hits a nameserver, the nameserver checks its local cache to see if it has looked up that information recently. (Nameservers receive many identical DNS requests; for example, the nameserver at one Internet service provider I worked for received several hundred requests an hour for the IP address for http://www.cnn.com/. Multiply that by all the Yahoo!, eBay, and MSN requests out there, and that cache quickly becomes quite effective.)

If the designated nameserver doesn't have the information, it asks a root server, which keeps a list of the nameservers responsible for every domain on the Net. In a process called a recursive query, the root server tells the nameserver to go ask the appropriate nameservers, which may in turn refer the query to still other nameservers. Eventually, it is referred to the authoritative nameserver for that domain and the original nameserver gets its answer.

NoteWhen you register a domain, you must list two nameservers. Hosts expect to be able to get information for that domain from those nameservers. If one nameserver fails, the other should pick up the load, and if all the nameservers for a domain fail, the domain vanishes from the Internet. If that happens, the next time someone browses to www.yourdomain.com, they will get a "domain not found" error. Mail will bounce. The world will believe that you don't exist. Even big companies, such as Microsoft, do this on occasion. Your manager or customer will notice you, and not in a good way. Pay attention to your nameservice!

268