Tuesday 13 December 2011

### BIND DNS ###



 1. Name-to-IP address mapping
 2. Name resolution for DNS clients
 3. Caching-only server (Default)
 4. Primary DNS server
 5. Slave server
 6. Replication of DNS database information between servers
 7. Dynamic DNS updates
 8. Provides numerous client tools: nslookup, dig, host

Tasks:
 1. Installation of BIND on the remote system: linuxcbtserv4
  a. yum -y install bind

 2. Setup service to auto-start at boot
  a. chkconfig --level 35 named on - enables the service in runlevels: 3,5

 3. Configure a default, caching-only, named.conf file
  a. rpm -ql bind - to see samples
  b. cp /usr/share/doc/bind*/sample/* to /etc/ and /var/named
  c. Modify /etc/named.conf - disable DDNS_KeyGen sections
  d. Start the server - service named start
 
 4. Query the server
  a. dig @localhost www.linuxcbt.com
   a1. Returns: question, answer, authoritative DNS servers, query time
  b. nslookup www.linuxcbt.com OR nslookup - server 127.0.0.1 - www.linuxcbt.com

Note: The server has cached: www.linuxcbt.com, evidenced by the decrementing TTL values for the various records associated with the zone

  c. host www.linuxcbt.com - also performs a lookup

Note: /etc/resolv.conf controls the DNS servers that are consulted by lookup tools such as: Web browser, GFTP, LFTP, nslookup, dig, host, etc.

  d. dig linuxcbt.com MX - queries the domain for mail exchangers

Note: DNS is organized into an inverted tree, with '.' representing the root of the DNS tree. e.g.

dig mail1.linuxgenius.com.
 - . = root
  - .com = top level
   - .linuxgenius = second level
      -mail = third level
Note: A trailing '.' in a DNS query is implied, and may optionally be indicated if desired in any standard Internet application (web browser, FTP client, wget, nslookup, dig, host, etc.)


Primary & Secondary Zones:
 Features:
  1. Ability to service zones
  2. Authoritative support for a zone

Tasks:
 1. Create internal zone named 'linuxcbt.internal'
  a. modify /etc/named.conf to include the new zone

zone "linuxcbt.internal" {
                type master;
                #allow-update { key ddns_key; };
                file "linuxcbt.internal.db";
        };

  b. create the corresponding zone file
  c. restart named
  d. test resolution of DNS primary zone

Note: Install 'caching-nameserver*' for Caching-only DNS server

 2. Create a slave (Secondary) server
  a. yum -y install bind
  b. copy sample files from primary server to secondary server
  c. modify /etc/named.conf and set 'linuxcbt.internal' zone to slave
  d. start named service - 'service named start'
  e. chkconfig --level 35 named on
  f. Update: /var/named/linuxcbt.internal.db to reflect new name server

 3. Create a primary zone on the "secondary" server
  a. create a zone for: linuxcbt.external - in /etc/named.conf
  b. copy/create 'linuxcbt.external.db' zone file
  c. setup 'linuxcbtserv4' to be a slave for the zone: linuxcbt.external


 




 4. Start 'named' as a caching-only DNS server (Default)
  a. service named start
  b. 'dig @192.168.75.199 www.linuxcbt.com' - forces a caching-only lookup query



Forward IPv6 Records:
Implemented primarily as AAAA records:

linuxcbtserv1    IN    AAAA    2002:4687:db25:3:202:b3ff:fe98:4108
linuxcbtserv4    IN    AAAA    2002:4687:db25:3:20c:29ff:feb5:1692
linuxcbtmedia1    IN    AAAA    2002:4687:db25:3:20a:5eff:fe1b:4aad
linuxcbtrouter1    IN    AAAA    2002:4687:DB25:3:21A:2FFF:FEE3:F240

Test IPv6 resolution using:
 1. ping6 linuxcbtrouter1.linuxcbt.internal
 2. dig @192.168.75.10 linuxcbtrouter1.linuxcbt.internal


Reverse Zones:
 Features:
  1. The ability to resolve a name, given an IPv4 or IPv6 address


Tasks:
 1. Define an IPv4 reverse zone for the local subnet:
  a. Define zone name: '75.168.192.in-addr.arpa' - /etc/named.conf
  b. Update: /etc/named.conf
  c. Create zone file in: /var/named
  d. Update configuration
  e. Restart named
  f. test using 'dig -x 192.168.75.1'

Note: Reverse zones are built from the prefix in IPv4 subnets


IPv6 Reverse Zone:
 Requirements:
  1. /etc/named.conf entry
zone "3.0.0.0.5.2.b.d.7.8.6.4.2.0.0.2.ip6.arpa" {
        type master;
        file "3.0.0.0.5.2.b.d.7.8.6.4.2.0.0.2.ip6.arpa.reverse";
};

Note: IPv6 reverse zone names are in nibble format, with ALL zeros expanded for the network prefix portion of the address, which is usually 64-bits in length


  2. /var/named/zone_file
   a. Include entries using the last 64-bits or IPv6 host part

d.a.a.4.b.1.e.f.f.f.e.5.a.0.2.0 IN PTR linuxcbtmedia1.linuxcbt.internal.

Note: When creating reverse IPv6 entries for hosts, do the following:
 a. reverse the 64-bit portion of the address that corresponds to the host, expanding all zeros
 b. Create PTR record based on the reverse, nibble-format of the address

Test using dig:
 a. dig -x 2002:4687:db25:3:20a:5eff:fe1b:4aad

No comments:

Post a Comment