Archive

Posts Tagged ‘bind’

Berkeley Internet Name Domain aka. BIND DNS Server

July 6th, 2011 No comments

Presentation

BIND is a DNS serverinstalled on a UNIX distribution. It allows you to resolve IPs in domain name and domain names into IP addresses.

bind server

Installation

The installation went on CentOS:

[root @ localhost ~] # yum-y install bind bind-chroot bind-libs bind-utils caching-nameserver

The installation runs without too much trouble ^^. Now we can proceed to the configuration.

 

Configuration
General Setup

The general configuration of BIND is in the following file:

[root@localhost~]#vim/etc/named.conf

Some configuration settings:

  • listen-on {127.0.0.1; 192.168.0.1;}: Allows you to configure IP addresses on which we must listen
  • directory “/var/named”: Allows you to set which files will be placed in the zone files
  • pid-file “named.pid”: Allows you to define which file will be used as a lock file for the service

 

Start/restart the DNS service:

[root@localhost~]#service named[start|restart|stop]

 

Configuring zones

To configure a zone, go to the /etc/named.conf, then you can add one via the following pattern:

{} {zone nom_de_zone
file "fichier_de_zone";
type [master | slave | forward | hint];
}

file: Defines the path to the zone file in the /var/named
type: Set the type of zone sets

Now that we have defined the area and the type of area, we will have to configure the zone file. Create the zone file corresponding to the path defined in named.conf then edit it as follows:

example.org. IN SOA ns.example.org. root.example.org. (
2003080800
172800
900
1209600
3600)
IN NS ns.example.org.
ns.example.org. IN A 192.168.1.5
test1.example.org. IN A 192.168.1.10
www.example.org. IN CNAME test1.example.org.

The above file contains the DNS record for the domain “example.org”.

 

Configuring reverse zones

Now we can move on to configuring the reverse zones. It is configured first in the /etc/named.conf:

zone "1.168.192.in-addr.arpa" {
file "chemin_vers_le_fichier_de_zone_inversee";
type master;
};

Here we have defined a reverse zone for the domain example.org uses IP addresses from 192.168.1.0 to 192.168.1.255 hence the name of the zone “1.168.192.in-addr.arpa.”

Now we will need to configure the reverse zone file. Create the zone file corresponding to the path defined in named.conf then edit it as follows:

@ IN SOA ns.example.org. root.example.org. (
2003080800
172800
900
1209600
3600)
IN NS ns.example.org.
5 IN PTR ns.example.org.
10 IN PTR test1.example.org

5 and 10 correspond to the last byte of the IP address 192.168.1.5 (which is ns.example.org) and 192.168.1.10 (which is test1.example.org).

Service restarts

Do not forget to restart the service in order to apply the changes:

[root@localhost~]#service named restart

Conclusion

We have seen that BIND can be used as a DNS server to allow us to be able to resolve domain names into IP addresses (and vice versa). Its configuration does seem a bit complicated, to facilitate the configuration of this service, we can consider for example the configuration script to avoid having too many lines to type.