bind – TecAdmin https://tecadmin.net How to guide for System Administrator's and Developers Sun, 11 Dec 2022 06:22:10 +0000 en-US hourly 1 https://wordpress.org/?v=6.1.1 How to Setup Forward Only DNS Server on Ubuntu & Debian https://tecadmin.net/setup-forward-only-dns-server-on-ubuntu-linuxmint/ https://tecadmin.net/setup-forward-only-dns-server-on-ubuntu-linuxmint/#comments Thu, 08 Oct 2015 12:38:39 +0000 https://tecadmin.net/?p=8771 The Domain Name System (DNS) is a hierarchical distributed naming system for computers connected over network. It resolves ip address correspondence to a domain name. A forward-only DNS server does not keep the domain information. If any query comes to this server, it forwards to the configured DNS server. A details information about DNS is [...]

The post How to Setup Forward Only DNS Server on Ubuntu & Debian appeared first on TecAdmin.

]]>
The Domain Name System (DNS) is a hierarchical distributed naming system for computers connected over network. It resolves ip address correspondence to a domain name. A forward-only DNS server does not keep the domain information. If any query comes to this server, it forwards to the configured DNS server. A details information about DNS is available.

This article will help you to configure forward only Domain Name System (DNS) using Bind9 on Ubuntu, Debian, and LinuxMint systems.

Install DNS Packages

Bind9 is the most popular DNS server used worldwide. It is available under default apt-get repositories. So use the following commands to install the Bind9 domain name system.

sudo apt update
sudo apt install bind9

Enable DNS Forwarding

We are configuring this server as forward only dns server. So edit bind configuration file

$ sudo vi /etc/bind/named.conf.options

and add the following settings:


options{
        directory "/var/cache/bind";
      	recursion yes;
        allow-query { 192.168.0.0/32; 127.0.0.1; };
        forwarders {
                8.8.8.8;
                8.8.4.4;
         };
	 forward only;

}

Change the DNS server 8.8.8.8 and 8.8.4.4 with suitable DNS server IPs. Using allow-query we can restrict access of dns server to specific IP ranges. To make it public dns server, comment allow-query line.

Verify Configuration Files

After making all configuration, verify all files using the following commands.

named-checkconf  /etc/bind/named.conf
named-checkconf  /etc/bind/named.conf.options

If any of the above commands return error or warning, Please fix that before proceeding to the next step.

Restart DNS

After successful verification of all files, let’s restart the bind9 service using the following command.

sudo service bind9 restart

Test Setup

Finally, your DNS server is successfully configured and ready to use. Let’s verify that DNS is properly responding to queries. Below is the example commands to test it.

dig tecadmin.net 


; <<>> DiG 9.9.5-3ubuntu0.5-Ubuntu <<>> tecadmin.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 56343
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 13, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;tecadmin.net.			IN	A

;; ANSWER SECTION:
tecadmin.net.		299	IN	A	104.27.189.217
tecadmin.net.		299	IN	A	104.27.188.217

;; AUTHORITY SECTION:
.			7776	IN	NS	c.root-servers.net.
.			7776	IN	NS	i.root-servers.net.
.			7776	IN	NS	b.root-servers.net.
.			7776	IN	NS	l.root-servers.net.
.			7776	IN	NS	h.root-servers.net.
.			7776	IN	NS	e.root-servers.net.
.			7776	IN	NS	a.root-servers.net.
.			7776	IN	NS	f.root-servers.net.
.			7776	IN	NS	k.root-servers.net.
.			7776	IN	NS	j.root-servers.net.
.			7776	IN	NS	m.root-servers.net.
.			7776	IN	NS	d.root-servers.net.
.			7776	IN	NS	g.root-servers.net.

;; Query time: 1332 msec
;; SERVER: 192.168.0.60#53(192.168.0.60)
;; WHEN: Thu Oct 08 16:24:11 IST 2015
;; MSG SIZE  rcvd: 281

The post How to Setup Forward Only DNS Server on Ubuntu & Debian appeared first on TecAdmin.

]]>
https://tecadmin.net/setup-forward-only-dns-server-on-ubuntu-linuxmint/feed/ 3
How to Setup Your Own DNS Server on Ubuntu & Debian https://tecadmin.net/configure-dns-server-on-ubuntu-linuxmint/ https://tecadmin.net/configure-dns-server-on-ubuntu-linuxmint/#comments Thu, 08 Oct 2015 05:32:02 +0000 https://tecadmin.net/?p=8749 Ubuntu is one of the most popular Linux distributions, and it is widely used by web developers and system administrators alike. Setting up a DNS server on Ubuntu is a relatively straightforward process, and in this blog article, I will walk you through the steps you need to take to set up a DNS server [...]

