Sunteți pe pagina 1din 4

10/15/2016

ConfigureaDNSNameServeronRHEL7/CentOS7

LEARN IT GUIDE
Configure
a DNS Name Server on RHEL7/CentOS7
http://www.learnitguide.net/2015/11/configurednsnameserveronrhel7.html

ThisarticleisaquickstepbystepprocedureforinstallationandconfigurationofLinuxDNSNameserverusingbindonRHEL7/CentOS7.
Leaveyourcommentsifanyandweappreciateyourfeedback.
WhatisDNS(DomainNameSystem)andWhydoweuseit?
DNSprovidestheresolutionofhostnamestoIPaddressandViceversa.
Whensomeonetriestoaccessanywebsitesoranyservername,examplewww.learnitguide.net,requestwillgototheparticularserverby
resolvingthenamewww.learnitguide.nettotheparticularserveripaddress192.168.2.10asconfiguredinDNSnameserver.ThisiscalledForward
zonenameresolution.SamecanbedoneinreversewayasIPAddress192.168.2.10willresolvetotheservernamewww.learnitguide.net,thisis
calledReversezonenameresolution.
LabServerSetup:
Description

ServerInfo

ClientInfo

Operating
System

RHEL764Bit

RHEL764Bit

HostName

linux1.learnitguide.net linux2.learnitguide.net

IPAddress

192.168.2.10

192.168.2.20

Package

Bind9

Notrequired

ServiceName

Named

Notrequired

http://www.learnitguide.net/2015/11/configurednsnameserveronrhel7.html

1/4

10/15/2016

ConfigureaDNSNameServeronRHEL7/CentOS7

WatchthisvideoforDNSnameserverconfigurationonRHEL7/CentOS7

Congure DNS Name Server on RHEL7/CentOS7

Serverendconfiguration:
Step1:InstallingtheDNSPackagesbind
InstalltheappropriateDNSpackagesbind9usingyumtoavoiddependenciesissue.ifyumisnotconfigured,pleasereferthelink
http://www.learnitguide.net/2015/07/howtoconfigurelocalyumreposerver.html
[root@linux1~]#yumyinstallbind*

Step2:Editthemainconfigurationfile.
Openthe/etc/named.confandappendthebelowconfiguration.
zone"learnitguide.net"IN{
typemaster
file"learnitguide.net.forward"
}
zone"2.168.192.inaddr.arpa"IN{
typemaster
file"learnitguide.net.reverse"
}

ThisentriestellstheDNSservicewhichdomainswearehostinghere.Thefirstzonestatementforforwardzoneandthesecondzonestatement
forreversezone.Accordingtothefilenames,wehavetocreatetwozonefilesunder/var/named/whichisgivenindetailinStep3.
Changethebelowvaluesinthesameconfigurationfile/etc/named.confandsavethechanges,elseyourclientwillnotabletolistenorquery.
listenonport53{127.0.0.1}
allowquery{localhost}

to
listenonport53{any}
allowquery{any}

Verifytheconfigurationfileforanyerrorsusingthecommandnamedcheckconf
[root@linux1~]#namedcheckconf

Step3:CreateaForwardandReversezonefiles
Nowhavetosetupthetwozonefilesasdeclaredinthemainconfigurationfile/etc/named.conftowhereitspointingto.
Gotothedefaultzonefilesdirectory/var/namedandcreate/copytheforwardandreversezonefiles.
[root@linux1~]#cd/var/named/
[root@linux1named]#cprfnamed.localhostlearnitguide.net.forward
[root@linux1named]#cprfnamed.loopbacklearnitguide.net.reverse

http://www.learnitguide.net/2015/11/configurednsnameserveronrhel7.html

2/4

10/15/2016

ConfigureaDNSNameServeronRHEL7/CentOS7

Changetheownershipofthefilesas"root:named".
[root@linux1named]#chownroot:namedlearnitguide.net.*

Editthelearnitguide.net.forwardfileforforwardzoneandaddtheclientserversname,hereweaddonlyonenodelinux2fortesting.
[root@linux1named]#vilearnitguide.net.forward
$TTL1D
@INSOA@root.learnitguide.net.(
0serial
1Drefresh
1Hretry
1Wexpire
3H)minimum
NS@
A192.168.2.10
linux1A192.168.2.10
linux2A192.168.2.20

