The DNS Server stands for Domain Naming System. The name servers are dynamically updated with the DNS server. In this tutorial we will describe about the given guide in a step by step manner on Enterprise Linux.
Host File
- The host file provides resolution of hostname to IP addresses.
- Only resolve names provide in the local host file.
- Cannot be used as a centralized database.
- The hostname and IP address mapping is given in /etc/hosts
Hostname Resolution
Host File Configuration
Edit the configuration file
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)
- The Domain Name System (DNS) is a hierarchical naming system where each level of name is separated by a “.”.
- Resolves user friendly domain names into computer friendly IP addresses.
- Also resolves IP addresses into domain names.
- Provides a centralized database for resolution.
Dynamic DNS
- Dynamic DDNS
- DNS is configured with DHCP in such a way that ip & FQDN automatically gets updated over DNS forward & Reverse zone files.
- Zone journal files are automatically create in Database of DNS with extensions .jnl
DNS Namespace
How DNS works ?
Zone
Zone is a storage database which contains all the records.There are two zones:
Forward Lookup Zone
- Used for resolving hostnames to IP address.
- It maintains host to IP address mapping information.
Reverse Lookup Zone
- Used for resolving IP address to hostnames.
- It maintains IP address to hostname mapping information.
Records
SOA Record
- Start of Authority
- It is the first record in any zone file.
NS Record
- Name Server
- Identifies the DNS server for each zone.
A Record
- Address
- Maps a hostname to an IP address.
CNAME Record
- Canonical Name (Alias)
- Maps an alias name to a hostname
PTR Record
- Pointer
- Maps an IP address to a hostname.
MX Record
- Mail Exchange
- Maps a domain name to a mail server.
DNS Quick Snapshots
Packages
- bind
- caching
- dhcp*
Port number
- 53 for DNS
- 67, 68 for DHCP
Configuration files
- /etc/named.conf
Daemon
- named
DNS Configuration
Step-1 (Installing DNS)
dnf install bind* caching* dhcp* vim
Step-2 (Configuration of named.rfc1912.zones)
Edit the configuration file
vim /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-3 (Configuration – Forward Lookup Zone)
Copy the forward lookup zone file
cd /var/named/chroot/var/named/ cp -arv localhost.zone example.for
Note: The file has to be copied with the permission
Configuration – Reverse Lookup Zone
Edit the file example.rev
vim 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-4 (Configuration – Reverse Lookup Zone)
Copy the reverse lookup zone file
cd /var/named/chroot/var/named/ cp -arv named.local example.rev
Note: The file has to be copied with the permission
Configuration – Reverse Lookup Zone
Edit the file example.rev
vim 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-5 (Configuration of DNS Server IP Address)
Edit the configuration file
vim /etc/resolv.conf
Add the following options
nameserver 192.168.0.253
Step-6 (Restart the Services)
Restart the DNS services
systemctl restart named
Step-7 (Configuration of DNS Server IP Address)
Edit the configuration file
vim /etc/resolv.conf
Add the following options
nameserver 192.168.0.253
Step-8 (Checking the Configuration)
Checking forward lookup
dig dns.example.com
dig client2.example.com
Checking reverse lookup
dig vx 192.168.0.2
dig vx 192.168.0.253
Mount the remote file system
ping dns.example.com
ping client2.example.com
Step-9 (Configuration of named.rfc1912.zones)
Edit the configuration file
vim /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-10 (Restart the Services)
Restart the DHCP services
systemctl restart dhcpd
Step-11 (Configuration file for ddclient)
dnf install ddclient*
vim /etc/ddclient.conf
pid=/var/run/ddclient.pid protocol=easydns use=if, if=eth0 server=dns.example.com
dhclient -r
dhclient
Step-12 (Check the updates)
Now go to forward/reverse zone file and check the updates
Congratulations now you have configured Dynamic DNS server on Enterprise Linux.