Configure BIND DNS Server for Internal and External Name Resolution (RHEL 10)

Purpose

  • Configure a BIND DNS server to resolve both internal and external domain names.
  • Host an internal DNS zone (infracalcu.internal) for private network resources.
  • Forward external DNS queries to public DNS resolvers such as Google DNS (8.8.8.8) and Cloudflare DNS (1.1.1.1).

Benefits

  • Centralized DNS management: Manage internal hostname-to-IP mappings from one DNS server.
  • Internal name resolution: Allow clients to access internal servers using domain names instead of IP addresses.
  • External name resolution: Allow clients to resolve public domains such as google.com.
  • Reduced configuration overhead: Clients only need to configure one DNS server instead of managing multiple DNS resolvers.
  • Controlled DNS access: Restrict which clients can send queries and use recursive resolution.

Lab Environment

Component Details
OS RHEL 10
DNS Software BIND (named)
DNS Server 172.31.27.152
DNS Client 172.31.28.150
Internal Domain infracalcu.internal
Primary DNS dnsQueryServer01.infracalcu.internal
Google DNS 8.8.8.8
Cloudflare DNS 1.1.1.1

Implementation Steps

  1. Install BIND DNS packages.
  2. Configure DNS Server Settings (Listening, Query Permissions, Recursion & Forwarding)
  3. Configure the internal DNS zone.
  4. Create the forward zone file (DNS records).
  5. Configure the permission
  6. Validate DNS configuration.
  7. Start and enable the DNS service.
  8. Configure the DNS client (Run on DNS Client Server – 172.31.28.150)
  9. Test internal and external DNS resolution.

Implementation

  • Install BIND DNS packages
    • Check existing BIND packages
      rpm -qa | grep bind
    • Install BIND packages
      dnf install bind bind-utils -y
    • Verify installation
      rpm -qa | grep bind
  • Configure DNS Server Settings (Listening, Query Permissions, Recursion & Forwarding)
    vi /etc/named.conf
            
    options {
        listen-on port 53 { 127.0.0.1; 172.31.27.152; };
    
        allow-query { localhost; 172.31.28.150; };
    
        recursion yes;
    
        allow-recursion { localhost; 172.31.28.150; };
    
        forwarders {
            8.8.8.8;
            1.1.1.1;
        };
    
        forward only;
    };
            
          
  • Configure the internal DNS zone.
    vi /etc/named.conf 
        
    zone "infracalcu.internal" IN {
        type primary;
        file "forward.internal";
        allow-update { none; };
    };
        
      
  • Create the forward zone file (DNS records).
    vi /var/named/forward.internal
        
    $TTL 86400
    @   IN SOA dnsQueryServer01.infracalcu.internal. admin.infracalcu.internal. (
            2026111501
            3600
            1800
            604800
            86400
    )
    
    @                   IN NS dnsQueryServer01.infracalcu.internal.
    
    dnsQueryServer01    IN A  172.31.27.152
    dnsClientServer01   IN A  172.31.28.150
        
      
  • Configure the permission
    chown root:named /var/named/forward.internal
    chmod 640 /var/named/forward.internal
    restorecon -v /var/named/forward.internal
  • Validate DNS configuration.
    named-checkconf /etc/named.conf
    named-checkzone infracalcu.internal /var/named/forward.internal
  • Start and enable the DNS service.
    systemctl enable --now named
    systemctl status named
  • Configure the DNS client (Run on DNS Client Server – 172.31.28.150)
    vi /etc/resolv.conf
    search infracalcu.internal
    nameserver 172.31.27.152
  • Test internal and external DNS resolution.
    nslookup dnsQueryServer01.infracalcu.internal
    nslookup google.com

Important: The DNS server must allow DNS traffic (UDP/TCP port 53) from all authorized DNS clients so they can send DNS queries to the server.