The construction of DNS in Linux
I'm not going to elaborate on the theoretical knowledge here.
What you need to know: Http://baike.baidu.com/subview/22276/15346050.htm?fr=aladdin
Down directly into the building
Software used: Vmware workstation rhel6.3 (64-bit)
Operating system used:
[Email protected] ~]# uname-a
Linux Wang 2.6.32-279.el6.x86_64 #1 SMP Wed June 18:24:36 EDT x86_64 x86_64 x86_64 gnu/linux
First mount the mirror 650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/54/6A/wKiom1SBcwKxVnQ7AAAjE69sNIs568.jpg "title= "Mirroring mount. png" alt= "wkiom1sbcwkxvnq7aaaje69snis568.jpg"/>
[Email protected] ~]# mount/dev/cdrom/opt/
Then start configuring Yum, by default the Yum package is installed
Start configuring the local Yum source now
[Email protected] ~]# cd/etc/yum.repos.d/
[[email protected] yum.repos.d]# ls
Rhel-source.repo
[Email protected] yum.repos.d]# VI Rhel-source.repo
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/54/69/wKioL1SBdMvgG-SjAAHywdvRI2g694.jpg "title=" Yum library file. png "alt=" wkiol1sbdmvgg-sjaahywdvri2g694.jpg "/> Then save exit
Testing with the Yum list
[email protected] yum.repos.d]# Yum list
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/54/69/wKioL1SBdhPSTy3PAAKXO8PLiFE716.jpg "title=" yum List.png "alt=" wkiol1sbdhpsty3paakxo8plife716.jpg "/> Use Yum to install DNS primary package bind
[email protected] yum.repos.d]# yum install bind-*-y
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/54/6B/wKiom1SBdkCgRG_sAAM5SkPUKvg704.jpg "title=" Yum install bind.png "alt=" wkiom1sbdkcgrg_saam5skpukvg704.jpg "/> Next Modify configuration file
[Email protected] ~]# vi/etc/named.conf
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/54/69/wKioL1SBeeuygLszAASr_dAju40541.jpg "title=" master configuration. png "alt=" wkiol1sbeeuyglszaasr_daju40541.jpg "/> Check file correctness
[Email protected] ~]# named-checkconf/etc/named.conf
[Email protected] ~]#
Come down and talk about/var/named. Named files are copied to the Chroot directory chroot is developed as a DNS security consideration for the role of a confusing attacker
[Email protected] ~]# cd/var/named/
[Email protected] named]#
[[email protected] named]# ls
Chroot data Dynamic named.ca named.empty named.localhost named.loopback Slaves
[Email protected] named]#
[Email protected] named]#
[email protected] named]# CP named.*/var/named/chroot/var/named/
[Email protected] named]#
Enter into the named directory of Chroot not to be confused with the front
[Email protected] named]# pwd
/var/named/chroot/var/named
[[email protected] named]# ls
named.ca Named.empty named.localhost Named.loopback
To create a forward and reverse parse file for DNS
[email protected] named]# CP named.empty Wang.zone
[Email protected] named]#
[Email protected] named]#
[[email protected] named]# ls
named.ca named.empty named.localhost Named.loopback wang.zone
[Email protected] named]#
[Email protected] named]#
[email protected] named]# CP named.empty Rewang.zone
The named.empty here is the template file
To modify a forward parsing file
[Email protected] named]# VI wang.zone
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/54/6B/wKiom1SBfJGSKlcaAAC5kBnZsl4199.jpg "title=" Forward parsing. png "alt=" wkiom1sbfjgsklcaaac5kbnzsl4199.jpg "/>
modifying reverse parsing files
[Email protected] named]# VI rewang.zone
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/54/6B/wKiom1SBfXvQbpnoAAFDYNb6HwE203.jpg "title=" reverse. png "alt=" Wkiom1sbfxvqbpnoaafdynb6hwe203.jpg "/>
Detect if there is a problem with the configured forward file
[Email protected] named]# Named-checkzone Wang.com/var/named/chroot/var/named/wang.zone
Zone wang.com/in:loaded Serial 0
Ok
[Email protected] named]#
To modify the root group in Var to a named group
Original:
[email protected] named]# LL
Total 24
-rw-r-----. 1 root root 1892 Dec 5 12:24 named.ca
-rw-r-----. 1 root root 5 12:24 named.empty
-rw-r-----. 1 root root 5 12:24 named.localhost
-rw-r-----. 1 root root 168 Dec 5 12:24 Named.loopback
-rw-r-----. 1 root root 189 Dec 5 12:42 Rewang.zone
-rw-r-----. 1 root root 185 Dec 5 12:35 Wang.zone
After modification:
[Email protected] named]# chown-r named/var/named/chroot/
[email protected] named]# LL
Total 24
-rw-r-----. 1 named Root 1892 Dec 5 12:24 named.ca
-rw-r-----. 1 named Root 5 12:24 Named.empty
-rw-r-----. 1 named Root 5 12:24 Named.localhost
-rw-r-----. 1 named Root 168 Dec 5 12:24 Named.loopback
-rw-r-----. 1 named Root 189 Dec 5 12:42 Rewang.zone
-rw-r-----. 1 named Root 185 Dec 5 12:35 Wang.zone
[Email protected] named]#
Next start the service, but sometimes the following problems occur
. Generating/etc/rndc.key appears when you start DNS: It's stuck here.
[Email protected] named]#/etc/init.d/named restart
Stopping named: [OK]
Generating/etc/rndc.key:
^c
[Email protected] named]#
Workaround:
[Email protected] named]# rndc-confgen-r/dev/urandom-a
Wrote key file "/etc/rndc.key"
[Email protected] named]#/etc/init.d/named restart
Stopping named: [OK]
Starting named: [OK]
Next Test
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/54/6A/wKioL1SBgQryimr5AAEk83AHuz4793.jpg "title=" Ping domain name for the first time. png "alt=" wkiol1sbgqryimr5aaek83ahuz4793.jpg "/>
Modify the Reslov file
[Email protected] named]# vi/etc/resolv.conf
Increase
Search www.wang.com
NameServer 10.10.39.183
Save exit.
And then Ping
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/54/6A/wKioL1SBgX-wC952AAGpu5cUmD0549.jpg "title=" Finally Ping.png "alt=" Wkiol1sbgx-wc952aagpu5cumd0549.jpg "/>
At this point, the master configuration of DNS is completed if there are any deficiencies and please correct me
Chong Brother Works
The construction of DNS service under Linux