named – TecAdmin https://tecadmin.net How to guide for System Administrator's and Developers Wed, 20 Apr 2022 09:01:17 +0000 en-US hourly 1 https://wordpress.org/?v=6.1.1 How to Setup Master Slave DNS Server on CentOS 6 and RHEL https://tecadmin.net/how-to-setup-master-slave-dns-server-on-centos-6-and-rhel/ https://tecadmin.net/how-to-setup-master-slave-dns-server-on-centos-6-and-rhel/#comments Tue, 21 May 2013 10:12:12 +0000 https://tecadmin.net/?p=1437 The DNS ( Domain Name System ) is a distributed system, used for transalate domain names to IP and vice a versa. This article will help you to How to Setup Master Slave DNS Server on CentOS 6 and RHEL Systems. Network Scenario for this Setup Master DNS Server IP: 192.168.1.90 ( ns1.tecadmin.net ) Slave [...]

The post How to Setup Master Slave DNS Server on CentOS 6 and RHEL appeared first on TecAdmin.

]]>
The DNS ( Domain Name System ) is a distributed system, used for transalate domain names to IP and vice a versa. This article will help you to How to Setup Master Slave DNS Server on CentOS 6 and RHEL Systems.

Network Scenario for this Setup
Master DNS Server IP: 192.168.1.90 ( ns1.tecadmin.net )
Slave  DNS Server IP: 192.168.1.91 ( ns2.tecadmin.net )
Domain Name : demotecadmin.net   ( For Testing Purpose )
Domain IP   : 192.168.1.100  ( For Testing Purpose )
Step 1: Install Required RPMS ( at Master and Slave Both )

Install bind packages at both Master and Slave dns servers using following commands.

# yum install bind bind-chroot
Step 2: Setup Master (NS1) DNS Server

There are two types of configuration files in DNS.

  • One is main dns configuration files named “named.conf”
  • Another type of configuration file are called zone file. Which is individually created for all domains. named.conf keeps an entry for all zone files.
2.1 Configure named.conf using below configuration
# vim /var/named/chroot/etc/named.conf

Content of named.conf:

// /var/named/chroot/etc/named.conf
options {
        listen-on port 53 { 127.0.0.1; 192.168.1.0/24; };
        listen-on-v6 port 53 { ::1; };
        directory       "/var/named";
        dump-file       "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
        allow-query     { localhost; 192.168.1.0/24; };
        recursion yes;

        dnssec-enable yes;
        dnssec-validation yes;
        dnssec-lookaside auto;

        /* Path to ISC DLV key */
        bindkeys-file "/etc/named.iscdlv.key";

        managed-keys-directory "/var/named/dynamic";
};

logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};

zone "." IN {
        type hint;
        file "named.ca";
};

zone "demotecadmin.net" IN {
        type master;
        file "/var/named/demotecadmin.net.db";
	allow-update { none; };
};

include "/etc/named.rfc1912.zones";

[Change red highlighted values as per you network and domain name ]

2.2 Create a zone file for you domain “demotecadmin.net”
# vim /var/named/chroot/var/named/demotecadmin.net.db

Content of zone file:

; Zone file for demotecadmin.net
$TTL 14400
@      86400    IN      SOA     ns1.tecadmin.net. webmaster.tecadmin.net. (
                3215040200      ; serial, todays date+todays
                86400           ; refresh, seconds
                7200            ; retry, seconds
                3600000         ; expire, seconds
                86400 )         ; minimum, seconds

demotecadmin.net. 86400 IN NS ns1.tecadmin.net.
demotecadmin.net. 86400 IN NS ns2.tecadmin.net.
demotecadmin.net. IN A 192.168.1.100
demotecadmin.net. IN MX 0 demotecadmin.net.
mail IN CNAME demotecadmin.net.
www IN CNAME demotecadmin.net.
2.3 Add more domains in dns server

To add more domains in dns, create zone files individually for all domain as above. After that add any entry for all zones in named.conf like below. Change demotecadmin.net with your domain name.

zone "demotecadmin.net" IN {
        type master;
        file "/var/named/demotecadmin.net.db";
	allow-update { none; };
};
Step 2.4: Start named service

Start named (bind) service using following command and setup auto start on system boot.

# /etc/init.d/named restart
# chkconfig named on
Step 3: Setup Slave (NS2) DNS Server

At slave dns server you need to update named.conf file only. All zone files will automatically synced from master dns server. Any changes done on Master will reflect on slave after a specified time interval.