The post How to Setup Your Own DNS Server on Ubuntu & Debian appeared first on TecAdmin.

]]>
Ubuntu is one of the most popular Linux distributions, and it is widely used by web developers and system administrators alike. Setting up a DNS server on Ubuntu is a relatively straightforward process, and in this blog article, I will walk you through the steps you need to take to set up a DNS server on Ubuntu.

A DNS server is a computer that acts as a translator between the IP address and the domain name. It is responsible for translating the domain name into its corresponding IP address. By setting up a DNS server on Ubuntu, you will be able to manage your DNS records and improve the performance of your website.

Are you looking for an easy way to set up a DNS server on Ubuntu? Well, you have come to the right place! In this blog article, I will provide you with a comprehensive step-by-step guide on how to quickly and easily set up a DNS server on Ubuntu.

Whether you are a beginner or an expert, this guide will help you set up a DNS server on Ubuntu in no time. So, let’s get started!

Step 1 – Install DNS (bind9) Packages

The first step in setting up a DNS server on Ubuntu is to install the DNS server. It is a straightforward process, and you can do it by running the following command:

sudo apt update 
sudo apt install bind9 -y 

Step 2 – Create Forward Zone File

A forward DNS zone is responsible for translating the domain name into the corresponding IP address. To set up a forward DNS zone, you need to create a zone file for each domain that you want the DNS server to manage. For example, if your domain is example.net, then create the zone files by running the following command:

sudo vi /etc/bind/example.net.zone 

Add the following content

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

Save the file and close it.

Then use named-checkzone command to verify the syntax of the configuration file.

sudo named-checkzone example.net /etc/bind/example.net.zone 

On successful, an OK message will appear on the output screen.

Step 3 – Create Reverse Zone File

Generally, reverse DNS configuration is not required, but in some cases, you may need to configure it. This is used to resolve the domain name corresponding to an IP address. For example, we are using the 192.168.1.0/32 IP range in our intranet. Create reverse DNS file named /etc/bind/db.1.168.192 with following content.

sudo vi /etc/bind/db.1.168.192 

and add following content

