標籤:
https://www.isc.org/downloads/
2、解壓tar zxvf bind-9.9.7rc1.tar.gz
cd bind-9.9.7rc1
3、編譯安裝
./configure --prefix=/usr/local/named --enable-threads #--enable-threads
提示沒有openssl
checking for OpenSSL library... configure: error: OpenSSL was not found in any of /usr /usr/local /usr/local/ssl /usr/pkg /usr/sfw; use --with-openssl=/path
--------------------------------------------------------------------------------------------------
提示沒有OpenSSL
解決方案:
yum install openssl
yum install openssl-devel
【 ubuntu系統解決方案 apt-get install openssl apt-get install libssl-dev】
【sudo ./rndc-confgen > rndc.conf 反應很久】
----------------------------
解決方案:
http://www.nginxs.com/linux/43.html
【/home/wkubuntu/named/sbin/named -c /home/wkubuntu/named/etc/named.conf & 按兩次,沒有出現 done 】
---------------------------
cd /home/wkubuntu/named/etc
vi named.conf 修改一下這個檔案。。把上面copyright 去掉
-----------------------------------------------------------------------------------------------------------------------------------------------
2015年2月4日
1、sudo wget ftp://ftp.isc.org/isc/bind9/9.10.1/bind-9.10.1.tar.gz
2、tar -zxvf bind-9.10.1.tar.gz
3、建立目錄
在/home/wkubuntu下建立named目錄和namedfile目錄
4、編譯安裝
cd bind-9.10.1
./configure --prefix=/home/wkubuntu/named/ --with-dlz-mysql=/usr/local/mysql
make
make install
此時進入/home/wkubuntu/named目錄,裡面自動產生了bin etc include lib sbin share var這些檔案目錄
5、配置bind
cd /home/wkubuntu/named/etc
touch named.conf
vi named.conf張貼內容1
在/home/wkubuntu/named/var 目錄下拷貝那5個檔案
產生rndc的key
a)cd /home/wkubuntu/named/sbin/
b)vim random 輸入很長一段字母。就是伺服器上沒有random產生器,這種情況下我們就手動偽造一個檔案代替/dev/random的功能
c)rndc-confgen -r random > /etc/rndc.key
d)cat /etc/rndc.key
e)拷貝
secret "pfNOQ0fENSBBGBYn/ndRsw=="; 這一行
覆蓋/home/wkubuntu/named/etc 的named.conf對應的那一行
6、啟動bind ,列印進程
輸入兩次sudo /home/wkubuntu/named/sbin/named -c /home/wkubuntu/named/etc/named.conf &
出現done 就代表成功了
【如果出現了exit,出錯了,看列印進程sudo /home/wkubuntu/named/sbin/named -gc /home/wkubuntu/named/etc/named.conf &
killall named 可以關閉掉所有named,如果用了-gc的話】
要建立一個log目錄,如下的配置 mkdir logs
/home/wkubuntu/named/logs
其他:
內容1:
logging{channel error_log { file "/home/wkubuntu/named/logs/normal.log" versions 3 size 2m; severity error; print-time yes; print-severity yes; print-category yes;};category default{ error_log; };channel update_log{ file "/home/wkubuntu/named/logs/update.log" versions 3 size 1m; severity info; print-time yes; print-severity yes; print-category yes;};category update{ update_log;};channel notify_log{ file "/home/wkubuntu/named/logs/notify.log" versions 3 size 1m; severity info; print-time yes; print-severity yes; print-category yes;};category notify{ notify_log;};};options { directory "/home/wkubuntu/named/var/"; pid-file "/home/wkubuntu/named/var/run/named/named.pid"; dump-file "/home/wkubuntu/named/logs/named_dump.db"; statistics-file "/home/wkubuntu/named/logs/named.stats"; version "Welcome to NIOT platform!"; listen-on-v6 { any; }; allow-query { any; }; allow-query-cache { any; }; allow-recursion { localnets; localhost; }; notify no;};key "rndc-key" { algorithm hmac-md5; secret "fLDVvLVXFjMJpdiy+7nESw==";};controls { inet 127.0.0.1 port 953 allow { 127.0.0.1; } keys { "rndc-key"; };};zone "." IN { type hint; file "/home/wkubuntu/named/var/named.root";};zone "localhost" IN { type master; file "/home/wkubuntu/named/var/localhost.zone"; allow-update { none; };};zone "0.0.127.in-addr.arpa" IN { type master; file "/home/wkubuntu/named/var/localhost.reverse"; allow-update { none; };};dlz "Mysql zone" { database "mysql {host=127.0.0.1 dbname=db_epp ssl=false port=3306 user=root pass=root} {select zone from dns_records where zone = ‘$zone$‘ limit 1} {select ttl, type, mx_priority, case when lower(type) = ‘txt‘ then concat(‘\"‘, data, ‘\"‘) when lower(type) = ‘soa‘ then concat_ws(‘ ‘, data, resp_person, serial, refresh, retry, expire, minimum) when lower(type) = ‘naptr‘ then concat(‘ ‘, naptr_order, ‘ ‘, naptr_preference, ‘ \"‘, naptr_flags, ‘\"‘, ‘ \"‘, naptr_service, ‘\"‘, ‘ \"‘, naptr_regexp,‘\" ‘, data, ‘.‘) else data end from dns_records where zone = ‘$zone$‘ and host = ‘$record$‘}";};
7、測試
dig @localhost 6920000000012.running.niot.cn naptr
資料庫裡面要有這條記錄,如上測試即可
linux安裝bind