3.1 Configure named.conf using below configuration
# vim /var/named/chroot/etc/named.conf

Content of named.conf

// /var/named/chroot/etc/named.conf
options {
        listen-on port 53 { 127.0.0.1; 192.168.1.0/24; };
        listen-on-v6 port 53 { ::1; };
        directory       "/var/named";
        dump-file       "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
        allow-query     { localhost; 192.168.1.0/24; };
        recursion yes;

        dnssec-enable yes;
        dnssec-validation yes;
        dnssec-lookaside auto;

        /* Path to ISC DLV key */
        bindkeys-file "/etc/named.iscdlv.key";

        managed-keys-directory "/var/named/dynamic";
};

logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};

zone "." IN {
        type hint;
        file "named.ca";
};

zone "demotecadmin.net" IN {
	type slave;
        file "slaves/demotecadmin.net.db";
	masters { 192.168.1.90; };
};

include "/etc/named.rfc1912.zones";
Step 3.2: Start named Service

Start named (bind) service using below command.

# /etc/init.d/named restart
# chkconfig named on

After restarting named service, Check zone files on slave dns server at /var/named/chroot/var/named/slaves/.

Step 4: Finally Test Your DNS Setup

Query to your Master and Slave DNS Server directly using following commands, You will get the same resonse from both servers.
Syntax: nslookup <domainname.com> <dns server name/ip>

Query to Master DNS Server:

# nslookup demotecadmin.net 192.168.1.90

Server:         192.168.1.90
Address:        192.168.1.90#53

Name:   demotecadmin.net
Address: 192.168.1.100

Query to Slave DNS Server:

# nslookup demotecadmin.net 192.168.1.91

Server:         192.168.1.91
Address:        192.168.1.91#53

Name:   demotecadmin.net
Address: 192.168.1.100

Above outputs is showing that dns server has successfully resolved domain demotecadmin.net from master and slave dns servers.

Read more about dns servers http://en.wikipedia.org/wiki/Name_server

The post How to Setup Master Slave DNS Server on CentOS 6 and RHEL appeared first on TecAdmin.

]]>
https://tecadmin.net/how-to-setup-master-slave-dns-server-on-centos-6-and-rhel/feed/ 1
How To Check bind9 (DNS Server) Configuration Files https://tecadmin.net/check-dns-configuration-file-bind/ https://tecadmin.net/check-dns-configuration-file-bind/#comments Thu, 04 Apr 2013 12:10:38 +0000 https://tecadmin.net/?p=793 Command named-checkconf checks the syntax only of a DNS (bind) configuration file. The file is parsed and checked for syntax errors, along with all files included by it. If there is no file specified with the command, /etc/named.conf is read by default. 1. Check bind9 (DNS) Configuration In case of any changes done in the [...]

The post How To Check bind9 (DNS Server) Configuration Files appeared first on TecAdmin.

]]>
Command named-checkconf checks the syntax only of a DNS (bind) configuration file. The file is parsed and checked for syntax errors, along with all files included by it. If there is no file specified with the command, /etc/named.conf is read by default.

1. Check bind9 (DNS) Configuration

In case of any changes done in the bind configuration, I recommend checking the DNS configuration file before restarting the service.

named-checkconf /etc/named.conf 

If the bind is running in chroot environment use the below command also along with the above command

named-checkconf -t /var/named/chroot /etc/named.conf 

The above command will show nothing if there is no error found in the configuration file. In case of any error will be displayed as output.

2. Check Bind Zone File

To check the syntax of the zone file using the command below. It will show the result in both cases.

named-checkzone demotecadmin.net /var/named/demotecadmin.net.db 

Sample output;

zone demotecadmin.net/IN: loaded serial 3013040200
OK

3. Check Configuration file in Older version of Bind

If you are using an older version of the bind, you can have also checked the configuration using the below command.

service named configtest 

Sample Outut:

zone tool.com/IN: loaded serial 42
zone localhost/IN: loaded serial 42
zone 1.168.192.in-addr.arpa/IN: loaded serial 1997022700
zone 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa/IN: loaded serial 1997022700
zone 255.in-addr.arpa/IN: loaded serial 42
zone 0.in-addr.arpa/IN: loaded serial 42

