BIND编译安装

  1. 安装
# yum -y install gcc openssl-devel perl-devel //安装依赖
# https://www.isc.org/downloads/ //下载源码
# tar -xf bind-9.11.3.tar.gz
# cd bind-9.11.3
# ./configure --prefix=/export/bind-9.11.3
# make
# make install
  1. 配置
  • rndc.conf
# /export/bind-9.11.3/sbin/rndc-confgen > /export/bind-9.11.3/etc/rndc.conf 
  • named.conf
# tail -n 10 /export/bind-9.11.3/etc/rndc.conf | head -n 9 | sed 's/#\ //g' > /export/bind-9.11.3/etc/named.conf
# vim /export/bind-9.11.3/etc/named.conf 
...... 
options { 

directory "/export/bind-9.11.3/data"; 

pid-file "/export/bind-9.11.3/var/run/named.pid"; 

allow-query { any; };

recursion yes; 

notify yes; 

forwarders { 8.8.8.8; };

forward first; 

}; 

acl "tom" {

localhost;

192.168.2.9;

};

view netcom {

    match-clients { tom; };

    zone "." IN { 

        type hint; 

        file "db.ca";

     };

    zone "[yourdomain.com](http://yourdomain.com/)" IN {

        type master;

        file "[db.yourdomain.com](http://db.yourdomain.com/)";

    };

    zone "10.168.192.in-addr.arpa" IN { 

        type master; 

        file "db.192.168.10"; 

   }; 

}; 

logging{ 

channel default_debug { file "data/named.run"; severity dynamic; };

channel default_log {file "/export/Logs/bind/default.log" versions 10 size 100m; severity info; print-time yes; print-severity yes; print-category yes; }; 

channel general_log {file "/export/Logs/bind/general.log" versions 10 size 100m; severity info; print-time yes; print-severity yes; print-category yes; }; 

channel query_log {file "/export/Logs/bind/query.log" versions 10 size 100m; severity info; print-time yes; print-severity yes; print-category yes; }; 

category default { default_log; };

category general { general_log; };

category queries { query_log; }; 

};

  • 根解析-db.ca
# mkdir -p /export/bind-9.11.3/data
# mkdir -p /export/bind-9.11.3/log
# dig > /export/bind-9.11.3/data/db.ca
  • zone - 正向解析
 # vim /export/bind-9.11.3/data/db.yourdomain.com
$TTL 86400 
@ IN SOA dns1.yourdomain.com. root.localhost. ( 
2017042011 ;Serial 
3H ;Refresh 
15M ;Retry 
1W ;Expiry 
1D ) ;Minimum 
@ IN NS dns1.yourdomain.com.
dns1 IN A 192.168.10.10 
mail IN A 192.168.10.11
www IN A 192.168.10.12 
dell IN CNAME www
  • zone - 反向解析
# vim /export/bind-9.11.3/data/db.192.168.10 
$TTL 86400 
@ IN SOA dns1.yourdomain.com. root.localhost. ( 
2017042011 ;Serial 
3H ;Refresh 
15M ;Retry 
1W ;Expiry 
1D ) ;Minimum 
@ IN NS dns1.yourdomain.com. 
10 IN PTR dns1.yourdomain.com. 
11 IN PTR mail.yourdomain.com. 
12 IN PTR www.yourdomain.com. 
12 IN PTR dell.yourdomain.com.
  • 配置检查
# /export/bind-9.11.3/sbin/named-checkzone yourdomain.com /export/bind-9.11.3/data/db.yourdomain.com
# /export/bind-9.11.3/sbin/named-checkconf  /export/bind-9.11.3/etc/named.conf
  1. 启动
# /export/bind-9.11.3/sbin/named -c /export/bind-9.11.3/etc/named.conf -g

你可能感兴趣的:(BIND编译安装)