We begin the series of posts on How to install and configure a Primary Master DNS and Cache in Debian Squeeze?, with which we intend to provide an entry point to the fascinating world of this essential service for the functioning of the Network of Networks that is the Internet.
All articles are designed to be used sequentially. Parts 1 and 2 contain the minimum theoretical knowledge necessary for a beginner to understand and install a DNS server.
We recommend them not to be intimidated. Read and apply what is written and you will surely obtain positive results. And to the Usual Suspects of falling into Despair, we recommend calm, very calm if you really want to understand how to configure this essential service.
Forgive me the use of English words and the occasional Anglicism. It has been done to gain technical clarity in writing.
The aspects that we will develop in this First Part are the following:
- Introduction
- Useful definitions
- Most common DNS settings
- Zones and Records
- Zone Expiration Times
- Tips
Introduction
They say in the WWW Village that DNS is one of the darkest areas of network services. Fortunately, this is not the case - especially for a LAN - as we will demonstrate through the following articles. As much as one does not want it, it is almost mandatory to read a small theoretical part.
Definition according to Wikipedia :
The DNS is a distributed, hierarchical database that stores information associated with domain names on networks like the Internet. Although as a database the DNS can associate different types of information with each name, its most common uses are assigning domain names to IP addresses and locating the email servers for each domain.
Naming to IP addresses is certainly the best known feature of the DNS protocols. For example, if the IP address of the prox.mx FTP site is 200.64.128.4, most people reach this computer by specifying ftp.prox.mx and not the IP address. In addition to being easier to remember, the name is more reliable. The numeric address could change for many reasons, without you having to change the name.
Initially, DNS was born from the need to easily remember the names of all servers connected to the Internet. Initially, SRI (now SRI International) hosted a file called HOSTS that contained all known domain names (technically, this file exists, and most current operating systems can be configured to check your hosts file). The explosive growth of the network made the centralized naming system in the hosts file impractical and in 1983, Paul Mockapetris published RFCs 882 and 883 defining what today has evolved into modern DNS. (These RFCs have been made obsolete by the 1987 publication of RFCs 1034 and 1035).
The computers on which this service runs are called "Name Servers" . Debian includes several programs in its repositories for a functional DNS, and among them is the most widely used on the Internet: BIND or "Berkeley Internet Naming Domain".
BIND is the de facto standard DNS server. It is free software and is distributed with most UNIX and Linux platforms. BIND is also sometimes referred to as the " named daemon." You can find a comparison of different types of DNS servers here (English Wikipedia).
Useful definitions
NetBIOS: Network Basic Input/Output System (NetBIOS): A basic network input/output system (NetBIOS). An application programming interface (API) that can be used by programs on a local area network (LAN).
NetBIOS provides programs with a uniform set of commands to request the low-level services needed to manage names, direct sessions, and send " datagrams " between nodes on a network.
NetBIOS Name: The 16-bit name of a process that uses the Network Basic Input/Output System (NetBIOS). This name is recognized by Microsoft's Windows Internet Name System (WINS) service, which associates or "maps" a computer or hostname to a specific IP address.
FQDN : “Fully Qualified Domain Name.” Since translating technical English names is often difficult, I recommend learning the English name and, for practical purposes, referring to it as the FQDN . It is simply the DNS domain name that has been established to indicate its absolute location in the domain name space tree.
Unlike relative names, a fully qualified domain name (FQDN) is preceded by a period to indicate its position in the namespace root. For example, freake.amigos.cu is the FQDN of the host whose NetBIOS name is freake and belongs to the amigos.cu domain.
friends.cu. freake.amigos.cu. otrofreake.amigos.cu. mail.amigos.cu.
Most common DNS settings
We can configure a DNS or Domain Name Server in different ways to provide different services. The most used are:
Caching Server ( “Caching Nameserver” ): Requests made to the server will be resolved by the forwarders we define in its configuration. The responses will be stored and “remembered” for when the caching server is queried again, which considerably increases response speed.
Primary Master : Requests made to the server will be resolved by reading the data stored in the local files of the created Zones. As its name indicates, it will be an authoritative Name Server for the queried Zone.
Secondary Master : Requests made to the server will be resolved by directly querying an authoritative Primary Master server for the requested Zone. It maintains an up-to-date copy of the Primary Master's Zones.
We can also configure it so that they perform several functions at the same time, such as being a Primary Master and Caché at the same time, which is very common in our business networks.
Zones and Records
Zones are plain text files that allow us to organize DNS records . Each zone name corresponds to a domain name or a range of IP addresses, such as one or more subnets. It contains, among other data, several records of different classes or types, of which we will only mention the following:
SOA : “Start of Authority” . This is a mandatory record in every zone, and only one should exist in each zone file. It serves as the preamble to all zone files . It describes the zone itself; the machine or host it originates from; who is responsible for its content; the zone file version; and other aspects related to the operation of the DNS server. It is essential that each zone file contains an A record that identifies the machine or host where the DNS server resides.
NS : Maps a name to a Name Server . Every domain must have at least one NS record. This record points to a DNS server that can answer queries concerning the domain. It can point to the Primary Master or the Secondary Master.
A : “Address” – (Address). This record is used to translate hostnames to IPv4 addresses.
AAAA : “Address” – (Address). This record is used to translate hostnames to IPv6 addresses.
CNAME : “Canonical Name” – (Canonical Name). A record type that allows us to assign multiple names to the same host or create aliases for it. Let's say we have the host web.amigos.cu, on which we have a web server installed, and we want it to be referred to as www.amigos.cu. Then, in the amigos.cu zone, we must have, among other records:
web IN A 192.168.10.20 www IN CNAME web.amigos.cu.
MX : “Mail Exchange” or Mail Server . Information used by other mail servers to know where to send an email given an IP address. Each MX record has a priority, with the record having the lowest number having the highest priority. Examples:
10 mail1.amigos.cu. 20 mail2.amigos.cu.
PTR : Mapping an IP address to a name . Types of records stored in so-called "Reverse Zones". For example, Zone 10.168.192.in-addr.arpa contains the reverse mapping of all addresses in the IP address range 192.168.10.0/24
Of course the list of record types goes on ...
Zone expiration or expiration times
When we are creating the files for the Zones of DNS records, we must configure the Expiration Times in seconds. However, we can specify them in a shorter way according to the following table:
Segundos Unidades Descripción 60 1M A un minuto 1800 30M A 30 minutos 3600 1H Una Hora 10800 3H 3 horas 21600 6H 6 horas 43200 12H 12 horas 86400 1D Un día 259200 3D 3 días 604800 1W Una semana
Tips
We must be very careful when writing to zone files. FQDNs must end with a period ( . ), and we cannot leave spaces at the end of each line. For this reason , we strongly recommend using console editors such as vi or nano . We will use nano , which we find easier to use. Of course, we can also use plain text editors with a graphical user interface (GUI).
I hope you have not been bored because there is still a little to go into the matter.