系統環境:CentOS 6.5 X64python
軟件版本:mysql
描述:git
1.源碼編譯安裝github
tar -zxvf bind-9.9.5.tar.gz #解壓壓縮包 cd bind-9.9.5 ./configure --prefix=/usr/local/bind/ \ --enable-threads=no \ --enable-newstats \ --with-dlz-mysql \ --disable-openssl-version-check #官網說明強調編譯關閉多線程,即--enable-threads=no make make install #源碼編譯安裝完成
2.環境變量配置sql
cat>>/etc/profile< PATH=$PATH:/usr/local/bind/bin:/usr/local/bind/sbin export PATH EOF
source /etc/profile #從新加載一下環境變量 named -v
以下圖,說明環境變量是正常
數據庫
3.用戶添加受權目錄bash
useradd -s /sbin/nologin named chown -R named:named /usr/local/bind/
4.配置綁定服務器
vi /usr/local/bind/etc/named.conf多線程
options{ directory"/usr/local/bind/"; version"bind-9.9.9"; listen-onport53 { any; }; allow-query-cache { any; }; listen-on-v6port53 {::1; }; allow-query { any; }; recursion yes; dnssec-enable yes; dnssec-validation yes; dnssec-lookaside auto; }; key"rndc-key"{ algorithm hmac-md5; secret"C4Fg6OGjJipHKfgUWcAh+g=="; }; controls { inet 127.0.0.1port953 allow{ 127.0.0.1; } keys {"rndc-key";}; }; view"ours_domain"{ match-clients {any; }; allow-query-cache {any; }; allow-recursion {any; }; allow-transfer {any; }; dlz"Mysql zone"{ database"mysql {host=127.0.0.1 dbname=named ssl=false port=3306 user=root pass=123456} {select zone from dns_records where zone='$zone$'} {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) else data end from dns_records where zone = '$zone$' and host = '$record$'}"; }; zone"."IN { type hint; file"/usr/local/bind/etc/named.ca"; }; };
保存退出框架
生成name.ca文件
(demo) -bash-4.1# cd /usr/local/bind/etc/ (demo) -bash-4.1# dig -t NS .>named.ca
5.配置數據庫,導入sql文件
# mysql -p #登陸數據庫 mysql>CREATE DATABASE named CHARACTER SET utf8 COLLATE utf8_general_ci; mysql>source named.sql; #注意路徑,這裏我放在當前目錄
就兩張表,一個dns用到的表,一個用戶管理表
6.啓動綁定服務並設置開機啓動腳本
(demo) -bash-4.1# /usr/local/bind/sbin/named
監控系統日誌:
tail -f /var/log/messages
以下,說明服務啓動正常
測試bind鏈接數據庫是否正常:
設置綁定開機啓動腳本
bind 本文檔會附帶,傳到服務器 /etc/init.d/ 目錄 (demo) -bash-4.1# chmod 755 /etc/init.d/bind (demo) -bash-4.1# #mkdir /var/run/named/ && chown named:named -R /var/run/named 殺掉 named 服務,改用腳本啓動 (demo) -bash-4.1# pkill named (demo) -bash-4.1# /etc/init.d/bind start #監控日誌,查看啓動狀態 (demo) -bash-4.1# chkconfig --add bind #加入開機啓動
#tail -f / var / log / messages
克隆管理平臺
(demo) -bash-4.1# git clone https://github.com/1032231418/Bind-Web.git #git 克隆下來 (demo) -bash-4.1# cd Bind-Web (demo) -bash-4.1# python run.py
運行軟件程序使用燒瓶框架寫的,要用pip安裝該框架
點安裝
http:// ip / 5000 訪問WEB界面登陸
帳戶:老鷹
密碼:123456
功能:
解析測試: