Dynamic DNS Server Configuration on CentOS 6 / RHEL 6

How to install Dynamic DNS Server Configuration on CentOS/RHEL 6/5, Here I have discussed this in a step by step concept.

Host File

The host file provides resolution of hostnames to IP addresses.
It can only resolve names provide in the local host file.
It cannot be used as a centralized database.
The hostname and IP address mapping is given in /etc/hosts

Hostname Resolution

Hostname-Resolution

Host File Configuration

Edit the configuration file
[[email protected] ~]# vi /etc/hosts
Add the entries required
127.0.0.1 localhost.localdomain localhost
192.168.0.253 dns.example.com dns
192.168.0.1 client1.example.com client1
192.168.0.2 client2.example.com client2
:wq!

Domain Name System (DNS)

  1. The Domain Name System (DNS) is a hierarchical naming system where each level of name is separated by a “.”.
  2. It resolves user friendly domain names into computer friendly IP addresses.
  3. It also resolves IP addresses into domain names.
  4. It provides a centralized database for resolution.

Dynamic DNS

  1. Dynamic DDNS
  2. DNS is confiured with DHCP in such a way that ip & FQDN automatically gets updated over DNS forward & Reverse zone files.
  3. Zone journal files are automatically create in Database of DNS with extensions .jnl

DNS Namespace

DNS-Namespace

How DNS works ?

How-DNS-Works

Zone

Zone is a storage database which contains all the records.There are two zones:

Forward Lookup Zone
  1. Used for resolving hostnames to IP address.
  2. It maintains host to IP address mapping information.
 Reverse Lookup Zone
  1. Used for resolving IP address to hostnames.
  2. It maintains IP address to hostname mapping information.

Records

SOA Record
  1. Start of Authority
  2. It is the first record in any zone file.
NS Record
  1. Name Server
  2. Identifies the DNS server for each zone.
A Record
  1. Address
  2. Maps a hostname to an IP address.
CNAME Record
  1. Canonical Name (Alias)
  2. Maps an alias name to a hostname
PTR Record
  1. Pointer
  2. Maps an IP address to a hostname.
MX Record
  1. Mail Exchange
  2. Maps a domain name to a mail server.

DNS Quick Snapshots

Packages
  1. bind*
  2. caching?nameserver?*.rpm
  3. Dhcp*
Port number
  1. 53 for DNS
  2. 67, 68 for DHCP
Configuration files
  1. /etc/named.conf
Daemon
  1. named

DNS Configuration

Step-I(Installing DNS)
[[email protected] ~]# yum install bind* caching* dhcp*
Step-II(Configuration of named.rfc1912.zones)

Edit the configuration file

[[email protected] ~]# vi /etc/named.conf

To add the options

controls {
inet 127.0.0.1 port 953
allow {127.0.0.1;} keys {"rndckey";};
};
zone "example.com" IN {
type master;
file “example.for";
allow?update { key rndckey; } ;
};
zone "0.168.192.in?addr.arpa" IN {
type master;
file “example.rev";
allow-update { key rndckey; } ;
};
:wq
Step-III(Configuration – Forward Lookup Zone)

Copy the forward lookup zone file

[[email protected] ~]# cd /var/named/chroot/var/named/
[[email protected] named]# cp ?p localhost.zone example.for

Note: The file has to be copied with the permission

Configuration – Reverse Lookup Zone

Edit the file example.rev

[[email protected] named]# vi example.rev
To add the options
$TTL 86400
@ IN SOA @ root (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expire
1D) ; minimum
IN NS @
IN A 192.168.0.253
client1 IN A 192.168.0.1
client2 IN A 192.168.0.2
Step-IV(Configuration – Reverse Lookup Zone)

Copy the reverse lookup zone file

[[email protected] ~]# cd /var/named/chroot/var/named/
[[email protected] named]# cp ?p named.local example.rev

Note: The file has to be copied with the permission

Configuration – Reverse Lookup Zone

Edit the file example.rev

[[email protected] named]# vi example.rev
To add the options
$TTL 86400
@ IN SOA dns.example.com. root.example.com.(
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400) ; Minimum
IN NS dns.example.com.
253 IN PTR dns.
1 IN PTR client1.
2 IN PTR client2
Step-V(Configuration of DNS Server IP Address)

Edit the configuration file

[[email protected] ~]# vi /etc/resolv.conf

Add the following options

nameserver 192.168.0.253
Step-VI(Restart the Services)

Restart the DNS services

[[email protected] ~]# service named restart
Step-VII(Configuration of DNS Server IP Address)

Edit the configuration file

[[email protected] ~]# vi /etc/resolv.conf

Add the following options

nameserver 192.168.0.253
Step-VIII(Checking the Configuration)

Checking forward lookup

[[email protected] ~]# dig dns.example.com
[[email protected] ~]# dig client2.example.com

Checking reverse lookup

[[email protected] ~]# dig ?x 192.168.0.2
[[email protected] ~]# dig ?x 192.168.0.253
Mount the remote file?system
[[email protected] ~]# ping dns.example.com
[[email protected] ~]# ping client2.example.com
Step-IX(Configuration of named.rfc1912.zones)

Edit the configuration file

[[email protected] ~]# vi /etc/dhcpd.conf

To add the options

include "/etc/rndc.key";
ddns-domain “example.com";
ddns-update-style interim;
ddns-rev-domain "0.168.192.in-addr.arpa";
ddns-updates on; allow Dynamic DNS
authoritative;
#master server for this domain
# Allow only the DHCP server to update DNS
ignore client-updates;
allow unknown-clients;zone 0.168.192.in-addr.arpa.
{
primary 192.168.0.252;
key "rndckey";
}
zone techbrown.com. {
primary 192.168.0.252;
key "rndckey";
}
range 192.168.0.20 192.168.0.59;
:wq(save and quit)
Step-X(Restart the Services)

Restart the DHCP services

[[email protected] ~]# service dhcpd restart
Step-XI(Configuration file for ddclient)
[[email protected] ~]# # yum install ddclient*
[[email protected] ~]# vi /etc/ddclient.conf
pid=/var/run/ddclient.pid
protocol=easydns
use=if, if=eth0
server=dns.example.com
[[email protected] ~]# dhclient -r
[[email protected] ~]# dhclient
Step-XII(Check the updates)

Now go to forward/reverse zone file and check the updates

Congratulation now you have Installed Dynamic DNS Server and Configured on CentOS/RHEL 6/5

Hot Right Now

Related Post

Develop New SysAdmin Skills with E-books (FREE Download)

COMMENTS