Editthelearnitguide.net.forwardfileforforwardzoneandaddtheclientserversipaddresslastdigitnumber,hereweaddonlyonenode"20"for
testing.
[root@linux1named]#vilearnitguide.net.reverse
$TTL1D
@INSOA@root.learnitguide.net.(
0serial
1Drefresh
1Hretry
1Wexpire
3H)minimum
NS@
A192.168.2.10
10PTRlinux1
20PTRlinux2

Step4:StarttheDNSserviceandcheckthestatusforanyerrors
[root@linux1named]#systemctlstartnamed
[root@linux1named]#systemctlstatusnamed
named.serviceBerkeleyInternetNameDomain(DNS)
Loaded:loaded(/usr/lib/systemd/system/named.servicedisabled)
Active:active(running)sinceMon2015110211:34:46EST3sago
Process:3059ExecStart=/usr/sbin/namedunamed$OPTIONS(code=exited,status=0/SUCCESS)
Process:3058ExecStartPre=/usr/sbin/namedcheckconfz/etc/named.conf(code=exited,status=0/SUCCESS)
MainPID:3062(named)
CGroup:/system.slice/named.service
3062/usr/sbin/namedunamed
Nov0211:34:46linux1.learnitguide.netnamed[3062]:zone0.inaddr.arpa/IN:loaded...0
Nov0211:34:46linux1.learnitguide.netnamed[3062]:zone1.0.0.127.inaddr.arpa/IN:...0
Nov0211:34:46linux1.learnitguide.netnamed[3062]:zone1.0.0.0.0.0.0.0.0.0.0.0.0....0
Nov0211:34:46linux1.learnitguide.netnamed[3062]:zonelocalhost/IN:loadedserial0
Nov0211:34:46linux1.learnitguide.netnamed[3062]:zonelearnitguide.net/IN:loade...0
Nov0211:34:46linux1.learnitguide.netnamed[3062]:zone2.168.192.inaddr.arpa/IN:...0
Nov0211:34:46linux1.learnitguide.netnamed[3062]:zonelocalhost.localdomain/IN:...0
Nov0211:34:46linux1.learnitguide.netnamed[3062]:allzonesloaded
Nov0211:34:46linux1.learnitguide.netnamed[3062]:running
Nov0211:34:46linux1.learnitguide.netsystemd[1]:StartedBerkeleyInternetNameD....
Hint:Somelineswereellipsized,useltoshowinfull.
[root@linux1named]#

Step5:Verificationofthenameserverresolution.
Usenslookupcommandtoverifytheresolutionofeachserversaddedinzonefiles.

http://www.learnitguide.net/2015/11/configurednsnameserveronrhel7.html

3/4

10/15/2016

ConfigureaDNSNameServeronRHEL7/CentOS7

[root@linux1named]#nslookuplinux1.learnitguide.net
Server:127.0.0.1
Address:127.0.0.1#53
Name:linux1.learnitguide.net
Address:192.168.2.10
[root@linux1named]#nslookuplinux2.learnitguide.net
Server:127.0.0.1
Address:127.0.0.1#53
Name:linux2.learnitguide.net
Address:192.168.2.20

That'sitforserverendconfiguration.Letsdoitonclientend.

Clientendconfiguration:
Step1:Edittheresolutionfile/etc/resolv.confandaddthedomain,nameserverdetailsasbelow
domainlearnitguide.net
nameserver192.168.2.10

Saveandexitthefile.
Step2:Verificationofthenameserverresolution.
[root@linux2yum.repos.d]#nslookuplinux1
Server:192.168.2.10
Address:192.168.2.10#53
Name:linux1.learnitguide.net
Address:192.168.2.10
[root@linux2yum.repos.d]#nslookuplinux2
Server:192.168.2.10
Address:192.168.2.10#53
Name:linux2.learnitguide.net
Address:192.168.2.20

That'sall,weareabletoresolvetheservernamesfromclientsuccessfully.Samewaywehavetoaddallourinfrastructureserversinthezone
files.
Leaveyourcommentsifany,weappreciateyourfeedback.
Subscribeusonyoutubechannelforpracticalvideotutorialsandfollowusonsocialnetworkingsitestonotmissanyupdates.
1Comment
Recommend

learnitguide

Share

Login

SortbyBest

Jointhediscussion
BasheerMayearago

Thanksalot,itriedwithyourstepbystepdocumentwithmyrequirement,itworked.

Reply Share

ALSOONLEARNITGUIDE

AboutUs

http://www.learnitguide.net/2015/11/configurednsnameserveronrhel7.html

InstallationofVeritasVolumeManager(VxVM)onLinux

4/4

S-ar putea să vă placă și