Sei sulla pagina 1di 1

Udemy May Savings Spree - Any Course at $9.

99 Dates: 7/5/18 - 14/5/18    Top Linux, AWS, Python and DevOps Courses for only $9.99
FOLLOW:    
About Us  Author’s World  Privacy Policy Disclaimer eBooks (Free)  DevOps Courses – Udemy 90% Off 
GOOGLE SEARCH…
SHARE

Tech Informant 0 Custom Searc


17
Home Linux Distro’s  Cloud Computing  Virtualization  DevOps Tools


FOSS AND LINUX DISTRO'S / REDHAT & CENTOS / RHEL 7 / UBUNTU/DEBIAN  2  
0

 Free course on Udemy –

DNS Server Configuration on RHEL/CentOS 7


Linux KVM for System
Engineers
0

BY YOGESH MEHTA · PUBLISHED JANUARY 24, 2017 · UPDATED JANUARY 24, 2017
 Free course on Udemy –
Basics of BIND DNS Server
In this article and the below YouTube video , you’re going to see how to set up a DNS 0
Linux Free Course on Udemy -Linux
Server on RHEL/CnetOS 7. And also you will see how to add client machines to
Administration:
Administration: Beginner to
communicate with DNS Server. So follow the below steps to the quick configuration on the  Beginner Advanced In Just 7 Days!
to
setup of BIND  (Berkeley Internet Name Domain) service named. In Linux environments, we
Advanced
use Package name called Bind. In Just 7
Days!
What is DNS.?
Providing a network recycle
bin for Samba
The DNS it stands for Domain Name Server (DNS) is used to translate/resolve hostnames
into IP addresses, and the IP address into Hostnames. DNS zones are used to translate IP Bash Linux Command Line
addresses into hostnames. It is also used to deliver additional types of information to Scripting Interface and BASH Scripting
– Udemy 100% Free Coupon
DNS clients. An increasing number of services depend on DNS, which is why configuring DNS
is an important task for Linux administrators.

Understanding the DNS  Records:

–Each DNS  Zone file contain a number of records like A ,PTR,CNAME,MX,HINFO,NS  and SOA
records. 

A Record: The Address record holds The IP Address of the hostname.It resolves IP into
Hostname.

PTR Record: The Pointer Record resolves hostname into IP

CNAME: cname allows multiple names  for each TCP/IP Address

MX RECORD: it stands for mail exchange record, It’s responsible for Mail Hostnames.

HINFO:  this record holds Hosts TCP/IP Address

NS RECORD: The Name Server record simply specifies the other name servers for the
domain.

SOA RECORD: It stands Start of authority. This record identifies the zone and
some parameters like the source host, serial number, refresh time, retry time, A expire time.
Time To Live (TTL)

In-detailed some Important Resource Record Types and it’s used.

Usage
Resource Record

A (IPv4 address) Maps a hostname to an IPv4 address

AAAA (IPv6 address) Maps a hostname to an IPv6 address.

An alias for one name to another name that


CNAME (canonical name)
should have an A or AAAA record.

Maps a domain name to a DNS name server that is


NS (name server)
authoritative for the DNS zone.

PTR (pointer) Maps an IP address (v4 or v6) to a hostname.

Indicates which MTA mail servers are used within a


DNS
MX (mail exchange)

domain.

Contains generic information about how a DNS


