Preguntes Freqüents - FAQ
Configure DNS (BIND) Server on CentOS 7 / RHEL 7
The Domain Name System (DNS) is a hierarchical distributed naming system for computers, services, or any resource connected to the Internet or a private network. It associates various information with domain names assigned to each of the participating entities.
Most importantly, it translates domain names meaningful to humans into the numerical identifiers associated with networking equipment for the purpose of locating and addressing these devices worldwide.
Install BIND package
BIND stands for Berkeley Internet Name Domain, a software which provides an ability to perform name to ip conversion.
# yum -y install bind bind-utils
Configure BIND
Configuration file of bind is /etc/named.conf, open up /etc/named.conf file. Comment out the following line, and this will enable BIND to listen on all ip addresses.
#listen-on port 53 { 127.0.0.1; };
#listen-on-v6 port 53 { ::1; };
Change localhost to any and this will allow clients from the mentioned network can query the DNS for the name to ip translation.
allow-query { any; };
Create Zones
The following is the forward zone entry in named.conf file, written for the domain.local domain. Edit /etc/named.conf.
zone "domain.local" IN {
type master;
file "domain.local";
};
Create zone files
Now, it’s the time to create a lookup file for a created zone. By default, zone lookup files are placed under /var/named directory. Create a zone file called fwd.domain.local for forward lookup under /var/named directory. All domain names should end with a dot (.).
There are some special keywords for Zone Files
A – A record
NS – Name Server
MX – Mail for Exchange
CNAME – Canonical Name
$TTL 86400 @ IN SOA primary.domain.local. root.domain.local. ( 2014112511 ;Serial 3600 ;Refresh 1800 ;Retry 604800 ;Expire 86400 ;Minimum TTL ) ;Name Server Information domain.local. IN NS ns1.domain.local. ;IP address of Name Server primary IN A 192.168.12.8 ;Mail exchanger domain.local. IN MX 10 mail.domain.local. ;A - Record HostName To Ip Address www IN CNAME domain.local. mail IN A 192.168.12.150 ;CNAME record ftp IN CNAME domain.local.
Once zone files are created, restart bind service.
# systemctl restart named.service
Enable it on system startup.
# systemctl enable named.service