The post How To Check bind9 (DNS Server) Configuration Files appeared first on TecAdmin.

]]>
https://tecadmin.net/check-dns-configuration-file-bind/feed/ 1
How to Setup DNS (Bind) Server on CentOS/RHEL 7/6/5 https://tecadmin.net/setup-dns-server-on-centos-redhat/ https://tecadmin.net/setup-dns-server-on-centos-redhat/#comments Tue, 02 Apr 2013 11:38:07 +0000 https://tecadmin.net/?p=774 The DNS (Domain Name System) is a distributed system, used for translate domain names to IP address and vice a versa.For example when we type domain name in browser url like “https://tecadmin.net”, Our computer sends a request to DNS and get an ip address of domain. This article will help you to step by step [...]

The post How to Setup DNS (Bind) Server on CentOS/RHEL 7/6/5 appeared first on TecAdmin.

]]>
The DNS (Domain Name System) is a distributed system, used for translate domain names to IP address and vice a versa.For example when we type domain name in browser url like “https://tecadmin.net”, Our computer sends a request to DNS and get an ip address of domain.

This article will help you to step by step setup dns server on CentOS and RedHat systems.

Network Scenario:

  • DNS Server IP: 192.168.1.254
  • DNS Server Name: ns1.tecadmin.net, ns2.tecadmin.net
  • Domain Name: demotecadmin.net
  • Domain IP to point: 192.168.1.100

Step 1 – Install Bind Packages

Bind packages are available under default yum repositories. To install packages simple execute below command.

# yum install bind bind-chroot

Step 2 – Edit Main Configuration File

Default bind main configuration file is located under /etc directory. But using chroot environment this file is located at /var/named/chroot/etc directory. Now edit main configuration file and update content as below.

# vim /var/named/chroot/etc/named.conf

Content for the named.conf file

// /var/named/chroot/etc/named.conf
options {
        listen-on port 53 { 127.0.0.1; 192.168.1.0/24; 0.0.0.0/0; };
        listen-on-v6 port 53 { ::1; };
        directory       "/var/named";
        dump-file       "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
        allow-query     { localhost; 192.168.1.0/24; 0.0.0.0/0; };
        recursion yes;

        dnssec-enable yes;
        dnssec-validation yes;
        dnssec-lookaside auto;

        /* Path to ISC DLV key */
        bindkeys-file "/etc/named.iscdlv.key";

        managed-keys-directory "/var/named/dynamic";
};

logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};

zone "." IN {
        type hint;
        file "named.ca";
};

zone "demotecadmin.net" IN {
        type master;
        file "/var/named/demotecadmin.net.db";
};

include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";

Step 3 – Create Zone File for Your Domain

After creating bind main configuration file, create a zone file for you domain as per configuration, for example demotecadmin.net.db in this article.

# vim /var/named/chroot/var/named/demotecadmin.net.db

Content for the zone file

; Zone file for demotecadmin.net
$TTL 14400
@      86400    IN      SOA     ns1.tecadmin.net. webmaster.tecadmin.net. (
                3013040200      ; serial, todays date+todays
                86400           ; refresh, seconds
                7200            ; retry, seconds
                3600000         ; expire, seconds
                86400          ; minimum, seconds
      )
demotecadmin.net. 86400 IN NS ns1.tecadmin.net.
demotecadmin.net. 86400 IN NS ns2.tecadmin.net.
demotecadmin.net. IN A 192.168.1.100
demotecadmin.net. IN MX 0 mail.demotecadmin.net.
mail 			  IN CNAME demotecadmin.net.
www 			  IN CNAME demotecadmin.net.

If you are having more domain, its required to create zone files for each domain individually.

Step 4 – Add More Domains

To add more domains in dns, create zone files individually for all domain as above. After that add any entry for all zones in named.conf like below. Change demotecadmin.net with your domain name.

zone "demotecadmin.net" IN {
        type master;
        file "/var/named/demotecadmin.net.db";
};

Step 5 – Start Bind Service

Start named (bind) service using following command.

# service named restart

Enable auto start on system boot.

# chkconfig named on
Step 6 – Test Your DNS Setup

Send query to your dns server directly using below command.
Syntax: nslookup <domainname> <dns server name/ip>

# nslookup demotecadmin.net 192.168.1.254 


Server:         192.168.1.254
Address:        192.168.1.254#53

Name:   demotecadmin.net
Address: 192.168.1.100

Above output is showing that dns server has successfully resolved domain demotecadmin.net.

The post How to Setup DNS (Bind) Server on CentOS/RHEL 7/6/5 appeared first on TecAdmin.

]]>
https://tecadmin.net/setup-dns-server-on-centos-redhat/feed/ 11