Primary Master DNS for a LAN on Debian 6.0 (I)

We started the series of posts about How to install and configure a Master Primary DNS and Cache on Debian Squeeze?, with which we intend to give a Entry point to the fascinating world of this essential service for the operation of the Network of Networks that is Internet.

All articles are developed so that they can be used sequentially. The 1ra y 2da part contain the minimum of theoretical knowledge necessary for the New or Newbie can understand and develop the installation of a DNS.

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:

El DNS It is a distributed and hierarchical database that stores information associated with domain names on networks such as the Internet. Although as a database the DNS is capable of associating different types of information to each name, the most common uses are the assignment of domain names to IP addresses and the location of the email servers of 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 brings in its repositories several programs to have a functional DNS and among them is the one most used on the Internet: BIND o "Berkley Internet Naming Domain".

BIND is the de facto standard as a DNS server. It is Free Software and is distributed with most of the UNIX and Linux platforms. They also refer to BIND as “named”(Named daemon). You can find here (Wikipedia in English) a comparison of different types of DNS servers.

Useful definitions

NetBIOS: Network Basic Input / Output System (NetBIOS): Basic network input and 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 in a network.

NetBIOS name: 16-bit name of a process that uses the basic network input and output system (NetBIOS). Name recognized by Microsoft's WINS (Windows Internet Name System) service, which associates or "maps" a computer or host name to a specific IP address.

FQDN"Fully Qualified Domain Name" o Fully Qualified Domain Name. As translating names created into technical English is often tremendous, I recommend learning the name in English and for practical purposes refer to it as the FQDN. It is nothing more than the DNS Domain Name that has been set to indicate its absolute location in the domain namespace tree.

As opposed to relative names, a FQDN it is preceded by a period to indicate its position at the root of the namespace. Example: freake.amigos.cu. is he FQDN from 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:

Cache Server ("Caching Nameserver"): Requests or requests made to the server will be resolved by the Forwarders that we declare in your configuration. The responses will be stored and “remembered” for when the Cache Server is queried again, which greatly increases the response speed.

Primary Teacher ("Primary Master"): Requests or requests made to the server will be resolved by reading the data stored in the local files of the Zones created. As its name indicates, it will be an Authoritative Name Server for the consulted Zone.

Secondary Teacher ("Secondary Master"): Requests or requests made to the server will be resolved by direct consultation with an Authoritarian Primary Master server for the consulted Zone. 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

All the  Areas are plain text files that allow us to organize the DNS records. Each zone name matches the name of a domain, or a range of IP addresses such as one or more subnets. It contains, in addition to other data, various Records! of different Classes or Types, of which we will only mention the following:

SOA"Start of Authority". Beginning of the Authority. It is a mandatory record in each Zone, and there should only be one in each file. It is the preamble to all zone files. Describe the area itself; which machine or host it comes from; who is responsible for its content; which is the version of the zone file, and other aspects concerning the proper functioning of the DNS server. Is essential that in each zone file there is a type record A that identifies the machine or host where the DNS server resides.

NSMaps a name to the Name Server. Each domain must have at least one NS record. This record points to a DNS Server that can answer the queries concerning the domain. You can point to the Primary Teacher or the Secondary Teacher.

A"Address" - (Direction). This record is used to translate host names to IPv4 addresses.

YYYY"Address" - (Direction). This record is used to translate host names to IPv6 addresses.

CNAME:  "Canonical Name" - (Canonical Name). Type of record through which we can give several names to the same host or create Alias of the. Let's say we have the host web.amigos.cu. in which we have installed a web server and we want them to refer to it as www.amigos.cu. Then in the Friends.cu Zone we must have among the other records:

web IN A 192.168.10.20 www IN CNAME web.amigos.cu.

MX"Mail Exchange" o 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, where the highest is the record with the lowest number. Examples:

10 mail1.amigos.cu. 20 mail2.amigos.cu.

PTRMapping an IP address to a name. Types of records stored in the so-called "Reverse Zones". For example, Zone 10.168.192.in-addr.arpa is the one that contains the reverse mapping of all addresses in the 192.168.10.0/24 IP address range

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. The FQDN have to end in a "." (that is, point), and we cannot leave blank spaces at the end of each line. For that reason we strongly recommend the use of console editors such as vi or  dwarf. We will use the dwarf, which in our opinion is easier to use. Of course we can also use plain text editors with a graphical or GUI environment.

I hope you have not been bored because there is still a little to go into the matter.

There are other "Backends" for DNS servers such as LDAP, MySql, PostgreSQL, SQLite, etc.

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   commentator said

    The article looks good and complete, I hope to read it soon.

  2.   rots87 said

    Too bad I'm at work because I would like to read it carefully ...

  3.   creeping_death said

    Excellent contribution.

  4.   KZKG ^ Gaara said

    Great that you put these articles here ... thanks for your help Fico 😀

  5.   Mr Black said

    Excellent! Waiting for the other parts, these posts with "substance" are worth it, thanks

  6.   Julius Caesar said

    Excellent article my great friend FICO

  7.   fico said

    Thank you all for your comments .. 🙂

  8.   Francisco said

    Hi, hey, and do you think you can give me some tips to install a Linux DNs service for my network, I'm still new to that and they don't give me some services as expected for my users.

    regards