Archive | DNS RSS feed for this section

MX record from zone file of a BIND DNS server

The Linux BIND is not very difficult to configure but sometimes gives some strange errors and it fails to start.

I configured BIND for a linux server with only a single zone. Let’s call it domain-name-1.com. All went well until I added another domain: domain-name-2.net. Then made a few modifications to the domain-name-2.net and suddenly my little DNS server didn’t start.

Here is the list of errors that I received when I gave the command :

$ /etc/init.d/ named start


Starting named:
Error in named configuration:
zone localhost/IN: loaded serial 2011020802
zone 0.0.127.in-addr.arpa/IN: loaded serial 2011021801
zone domain-name-1.com /IN: loaded serial 2010081401
dns_rdata_fromtext: domain-name-2.net:11: near ’62.211.94.220′: not a valid number
dns_rdata_fromtext: domain-name-2.net:17: near ’62.211.94.220′: not a valid number
zone mytanningbeds.net/IN: loading master file domain-name-2.net: not a valid number
_default/ domain-name-2.net/IN: not a valid number

First I looked in the /etc/named.conf which is the main configuration file for BIND and which points to the file zones. I looked but nothing suspicious. The directory with filezones was set to /var/named to my DNS server.

As the error looked it seemed an error of filezone. So I begun to look closely at them. It seemed suspicious the zone for domain-name-2.net.

It looked like this :

$ cat domain-name-2.net

$TTL 3600
@               IN      SOA     ns1. domain-name-2.net. root (
2010101301      ;serial
3600           ;refresh
1800           ;retry
604800         ;expire
3600           ;negative caching
)
IN      NS      ns1. domain-name-2.net.
domain-name-2.net.              IN      A       62.211.94.220
domain-name-2.net.              IN      MX    62.211.94.220
;NAME SERVERS

IN      NS      ns1. domain-name-2.net.
ns1             IN      A       62.211.94.220
www             IN      A       62.211.94.220
mail            IN      MX      62.211.94.220

After some documentation about this problem on the internet I found that the MX statement (in red) was not complete. I was knowing that the MX records also have a setting called priority but I didn’t think that is so crucial in the definition of the file zone. So, when I configured the zone file I let him apart. Big mistake.

The correct approach is always to specify the priority. So the correct zone file after I rectified these is (with bold green) :

$ cat domain-name-2.net

$TTL 3600
@               IN      SOA     ns1. domain-name-2.net. root (
2010101301      ;serial
3600           ;refresh
1800           ;retry
604800         ;expire
3600           ;negative caching
)
IN      NS      ns1. domain-name-2.net.
domain-name-2.net.              IN      A       62.211.94.220
domain-name-2.net.              IN      MX    10      62.211.94.220
;NAME SERVERS
IN      NS      ns1. domain-name-2.net.
ns1             IN      A       62.211.94.220
www             IN      A       62.211.94.220
mail            IN      MX      10        62.211.94.220

The MX priority is of great importance in the definition of the MX setting. It can happen that large mail servers have multiple MX records, secondary mail servers used as a backup solution. With the help of this priority we can tell the DNS where to look first. These values have usually values multiple of 5 beginning from 0. A typical priority for the majority of the mail server is 10. But if I have 3 different mail servers for a single domain I can use values of 0, 10 and 20 for the different mail servers. The server with the lowest value will be used and the other successive servers will be used only if the first one doesn’t work.

So this is the problem I confronted with in the configuration of a simple zone file for a domain. Always put the priority in the definition of the MX record.

I made the modification and my BIND DNS server started successfully. Problem solved.