Compiling and installing bind-9.9.5
Environment: Development tools and Server Platform development
[Email protected] ~]# tar xf bind-9.9.5.tar.gz #解压 [[email protected] ~]# CD bind-9.9.5 #进入目录
Should run as a normal user, so create a normal user
[[email protected] bind-9.9.5]# id named #查看named用户是否存在id: named: no such user[[email protected] bind-9.9.5]# groupadd -r -g 53 named #创建named组 [[email protected] bind-9.9.5]# useradd -g named -r -u 53 named #创建named用户 [[email protected] bind-9.9.5]# id named #查看named用户信息uid =53 (named) gid=53 (named) groups=53 (named) Compile and install [[ Email protected] bind-9.9.5]# ./configure --prefix=/usr/local/bind9 --sysconfdir=/etc /named/ --enable-threads --disable-chroot --disable-ipv6 [[email Protected] bind-9.9.5]# make && make install option:--enable-threads #启用多线程功能--disable-chroot #不启用chroot功能--disable-ipv6 # Do not enable IPv6
Bind Client Tool: Bind-libs,bind-utils under the installation directory under Bin
Define Environment variables:
[Email protected] bind9]# vim/etc/profile.d/bind.shexport path=/usr/local/bind9/bin:/usr/local/bind9/sbin: $PATH [[ Email protected] bind9]#. /etc/profile.d/bind.sh [[email protected] bind9]# Dig-vdig 9.9.5
To export the man document:
[Email protected] named]# Vim/etc/man.config Manpath/usr/local/bind9/share/man
Export Header File
If you develop software two times, you need to export the header and library files. But named don't need it.
Export Library files
[[email protected] bind9]# ls liblibbind9.a libdns.a libisc.a libisccc.a libisccfg.a LIBLWRES.A because they are static libraries, so do not export, otherwise you need to edit/ etc/ld.so.conf.d/bind9.conf file write to library directory
Configuration file:
[[email protected] ~]# cd /etc/named[[email protected] named]# vim named.confoptions { directory "/var/named"; #区域文件所在目录 recursion yes; #是否允许递归};zone "localhost" IN { type master; file "Localhost.zone"; allow-update { none ; };}; zone "0.0.127.in-addr.arpa" IN { type master; file "127.0.0.zone"; allow-update { none; };};
Change to the genus principal group
[[email protected] named]# chown root:named named.conf[[email protected] named]# chmod 640 named.conf[[email protected] Na med]# mkdir/var/named/slaves-pvmkdir:created directory '/var/named ' mkdir:created directory '/var/named/slaves ' [[ Email protected] named]# chown root:named/var/named[[email protected] named]# chown named:named/var/named/slaves/[[ Email protected] named]# chmod 750/var/named[[email protected] named]# chmod 770/var/named/slaves/
Provide the CA file
[[email protected] named]# dig-t NS. @a.root-servers.net >/var/named/named.ca
Create a forward and backward parsing file:
[[email protected] named]# vim localhost.zone$ttl 86400@ IN SOA localhost. admin.localhost. ( 2015072301 3H 15m 7d 1D ) IN ns localhost. in a 127.0.0.1[[email protected ] named]# vim 127.0.0.zone$ttl 86400@ in SOA localhost. admin.localhost. ( 2015072301 3H 15M 7D 1d ) IN NS localhost. IN ptr &nbSp; localhost.
Change to the genus principal group
[Email protected] named]# chgrp named 127.0.0.zone localhost.zone named.ca [[email protected] named]# chmod 640 127.0.0.z One localhost.zone named.ca [[email protected] named]# lltotal 16-rw-r-----. 1 root named 133 Jul 19:50 127.0.0.zone-rw-r-----. 1 root named 129 Jul 19:48 Localhost.zone-rw-r-----. 1 root named 2177 Jul 19:45 named.cadrwxrwx---. 2 named named 4096 Jul 19:39 Slaves
Check configuration file, zone file syntax error
[Email protected] named]# named-checkconf/etc/named/named.conf [[email protected] named]# named-checkzone "localhost" /var/named/localhost.zone Zone localhost/in:loaded serial 20150723ok[[email protected] named]# Named-checkzone " 0.0.127.in-addr.arpa "/var/named/127.0.0.zone zone 0.0.127.in-addr.arpa/in:loaded serial 20150723OK
Start
[Email protected] named]# named-g-u named-c/etc/named/named.conf
Add a Zone resolution library file
[[email protected] named]# vim /etc/named/named.conf zone "School.com" IN { type master; file "School.com.zone"; allow-transfer { 192.168.0.0/24; 127.0.0.1; }; allow-update { none; };}; [[email protected] named]# vim /var/named/school.com.zone$ttl 3600@ in soa ns.school.com. admin.school.com. ( 2015072301 1h 10M 7D 1D ) in ns nsns IN A 192.168.0.9www IN a 192.168.0.15
Change to the genus principal group
[Email protected] named]# chown:named school.com.zone [[email protected] named]# chmod 640 School.com.zone
Start
[Email protected] named]# named-u named-c/etc/named/named.conf
[Email protected] named]# SS-TUNL
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/70/13/wKioL1Ww5m7QYe5JAABLz81n_u8031.jpg "style=" float: none; "title=" Qq20150723205623.png "alt=" Wkiol1ww5m7qye5jaablz81n_u8031.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/70/16/wKiom1Ww5IjA7f49AABHWpmG5AQ400.jpg "style=" float: none; "title=" Qq20150723205639.png "alt=" Wkiom1ww5ija7f49aabhwpmg5aq400.jpg "/>
Test after reboot
[Email protected] named]# dig-t A www.school.com @192.168.0.9; <<>> DiG 9.9.5 <<>>-t A www.school.com @192.168.0.9;; Global options: +cmd;; Got answer:;; ->>header<<-opcode:query, Status:noerror, id:53521; FLAGS:QR AA Rd RA; Query:1, Answer:1, Authority:1, Additional:2; OPT pseudosection:; edns:version:0, Flags:; udp:4096;; QUESTION Section:;www.school.com.ina; ANSWER section:
Generate RNDC
[[email protected] named]# rndc-confgen-r/dev/urandom >/etc/named/rndc.conf[[email protected] named]# cat/etc/name d/rndc.conf add RNDC info [[email protected] named]# vim/etc/named/named.conf key "Rndc-key" {algorithm hmac-md5; Secret "txqzxfssz1hphn28t+ghua=="; }; Controls {inet 127.0.0.1 port 953 allow {127.0.0.1;} keys {"Rndc-key";};};
Reread configuration Files
[Email protected] named]# killall-hup named [[email protected] named]# RNDC reloadserver Reload Successful[[email Protec Ted] named]# rndc statusversion:9.9.5 <id:f9b8a50e>cpus found:4worker threads:4udp listeners per Interface:4numb Er of zones:101debug level:0xfers running:0xfers Deferred:0soa queries in progress:0query logging is offrecursive CLI Ents:0/0/1000tcp Clients:0/100server is up and running
Changed to the main group of the genus
[Email protected] named]# chmod rndc.conf [[email protected] named]# chgrp named rndc.conf
Provide scripts
/etc/rc.d/init.d/functions function is classic, should read more
Pressure test
Bind-9.9.5/contrib/queryperf
Compile
./configure
Make no make install
CP Queryperf/usr/bin installed successfully
Create a test file
Format
ns.school.com Amail.school.com Apop.school.com A
Test
[[Email protected] ~]# queryperf -d test.txt -s 192.168.0.9dns query Performance Testing ToolVersion: $Id: queryperf.c,v 1.12 2007/09/05 07:36:04 marka exp $[status] processing input data[status] sending queries (beginning with 192.168.0.9) [status] testing completestatistics: parse input file: once ended due to: reaching end of file queries sent: 257664 queries queries completed: 257664 queries Queries lost: 0 queries queries delayed (?): 0 queries rtt max: 0.019282 sec rtt min: 0.000038 sec rtt average: 0.000383 sec RTT std deviation: 0.000590 sec rtt out of range: 0 queries percentage completed: 100.00% percentage lost: 0.00% Started at: Thu Jul 23 22:13:32 2015 finished at: thu jul 23 22:13:39 2015 ran for: 6.266114 seconds queries per second: 41120.222198 qps
This article is from the "Walker" blog, please be sure to keep this source http://223228686.blog.51cto.com/2222284/1677795
Compile and install bind-9.9.5 and test