• Install/configure bind on CentOS 6 as a forwarding DNS server

    Some times we need to resolve the DNS queries from outside using public DNS servers such as Google Public DNS as this is may be more faster than internal ones.

    Here are the steps that you can follow to get this done:

    • Install required software packages:
    # yum install bind bind-libs bind-utils
    • Set the BIND service to start on system boot:
    # chkconfig named on
    • Edit the main configuration with the following text (backup the default configuration file and replace the original on with the following text ):
    # cp  /etc/named.conf /etc/named.conf.Bk
    # echo >  /etc/named.conf
    # vim /etc/named.conf

    Add the following to the /etc/named.conf file :

    options {
     directory "/var/named";
    # Hide version string for security
     version "not currently available";
    # Listen to the loopback device only
     listen-on { any; };
     listen-on-v6 { ::1; };
    # Do not query from the specified source port range
     # (Adjust depending your firewall configuration)
     avoid-v4-udp-ports { range 1 32767; };
     avoid-v6-udp-ports { range 1 32767; };
    # Forward all DNS queries to the Google Public DNS.
     forwarders { 8.8.8.8;4.2.2.5; };
     forward only;
    # Expire negative answer ASAP.
     # i.e. Do not cache DNS query failure.
     max-ncache-ttl 1200; # 3 seconds
    # Disable non-relevant operations
     allow-transfer { none; };
     allow-update-forwarding { none; };
     allow-notify { none; };
     allow-recursion { any; };
    };
    zone "innovationsol.com" in {
    type forward;
    forwarders { 192.168.1.10; 192.168.1.11; };
    };

    Here I’m forwarding all queries to Public IPs (8.8.8.8,4.2.2.5) (you can change this to any public servers you want),also if you want to forward requests for specific domain to be resolve from specific IPs ,you can do this by adding zone and specify its’ forwarders like innovationsol.com zone.

    Categories: DNS

    Comments are currently closed.