Install and configure DNS Bind on RHEL 7

STEP1:

Use SSH to connect to the public IP address of the virtual machine. Replace sshuser with the SSH user account you specified when creating the VM. The following example connects to a virtual machine at 40.68.254.142:

bash



STEP2:

To install Bind, use the following commands from the SSH session:

bash
sudo yum install bind bind-utils -y

STEP3:

To configure Bind to forward name resolution requests to your on premises DNS server, use the following text as the contents of the /etc/named.conf file:

 acl goodclients {
     10.0.0.0/16; # Replace with the IP address range of the virtual network
     10.1.0.0/16; # Replace with the IP address range of the on-premises network
     localhost;
     localnets;
 };

 options {
         directory "/var/cache/bind";

         recursion yes;

         allow-query { goodclients; };

         forwarders {
         192.168.0.1; # Replace with the IP address of the on-premises DNS server
         };

         dnssec-validation auto;

         auth-nxdomain no;    # conform to RFC1035
         listen-on { any; };
 };

Important

Replace the values in the goodclients section with the IP address range of the virtual network and on-premises network. This section defines the addresses that this DNS server accepts requests from.

Replace the 192.168.0.1 entry in the forwarders section with the IP address of your on-premises DNS server. This entry routes DNS requests to your on-premises DNS server for resolution.
To edit this file, use the following command:

bash
sudo nano /etc/named.conf

To save the file, use Ctrl+X, Y, and then Enter.

STEP4:

From the SSH session, use the following command:

bash
hostname -f

This command returns a value similar to the following text:
output

The icb0d0thtw0ebifqt0g1jycdxd.ex.internal.cloudapp.net text is the DNS suffix for this virtual network. Save this value, as it is used later.

STEP5:

To configure Bind to resolve DNS names for resources within the virtual network, add the following text in the /etc/named.conf file:

 // Replace the following with the DNS suffix for your virtual network
     type forward;
     forwarders {168.63.129.16;}; # The Azure recursive resolver
 };

Important

You must replace the icb0d0thtw0ebifqt0g1jycdxd.ex.internal.cloudapp.net with the DNS suffix you retrieved earlier.

To edit this file, use the following command:

bash
sudo nano /etc/named.conf

To save the file, use Ctrl+X, Y, and then Enter.

STEP6:

To start Bind, use the following command:

bash
sudo sysctmectl enable named --now

STEP7:

To verify that bind can resolve the names of resources in your on-premises network, use the following commands:

bash

Important

Replace dns.mynetwork.net with the fully qualified domain name (FQDN) of a resource in your on-premises network.
Replace 10.0.0.4 with the internal IP address of your custom DNS server in the virtual network.
The response appears similar to the following text:
output

Server:         10.0.0.4
Address:        10.0.0.4#53

Non-authoritative answer:
Address: 192.168.0.

For the complete installation procedure please refer to the RHEL link.

To Set DNS Nameservers on Ubuntu 16.04 LTS use link.

Post a Comment

Thanks for your comment !
I will review your this and will respond you as soon as possible.