"Linux" DNS server Setup, master and slave server configuration synchronization!

Source: Internet
Author: User

Experimental environment

Using CentOS6.5 x64 to build a DNS server

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/79/BE/wKioL1aaQm-A-OoxAAAE9Z93Vic754.png "title=" {SQL2 ( (2X) E (9s3~8ln~~ $M. png "alt=" Wkiol1aaqm-a-ooxaaae9z93vic754.png "/>

Bind the virtual machine to the VMnet1 NIC to communicate with the real machine

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/79/BE/wKioL1aaQtbgLFtmAAAo-s8sIsU534.png "title=" 4~%) CC [D05145$pwy0j{(O8.png "alt=" Wkiol1aaqtbglftmaaao-s8sisu534.png "/>

Configure the virtual network card for the VMNET1 and point the DNS to the virtual machine

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/79/BE/wKioL1aaQ7fQ0l8rAAAX5hEcElY805.png "title=") 3r8} io0x ' 5paquzgqn~2{t.png "alt=" Wkiol1aaq7fq0l8raaax5hecely805.png "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/79/BF/wKiom1aaQ2Ww-yJDAABy3Ar_bzo063.png "style=" float: none; "title=" 87t{y ' ~) pdjm_bhl) 3zu{ev.png "alt=" Wkiom1aaq2ww-yjdaaby3ar_bzo063.png "/>



Experiment Configuration


It is recommended to close iptables and SELinux first

[email protected] ~]# mount/dev/cdrom/mnt //Mount CD to the MNT directory

Mount:block Device/dev/sr0 is write-protected, mounting read-only

[Email protected] ~]#


Installing the DNS Package

[Email protected] ~]# rpm-ivh/mnt/packages/bind-9.8.2-0.17.rc1.el6_4.6.x86_64.rpm


Modify the main distribution file, the master profile only needs to modify the optins{} entry

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

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/79/BF/wKioL1aaR8Hx5Bq8AAEh99IYhhE457.png "title=" 5fg_ z8v%wyexlq}b{p0$}) 0.png "alt=" Wkiol1aar8hx5bq8aaeh99iyhhe457.png "/>

Modifying a zone configuration file

[Email protected] ~]# Vi/etc/named.rfc1912.zones

The forward zone configuration file format is zone{};

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/79/C0/wKiom1aaSqDCHsojAAELnFBSdzg058.png "title=" 21q]n} waww$ef@) [4{_gfgv.png "alt=" Wkiom1aasqdchsojaaelnfbsdzg058.png "/>


Add a reverse region at the end of the configuration file with the same format as the forward region

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/79/BF/wKioL1aaTCbi1xJ6AACLjFZDvdI606.png "title=" v$_ mf@k) BG ' 2h4t0pr_4jgc.png "alt=" Wkiol1aatcbi1xj6aacljfzdvdi606.png "/>

Modify a record file

[[email protected] ~]# cd/var/named/ //The directory where the switch value record file is located

Copy the configuration template, record files for the forward zone, and reverse zone record files. "-P" preserves the file attributes,

[Email protected] named]# cp-p named.localhost test.com.zone

[Email protected] named]# cp-p named.localhost test.com.local

[Email protected] named]# vim Test.com.zone

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/79/BF/wKioL1aaT3jBeABtAADkHclrZzU059.png "title=" b]u[) Uu%c2m]z7kek (3) (t3.png "alt=" Wkiol1aat3jbeabtaadkhclrzzu059.png "/>


Edit Reverse Parse File

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/79/C0/wKiom1aaUL_DNz1MAADAKF96ZKs482.png "title=" N[CWVR %2vi2wvj ' H0oj[pfj.png "alt=" Wkiom1aaul_dnz1maadakf96zks482.png "/>

To start a service with services

[[Email protected] named]# service named start

Generating/etc/rndc.key: [ OK ]

Start named: [ OK ]

[Email protected] named]#


Resolving domain names using nslookup in a real machine


Forward parsing

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/79/C0/wKiom1aaUq6zDkwWAAB16McOy-k220.png "title=" ohno% 1iajkm1[1b~g1u7_g5.png "alt=" Wkiom1aauq6zdkwwaab16mcoy-k220.png "/>


Reverse parsing

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/79/C0/wKiom1aaU1XQimEQAABty4Nchdo867.png "title=" 7@urw{ ) 40gk7~m]4 (kiw_nj.png "alt=" Wkiom1aau1xqimeqaabty4nchdo867.png "/>

-------------------------------------------------------------

Configure DNS from the server


Experimental environment

Then the above experiment starts a centos6.5 virtual machine to do from the server

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/79/C0/wKiom1aaVITi1_NNAAAKw24Fyyc477.png "title=" Rp_se_ Fwnlug[j_55jgx7%8.png "alt=" Wkiom1aaviti1_nnaaakw24fyyc477.png "/>

From the server NIC is also bound to the VMNET1 network card, the IP address of 192.168.10.200/24 to ensure that the two servers can communicate

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/79/BF/wKioL1aaVaSif1cYAAAnXW5gxp4893.png "title="}r] b9x8) p6ql7jz0fhv2wpg.png "alt=" Wkiol1aavasif1cyaaanxw5gxp4893.png "/>


