Practice
Task: install and perform the initial configuration of the bind DNS server (also known as named) on Linux Debian OS.
Installing
Configuring
First, let's tell the syslog daemon that it should listen for and write logs from the DNS server. To do this, open the file /etc/rsyslog.conf and add the following entry at the very end of the file:
this tells the system to write bind logs to the file /var/log/named.log
Restart the logging daemon:
Next, bind stores its settings at /etc/bind. Let's go to this directory - everything from now on will happen there.
It is assumed that this is our master server (i.e. primary).
1) Create the directory that will hold the configurations of our DNS zones.
2) Open the named.conf.options file for editing and bring it to this form (all options are commented, you need to set their values correctly for your own setup, not just copy the examples):
Save the file.
3) Now open the named.conf file and see that it contains 3 references to our configurations:
We will add one more reference - to the file with the descriptions of our DNS zones:
And let's save this config file.
4) Now let's create the file /etc/bind/named.conf.zones and write a test zone into it. This file will look something like this:
As we can see here, I specified a zone "test.int" that deliberately doesn't exist on the internet. Its type on this server is master (i.e. it is a master zone, meaning its updates should be managed on this server) and its description should be taken from the specified file.
5) Well then, let's create such a file:
And let's put roughly this config into it (again, the correct IP address and name values depend on your network):
As you can see, I threw in all the values in this zone completely at random.
Now let's save our file.
6) Ask bind to reread our configs:
7) Let's check:
And look at the result. The server should respond that test.int is located at address 192.168.0.50 (as specified in the zone configuration above, or another address - whichever you entered).
The DNS server's further life
All the other zones are created in a similar way, but with real details (for example, from the .ru, .com zones, etc.) The named.conf.zones file looks something like this:
And for each zone we create a small file with its configuration in /etc/bind/master, similar to the test.int sample configuration.
PS. Tip. Do NOT forget to put ";" in the named config everywhere it's needed! The absence of a single such semicolon will break the launch of the entire bind.
PPS. Do NOT forget to put a trailing dot "." at the end of zones that are absolute (recommended pretty much everywhere). That is, for example, if instead of "test.int." you write "test.int" in the zone config - you will get something completely different from what you expected! And, accordingly, nothing at all will work.
PPPS. When making any change to a zone - don't forget to increase its serial number. And not just change it - specifically increase it. In this case, using the format YYYYMMDDNN, where YYYY is the 4-digit year, MM is the 2-digit month, DD is the 2-digit day, and NN is "how many times I've changed the zone today" - is quite convenient, since over time its numeric value will only increase.
Slave DNS servers
If you need to set up slave DNS servers right away - read the article that describes how to do this
Applies to: Linux Debian Lenny (5), Squeeze (6)
Comments