Full configuration of BIND and DNS on the new server

After buying a VPS or dedicated server at a vendor usually we get the IP address and host name, which is more like another order number, domain provider. In contrast, today introduce how to install and configure BIND for domains.

THE:
DNS server configuration.
Basic will be on my VPS server, while the creation of the reserve will use one of the free services of maintaining the DNS freedns.42.pl.

Changing the host name

The name of the new server, you can check command:

Configuration hostname:

Edit your nano /etc/hosts

The file should look like this:

the next step is to edit the file nano / etc / hostname

And we enter the hostname node

We make a server restart.
When you log into the console, we can verify all the commands:

Go to the main configuration Binda.

In the beginning, make sure, that is installed BIND name server. In case if it has not yet been, This installation looks like this:

securing BIND

BIND is quite common program, therefore, it is polite to use security, namely it to close environment chrootowalnym. You must first stop the whole service

Then edit the file / etc / default / bind9, and change the value of the parameter OPTIONS, to make it look like this:

Next you need to create new folders and reorganize the default directories created by the program to new location:

If you leave the site transferred directory symbolic link:

It is also necessary to create a null and random devices and give the appropriate rights:

BIND is closed environment chrootowalnym. There remains the solution to the problem of logging. To events were logged into the system logs should be slightly modify the file / etc / default / syslogd. You should find there SYSLOGD line parameter and modify it, that looked like:

It remains only to restart sysklogd services and the launch of bind9.

The log / var / log / syslog you a preview if everything is properly launched.
And now you can go to the proper settings

First, check the file /etc/bind/named.conf
In my case, you see, it is divided into sub-parts of the files you include: named.conf.options i named.conf.local

We start by checking the file named.conf.options, because, in principle, in my case, the default settings are for the time being as the most adequate, and it looks something like this:

Next, you will need to have something to write and edit the file named.conf.local, where is defined zones supported by the server. At the end of the file writes my zone:

Type master is referenced, it is a basic type.
File points to a file with the details for that domain. Given here is the absolute address to the file, which you will need to create a moment. Giving the same file name here, directory where the file should be found in the directory specified in the parameter file directory named.conf.options.
Notify yes powoduje, that about any changes in the entry shall be communicated to the primary DNS is also up.
Allow-transfer defines the IP addresses, which will have permission to download this zone, Here are just a specific DNS server addresses mentioned at the beginning of the service freedns.42.pl, which will provide backup servers here (secondary)

Then create a file indicated above with entries for the domain /etc/bind/serwerweb.pl

In brief:

$TTL - specifies the time validity of the results (in seconds)
$ORIGIN - domain name. Later in the @ is precisely this value.
When the file appears somewhere in the domain name then you have to finish it dot, otherwise the domain name is appended (value of $ ORIGIN)
@ IN SOA ... - Start Of Authority announces the primary DNS server, and who manages it (e-mail written with a dot in place of the monkey)

As is clear from the file I have defined for your domain up to three DNS servers. In two completely suffice here.
The first basic ns1.serwerweb.pl supported by my server, where the domain will also be installed, two more (ns2.serwerweb.pl i ns3.serwerweb.pl) This addresses backups created on the site freedns.42.pl.

Before moving to the zone configuration backup, should approve the changes by restarting the service bind9

You can still check that all entries made just for the zone are correct calling such a program:

If something did not agree or has committed a typo this drastic program will inform, roughly where to look for error.

In addition, the following command you can check if a domain has been correctly added (should appear after the)
1

That's all, we have a fully configured correctly BIND.

How useful this post was?

Click on the star, to evaluate it!

Average grade / 5. number of votes:

So far, no votes! Be the first to rate this post.