Experiment Configuration

Configuring the primary server

To modify the server's zone configuration file


[Email protected] ~]# Vim/etc/named.rfc1912.zones

Only need to add the following 2 lines in the original configuration file, forward parsing

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/79/C2/wKiom1aaY4-TsC2LAACdcnwG2vk470.png "title=" y52k${ 1m1]816@q{3_n5{21.png "alt=" Wkiom1aay4-tsc2laacdcnwg2vk470.png "/>

Reverse parsing

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/79/C2/wKiom1aaY8OiIVYxAAAuIElnhZc636.png "title=" SW (9[ 5w1v~%_7b[vu642vaj.png "alt=" Wkiom1aay8oiivyxaaauielnhzc636.png "/>


Configuring with service overloading

[Email protected] ~]# service named Reload

Re-loading named: [ OK ]

[Email protected] ~]#





From server configuration

The installation process through the same, omitted here


Modify the master configuration file from the server

[Email protected] ~]# vim/etc/named.conf

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/79/C0/wKiom1aaVqqhJy5rAAE58JW8QnQ298.png "title=" j$ 9fdna}2[m ' TDS ']b[tf ' m.png "alt=" Wkiom1aavqqhjy5raae58jw8qnq298.png "/>

Modify the Zone profile from the server

[Email protected] ~]# Vim/etc/named.rfc1912.zones

Forward parsing configuration

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/79/C1/wKioL1aaYyqyt-tiAACni6P2k7U874.png "title=" 84j{ PNJW%5AH5HAMOB@G52B.png "alt=" Wkiol1aayyqyt-tiaacni6p2k7u874.png "/>

Reverse parsing configuration

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/79/BF/wKioL1aaWgGBMJwpAAAnJO7D_zU377.png "title=" R) v}$ C2 ' {~h_{' bt}ez5{6k.png "alt=" Wkiol1aawggbmjwpaaanjo7d_zu377.png "/>


Start the DNS service

[[Email protected] ~]# service named start

Generating/etc/rndc.key: [ OK ]

Start named: [ OK ]

[Email protected] ~]#


When switching from server to

[Email protected] ~]# cd/var/named/

Using LS view will send one more slaves directory

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/79/C2/wKioL1aaZLqQ0JZ-AABq280QcqE516.png "title="]q96h@ $) 3rg[k6 (c{l%~a21.png "alt=" Wkiol1aazlqq0jz-aabq280qcqe516.png "/>

View slaves will find that the master server's log files have been synchronized.

650) this.width=650, "src=" http://s3.51cto.com/wyfs02/M01/79/C3/wKiom1aaZMyyo0lxAAAXYlrVJYo555.png "title="%) @I3V ' 6LA (yyfg~3jjotsv.png "alt=" Wkiom1aazmyyo0lxaaaxylrvjyo555.png "/>



Change the DNS of the real machine to resolve authentication from the server

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/79/C3/wKiom1aaZfngcEU_AACPVgSLiVQ499.png "style=" float: none; "Title=" 4e}fw5d) q0~8l4yvsyj8]af.png "alt=" Wkiom1aazfngceu_aacpvgslivq499.png "/>


Forward Domain name resolution

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/79/C3/wKiom1aaZfrhYEd1AADYCQCJUDQ233.png "style=" float: none; "Title=" 3O5) vje@{ox%6$m2]qhyk2w.png "alt=" Wkiom1aazfrhyed1aadycqcjudq233.png "/>


Reverse Domain Name resolution

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/79/C4/wKiom1aaZkmwhaP5AAAwdbJewho142.png "title=" ~c0}_8 %2 ' x[j75a%_xw ' hkc.png "alt=" Wkiom1aazkmwhap5aaawdbjewho142.png "/>



DNS port number TCP and UDP 53 port, UDP 53 for DNS resolution, TCP 53 for zone transfer

Forward parsing: The IP address is resolved by the domain name

Reverse resolution: The domain name is resolved by IP address

This article is from the "Sunj" blog, make sure to keep this source http://sunjie123.blog.51cto.com/1263687/1735709

"Linux" DNS server Setup, master and slave server configuration synchronization!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.