; BIND reverse data file for local loopback interface
;
$TTL    604800
@ IN SOA ns1.example.net. root.ns1.example.net. (
                     3013040200         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      ns1.example.net.
100     IN      PTR     example.net.
101     IN      PTR     otherdomain.com.

Save the file and verify the file syntax:

named-checkzone 192.168.01.0/32 /etc/bind/db.1.168.192 

On successful, an OK message will appear on the output screen.

Step 4 – Update Bind9 Main Configuration

The next step in setting up a DNS server on Ubuntu is to configure the DNS server. You can do this by editing the configuration file. You can find the configuration file by running the following command:

sudo vi /etc/bind/named.conf.local 

Append following content

zone "example.net" IN {
        type master;
        file "/etc/bind/example.net.zone";
};

zone "1.168.192.in-addr.arpa" {
        type master;
        file "/etc/bind/db.1.168.192";
};

Save the file and check the configuration files:

named-checkconf  /etc/bind/named.conf.local 
named-checkconf  /etc/bind/named.conf 

On successful, nothing will appear on the output screen.

Step 5 – Restart bind9 Service

Once all the configuration files are verified, You can restart the bind9 service o apply changes.

sudo systemctl restart bind9 
sudo systemctl status bind9 
Output
● named.service - BIND Domain Name Server Loaded: loaded (/lib/systemd/system/named.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2022-04-25 12:17:31 IST; 2h 16min ago Docs: man:named(8) Process: 10725 ExecStart=/usr/sbin/named $OPTIONS (code=exited, status=0/SUCCESS) Main PID: 10726 (named) Tasks: 4 (limit: 2271) Memory: 5.6M CPU: 146ms CGroup: /system.slice/named.service └─10726 /usr/sbin/named -u bind

The bind9 service should be active and running.

Step 6 – Testing the DNS Server

Once you have configured the DNS server, you need to test it to make sure that it is working properly. You can do this by running the following command:

dig your_domain.com

This command will query the DNS server for information about the domain example.com. If the DNS server is configured correctly, you should be able to see the IP address of the domain in the output.

Verify Forward Zone:

dig example.net 
Output
; <<>> DiG 9.16.1-Ubuntu <<>> example.net ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 42007 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 1232 ; COOKIE: b8e8bae7636ea5990100000062665dfb3fce096db82322ba (good) ;; QUESTION SECTION: ;example.net. IN A ;; ANSWER SECTION: example.net. 14400 IN A 192.168.1.100 ;; Query time: 4 msec ;; SERVER: 192.168.1.212#53(192.168.1.212) ;; WHEN: Mon Apr 25 14:04:08 IST 2022 ;; MSG SIZE rcvd: 84

Verify Reverse Zone:

dig -x 192.168.1.100 
Output
; <<>> DiG 9.16.1-Ubuntu <<>> -x 192.168.1.100 ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26175 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 1232 ; COOKIE: df64db0c13af750e0100000062665e1e52dc99d0a2d5dd41 (good) ;; QUESTION SECTION: ;100.1.168.192.in-addr.arpa. IN PTR ;; ANSWER SECTION: 100.1.168.192.in-addr.arpa. 604800 IN PTR example.net. ;; Query time: 0 msec ;; SERVER: 192.168.1.212#53(192.168.1.212) ;; WHEN: Mon Apr 25 14:04:43 IST 2022 ;; MSG SIZE rcvd: 108

Conclusion

Setting up a DNS server on Ubuntu is a relatively straightforward process. In this blog article, I have provided you with a comprehensive step-by-step guide on how to quickly and easily setup a DNS server on Ubuntu, Debian and Linux Mint. I hope this guide was helpful and that you were able to set up a DNS server on Ubuntu without any issues.

If you have any questions or comments, please feel free to leave them in the comments section below. I would love to hear your feedback!

The post How to Setup Your Own DNS Server on Ubuntu & Debian appeared first on TecAdmin.

]]>
https://tecadmin.net/configure-dns-server-on-ubuntu-linuxmint/feed/ 2
How to Setup Caching NameServer on CentOS/RHEL 6/5 https://tecadmin.net/setup-caching-nameserver-on-centos-redhat/ https://tecadmin.net/setup-caching-nameserver-on-centos-redhat/#comments Tue, 07 Jan 2014 11:43:07 +0000 https://tecadmin.net/?p=1314 Definition at Wikipedia: Caching name servers, also called DNS caches, store DNS query results for a period of time determined in the configuration (time-to-live) of each domain-name record. DNS caches improve the efficiency of the DNS by reducing DNS traffic across the Internet, and by reducing load on authoritative name-servers, particularly root name-servers. Because they [...]

The post How to Setup Caching NameServer on CentOS/RHEL 6/5 appeared first on TecAdmin.

]]>
Definition at Wikipedia:

Caching name servers, also called DNS caches, store DNS query results for a period of time determined in the configuration (time-to-live) of each domain-name record. DNS caches improve the efficiency of the DNS by reducing DNS traffic across the Internet, and by reducing load on authoritative name-servers, particularly root name-servers. Because they can answer questions more quickly, they also increase the performance of end-user applications that use the DNS. Read more

This article will help you to setup caching nameserver on your CentOS/RHEL 6 system.

Step 1: Install BIND Packages

Install bind packages using below command. In CentOS/RHEL 6 chaching-nameserver package has been included with bind package.

# yum install bind bind-chroot

Step 2: Create Configuration File

Copy bind configuration file from bind sample files using below command. Change the path of files as per version you have installed.

# cd /var/named/chroot/etc
# cp /usr/share/doc/bind-9.9.2/sample/etc/named.conf  .
# cp /usr/share/doc/bind-9.9.2/sample/etc/named.rfc1912.zones  .

Step 3: Update Configuration File

Edit bind configuration file in your favorite editor and make necessary changes as per below settings or use below configuration.

# /var/named/chroot/etc/named.conf
// /var/named/chroot/etc/named.conf
options {
        listen-on port 53 { 127.0.0.1; any; };
        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; any; };
        allow-query-cache    { localhost; any; };
        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;
        };
};

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

Now update required permissions on configuration files using below command.

# chown root:named named.conf named.rfc1912.zones

Step 4: Check Configuration File

We recommend to check DNS configuration file before restarting service.

# named-checkconf named.conf

Step 5: Restart Bind Service

Now installation of bind service has been completed. Lets start bind (named) service using following command.

# service named restart

Enable auto start bind service on system boot.

# chkconfig named on

Step 6: Finally Test Caching Only DNS

Send query to your dns server directly using below command.

Syntax: nslookup <domainname> <caching dns server name/ip>

# nslookup yahoo.com 192.168.1.90

[Sample Output:]

Server:         192.168.1.91
Address:        192.168.1.91#53

Non-authoritative answer:
Name:   yahoo.com
Address: 98.138.253.109
Name:   yahoo.com
Address: 98.139.183.24
Name:   yahoo.com
Address: 206.190.36.45

Congratulation’s! You have successfully configured caching nameserver on your linux system. Read out next articles Configure DNS Server on CentOS/RHE 6 and Setup Master Slave DNS Server on CentOS/RHEL 6.

The post How to Setup Caching NameServer on CentOS/RHEL 6/5 appeared first on TecAdmin.

]]>
https://tecadmin.net/setup-caching-nameserver-on-centos-redhat/feed/ 7
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
Configure RNDC Key for Bind9 ( DNS Server ) https://tecadmin.net/configure-rndc-for-bind9/ https://tecadmin.net/configure-rndc-for-bind9/#comments Thu, 04 Apr 2013 12:45:07 +0000 https://tecadmin.net/?p=800 RNDC controls the operation of a name server. rndc uses tcp connection to communicate with bind server for sending commands authenticated with digital signatures. Configure RNDC Key for Bind9 using below steps. Step 1: Create RNDC Key and Configuration File First step is to create rndc key file and configuration file. rndc provides command line [...]

The post Configure RNDC Key for Bind9 ( DNS Server ) appeared first on TecAdmin.

]]>
RNDC controls the operation of a name server. rndc uses tcp connection to communicate with bind server for sending commands authenticated with digital signatures. Configure RNDC Key for Bind9 using below steps.

Step 1: Create RNDC Key and Configuration File

First step is to create rndc key file and configuration file. rndc provides command line tool rndc-confgen to generate it.

# rndc-confgen

Sample Output:

# Start of rndc.conf
key "rndc-key" {
        algorithm hmac-md5;
        secret "DTngw5O8I5Axx631GjQ9pA==";
};

options {
        default-key "rndc-key";
        default-server 127.0.0.1;
        default-port 953;
};
# End of rndc.conf

# Use with the following in named.conf, adjusting the allow list as needed:
# key "rndc-key" {
#       algorithm hmac-md5;
#       secret "DTngw5O8I5Axx631GjQ9pA==";
# };
#
# controls {
#       inet 127.0.0.1 port 953
#               allow { 127.0.0.1; } keys { "rndc-key"; };
# };
# End of named.conf

Step 2: Configure RNDC Key and Configuration File

2.1 Copy entire output of #1 to /etc/rndc.conf.

2.2 Copy the key section of #1 to /etc/rndc.key file.

# cat /etc/rndc.key
key "rndc-key" {
        algorithm hmac-md5;
        secret "DTngw5O8I5Axx631GjQ9pA==";
};

Step 3: Configure named.conf to Use rndc key

Add below entry in named.conf. I have added it to above option’s section.

include "/etc/rndc.key";

controls {
        inet 127.0.0.1 allow { localhost; } keys { "rndc-key"; };
};

Step 4: Restart Bind Service

Before restarting bind service, I recommend to check configuration file first.

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

If above command shows nothing in output, means configuration is ok, Now restart bind service.

# /etc/init.d/named restart

Step 6: Test RNDC Setup

Test your setup using rndc command as below.

# rndc status

Sample output:

WARNING: key file (/etc/rndc.key) exists, but using default configuration file (/etc/rndc.conf)
version: 9.9.2-P2-RedHat-9.9.2-3.P2.el6
CPUs found: 1
worker threads: 1
UDP listeners per interface: 1
number of zones: 38
debug level: 0
xfers running: 0
xfers deferred: 0
soa queries in progress: 0
query logging is OFF
recursive clients: 0/0/1000
tcp clients: 0/100
server is up and running

Thanks You! for using this article.

The post Configure RNDC Key for Bind9 ( DNS Server ) appeared first on TecAdmin.

]]>
https://tecadmin.net/configure-rndc-for-bind9/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