SOA (start of authority zone works. It contains information about who is
responsible for the administration of the domain.

Maps a name to human readable text. This type of


resource record is for instance used by protocols
TXT (text) like Send Policy Framework, which in email is used
to verify the name of the domain an email
message was received from.

Indicates which host to contact for specific


SRV (service)
services such as LDAP and Kerberos.

DNS have two Zone files:

What is Zone?

 Zones contain all domain information. Basically, the zone refers to the branch of the DNS
tree for which a specific name server is responsible.

Zones are two types

1.forward lookup Zone– it contain IP address to hostname information

2.Reverse lookup Zone: it contains hostname to IP address information.

Now Let’s Start the Installation and Configuration of DNS Server on CentOS/RHEL 7.

Table of Contents

1. Setup Information
2. Pre-Requisite Infrastructure Configuration
3. Static IP for DNS server.
4. Local Host File on the DNS Server
5. SELINUX status.
6. DNS Server Software Installation.
7. Enabling DNS IP to access the DNS requests.
8. Firewall Settings.
9. DNS Server Configuration.
10. DNS Zone Files.
11. Configure permissions and ownerships on bind configuration files.
12. Perform Syntax check Validation on the Config files.
13. Start the BIND services.
14. DNS Server Testing.

Please watch this video on youtube for


more videos like this
DNS Server Installation and Con guration on RHEL 7 Quick Intro
À regarder plus tard Partager

1. Setup Details
In this lab setup, we are going to install and configure the BIND DNS service named. DNS
server listens to the DNS requests on port 53, which is the default port for name resolution
service

Operating System:                 RHEL or CentOS 7 (x86_64)

Name Server Software:      BIND (Berkeley Internet Name Domain)

Master DNS Server:              master.opensky.home / 192.168.1.202

DNS Client:                               centos-client / 90.10.10.50

DNS Port:                                  53 (Default)

Platform:                                   VMware Workstation

RPM Sources:                        CentOS Yum Repository

2. Pre-Requisite Infrastructure Configuration


2.1 Static IP for Master DNS server. 

This is must and recommended to have a static IP configured on the DNS NIC.

To Configure Static IP/Connection for the network adaptor enp0s8 using with
nmcli(NetworkManager Command-line Interface). Follow below commands. 

[root@master ~]# nmcli connection add con-name eth0 ifname enp0s8 type ethernet autoconnect
yes ip4 192.168.1.202/24 gw4 192.168.1.1
[root@master ~]# nmcli connection modify eth0 ipv4.dns 192.168.1.202,8.8.8.8
[root@master ~]# nmcli connection modify eth0 ipv4.method manual

After Configuring the Static IP for Network Device. Now Let’s down & up to Check the status of the
Network Connections.

[root@master ~]# nmcli connection down eth0


[root@master ~]# nmcli connection up eth0

Restart the Network connections.

[root@master ~]# systemctl restart network.service

Verifying The Network Settings and IP address configuration: 

[root@master ~]# grep -w BOOTPROTO /etc/sysconfig/network-scripts/ifcfg-eth0

BOOTPROTO=static

[root@master ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0

For static IP configuration on RHEL/CentOS 7, just click here. This article will give you
complete details about configuring the static IP.

2.2 Local Host File on the DNS Server


To set hostname resolution, DNS is typically used. Configuring DNS not only for hostname
resolution it will help us control to communicate with DNS Clients. Apart from DNS, you can
configure host name resolution in the  /etc/hosts file. Setting up an /etc/hosts file is easy;
just make sure that it contains at least two columns. The first column has the IP address of
the specific host, and the second column specifies the hostname Ex:
localhost.localdoamin  localhost.

Configuring the Static Hostname for DNS Server using the hostnamectl command.

[root@master ~]# hostnamectl set-hostname master.opensky.home

(or) You can set using this like

[root@master ~]# hostnamectl set-hostname master.opensky.home  –static

Add The  entry in /etc/hosts file like below  to resolve the  FQDN name with IP address

[root@master ~]# cat /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.1.202     master.opensky.home     master

Verifying the Hostname details:


[root@master ~]# hostnamectl status

2.3 SELINUX status


In my setup, I have kept the selinux disabled, it’s up to you whether you want to keep it
enabled or disabled.

[root@master ~]# sestatus

SELinux status:                 disabled

3. DNS Server Software Installation


To install DNS packages we will use the yum command, as yum takes care to install the
dependency packages by itself if any. If you want to Configure Local Yum Repository on
RHEL Versions just click here: Yum Repository Configuration on RHEL/CentOs 7

[root@master ~]# yum install bind bind-utils

[root@master ~]# rpm -q bind bind-utils

4. Enabling DNS IP to accept the DNS


requests
Once the DNS bind packages are installed, next step is to enable the DNS configuration to
enable named service to accept the request on DNS Server IP. In our lab setup, it is
192.168.1.202. To perform these changes manually edit the /etc/named.conf file.

Before editing the Default configuration, make sure take a back of original configuration
file.

Before: editing the default configuration file of /etc/named.conf

[root@master ~]# grep -w “listen-on port 53” /etc/named.conf

        listen-on port 53 { 127.0.0.1; };

 [root@master ~]# grep -w “allow-query” /etc/named.conf

        allow-query     { localhost; };

After Editing

[root@master ~]# grep -w “listen-on port 53” /etc/named.conf

        listen-on port 53 { 127.0.0.1;192.168.1.202; };

[root@master ~]# grep -w “allow-query” /etc/named.conf

        allow-query     { any; };

[root@master ~]#

Once we have made the above changes, we can start the named service to ensure that
changes worked fine and service started without any problem.

Starting and Verifying the DNS (Named) Service.

[root@master ~]# systemctl enable named.service

[root@master ~]# systemctl start named.service

[root@master ~]# systemctl status named.service

Once the named service is started, we can check if named services are listening on DNS
server IP on port 53 for both TCP and UDP protocols.

 [root@master ~]# netstat -antu | grep -w 53

tcp        0      0 90.10.10.20:53          0.0.0.0:*               LISTEN

tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN

tcp6       0      0 ::1:53                  :::*                    LISTEN

udp        0      0 90.10.10.20:53          0.0.0.0:*

udp        0      0 127.0.0.1:53            0.0.0.0:*

udp6       0      0 ::1:53                  :::*

[root@master ~]#

Above outputs confirms that DNS server is listening on loopback, DNS IP on port 53 for TCP
and UDP protocols.

5. Firewall Settings
In enterprise setup generally, operating system firewall is kept off as enterprise firewalls are
there to keep the network secure. In this lab setup, I am not going to disable the local
firewall as we don’t have enterprise firewalls here.

We will create firewall rules to accept the tcp/udp requests on port 53 reload the firewall
rules.

[root@master ~]# firewall-cmd –zone=public –add-port=53/tcp –permanent

[root@master ~]# firewall-cmd –zone=public –add-port=53/udp –permanent

[root@master ~]# firewall-cmd –reload

Once firewall rules configured and loaded, we can test it using nmap command.  The
beauty of nmap utility is we can test both tcp and udp connectivity.

[root@master ~]# nmap -p 53 90.10.10.20

Host is up (-2100s latency).

PORT   STATE SERVICE

53/tcp open  domain

Nmap was done: 1 IP address (1 host up) scanned in 0.04 seconds

Verifying UDP port

[root@master ~]# nmap -sU -p 53 192.168.1.202

Host is up (0.00075s latency).

PORT   STATE SERVICE

53/udp open  domain

Nmap was done: 1 IP address (1 host up) scanned in 0.03 seconds

[root@master ~]#

6. DNS Server Configuration


So now we have infrastructure configuration setup completed to run the DNS services. Let’s
define our zone file for our opensky.home domain.

6.1 DNS Zone Files


First, we will update the /etc/named.conf for the names of forward and reverse lookup files.
To do this edit the /etc/named.conf file and add the following entries before include
statements.

zone “opensky.home” IN {

type master;

file “forward.opensky”;

allow-update { none; };

};

zone “1.168.192.in-addr.arpa” IN {

type master;

file “reverse.opensky”;

allow-update { none; };

};

Now create forward and reverse lookup files with the following contents

[root@master ~]# cat /var/named/forward.opensky

$TTL 86400

@ IN SOA master.opensky.home. root.opensky.home. (

             2011071001 ;Serial

             3600 ;Refresh

             1800 ;Retry

             604800 ;Expire

             86400 ;Minimum TTL

       )

@    IN     NS     master.opensky.home.

@    IN     A       192.168.1.202

@    IN     A       192.168.1.205

master              IN       A       192.168.1.202

centos-client       IN       A       192.168.1.205

Reverse lookup file

[root@master ~]# cat /var/named/reverse.opensky

$TTL 86400

@ IN SOA master.opensky.home. root.opensky.home. (

             2011071001 ;Serial

             3600 ;Refresh

             1800 ;Retry

             604800 ;Expire

             86400 ;Minimum TTL

       )

@    IN     NS     master.opensky.home.

@    IN     PTR    opensky.home.

master              IN       A       90.10.10.20

centos-client       IN       A       90.10.10.50

20       IN     PTR   master.opensky.home.

50       IN     PTR   centos-client.opensky.home.

[root@master ~]#

7. Configure permissions and ownerships on


bind configuration files
 Page 1 of 2

1 2 »

Tags: DNS Server Configuration DNS Server Configuration on RHEL/CentOS 7 how to set up a DNS Server on RHEL/CnetOS 7

Understanding the DNS Records What is DNS.?

Yogesh Mehta
Yogesh Kumar is a Computer Geek and he works on multiple domains and also he strongly believes in sharing IT
 knowledge and tricks and tips with others and adopts new technology with ease.

PREVIOUS STORY NEXT STORY

 NTP Client Configuration and Management using Free Web-Ex online Training sessions for AWS, Ansible & 
Ansible RHEL 7

 YOU MAY ALSO LIKE...

Configuring KVM (Kernel-Based How to create and read Database and User Creation in
0 0 2
Virtual Machine) on RHEL/CentOS 7 QR/Barcode in Linux Terminal MariaDB on CentOS/Red Hat
DECEMBER 25, 2016 SEPTEMBER 22, 2017 SEPTEMBER 29, 2016

GOOGLE AD

*GOOGLE AD*

THE BEST COURSE ON UDEMY – A BEGINNER’S THE BEST COURSE ON UDEMY – SHELL THE BEST COURSE ON UDEMY – LINUX THE BEST COURSE ON UDEMY – LINUX
GUIDE TO LINUX SYSTEM ADMINISTRATION! SCRIPTING FOR LINUX BEGINNERS. GET ACADEMY RED HAT CERTIFIED SYSTEMS ACADEMY RED HAT CERTIFIED ENGINEER PREP
(75% OFF) STARTED WITH LINUX (75% OFF) ADMINISTRATOR PREP (75% OFF) (75% OFF)

THE BEST COURSE ON UDEMY – LINUX AND THE BEST CURSE ON UDEMY – SHELL SCRIPT THE BEST COURSE ON UDEMY – LINUX BASH UDEMY OFFER SALE – ONLY $15 – LINUX
BASH SHELL SCRIPTING FROM BEGINNER TO TUTORIAL – BASH SCRIPTING FOR SCRIPTING FOR BEGINNERS: WRITE YOUR OWN COMMAND LINE INTERFACE AND BASH
INTERMEDIATE (35% OFF) LINUX/UNIX/BASH (50% OFF) SCRIPTS (50% OFF) SCRIPTING

Google+ Linkedin Facebook Twitter Tumblr Pinterest Techinformant Courses – Udemy Offers


Tech Informant © 2019. All Rights Reserved.    

Potrebbero piacerti anche