Configure DNS servers Bind9 Debian 6.0.4

Lecturer in discipline “computer networksasked me to show students during practical training, how to install the network operating system (for example, Debian) and configure at least a couple of frequently used server. A friend told a bit of the DNS server, and sample-based pokazi Bind9.
This article will be about configuring Bind9 and it focuses on beginners. I’ll show you how to install a DNS server and a bit to set it up. Maybe someone will be interested in reading. If you are interested inyou know what to do.
I will not go into the details of installing Debian, as well as the basic network settings and apache2 (http server). About installing Debian can be read here, and about the apache2 here. Also, my version of the demo and full Bind9 configuration does not include security, etc.
And so, first you need to install the DNS server. This is done with a single command:


Now when starting Bind9, switch to the folder that contains the main settings:
We will display the list of files the command ls. We are interested in the named.conf.local file. It records the settings of domain zones on the local network. Open it for editing:
Add at the end the following lines:
Let’s break down what it means. The first line means the beginning of the zone settings for Second line-type zone. Master type means that the server broadcasts a domain record is its creator. The third line specifies a file in which to set detailed settings domain zone. An arbitrary file name, for ease of use the name matching the name of a domain zone. As you can see, all the information about the domain zone is enclosed in braces, and after each configuration add a semicolon.
The zone is not working, you need to perform the detailed configuration and determine the IP to which it belongs. To do this, create a configuration file for the zone which we specified for it in the named.conf.local. Go to the folder and create the appropriate file:


File has been created, open it for editing:
Note: for writing this article I set apache and bind on the same machine, and appointed her IP address, and the client has obtained an IP address, and client preferences I put the DNS server address is
Now shall write the following text in the configuration file, that is all it means, I will explain below:


And so, let’s go step by step. The first line of the $TTL 1 d means life time domain record, in this case one day (1 d = 1 day). The second line describes the source domain zone (localhost) and email the administrator (admin localhost.). You probably noticed the lack of the “@” sign in an email address? Since the @ sign is used as a macro, and means the current domain zone that an e-mail address is not in the place it is not the point. Another feature, all DNS host names or e-mail addresses end with a period.
Note: in the settings of the domain zone records 5 numbers. The first 10 signed is a serial number, the rest of this refresh, retry, and minimum expiry in seconds or in a time Bind.
Next open parenthesis, and 5 numeric entries. The first entry (serial) 2012022901 is the serial number. It is on this principlethe first 8 digits of the current date (year, month, day 29 02 2012), and the second two just a number. If you changed any settings, change your domain zone and the serial number. If the change happens several times a day to change the last two digits if less is just a date. When you update the hosts synchronise the serial number and if it is larger than the update all settings of the current record.
The following number 12 h (refresh) is responsible for the time after which the secondary DNS server will attempt to update your domain record. Recommended display from 1200 to seconds (if the data changes frequently) up to 12:0 (if the data changes infrequently).
Next is 180 (retry). The number of seconds to indicate the time that a secondary server will wait, if you are unable to gain entry after you attempt to update (refresh).
The following number of 1W (expiry) defines the time after which the secondary DNS server to stop responding to requests on this record. It will last until will not be able to update it with the master server.
And the last number 3 h (minimum) is used to store the default TTL value for older versions of bind. After the parenthesis is closed.
The penultimate line specifies which DNS server translates domain zone in your current network. And the last is what address matches the domain record.
You can now save and close the file. Restart the Bind that the changes take effect:


If we do not have syntax errors in the configuration files, the Bind will be started successfully. Now let’s check: