DNS-BIND安裝調試及過程問題分析解決

DNS-BIND安裝調試及過程問題分析解決

一.bind安裝部分(本博客安裝部分)

   http://blog.sina.com.cn/s/blog_4a9e49b501011akv.html

二.bind日誌錯誤解答

 1.ipv6問題。

Jan 11 19:39:54 ns1-shpbs named-sdb[26931]: error (network unreachable) resolving 'ns.isc.afilias-nst.info/AAAA/IN': 2001:500:a::79#53

解決方法:

第一種:直接編譯配置文件/etc/sysconfig/named,去除去IPv6的解析,只解析IPv4(這種方法方便,呵呵)

OPTIONS="whatever" 改爲  OPTIONS="-4",注意OPTIONS選項的值可以是:whatever、-4、-6中的一個

第二種:禁用IPv6也是可以的

(1)編輯配置文件/etc/sysconfig/network,然後將NETWORKING_IPV6=YES改爲NETWORKING=no

(2)關閉ip6tables這個服務

(3)向/etc/modprobe.conf文件中,添加

alias ipv6 off 

alias net-pf-10 off

http://blog.sina.com.cn/s/blog_4a9e49b50100zg67.html

2.查詢非本服務器域名出現查詢拒絕問題。

服務器端日誌爲

Jan 12 19:23:50 ns1-shpbs named-sdb[2142]: client 114.92.138.68#54303: query (cache) 'fodder.qq.com/A/IN' denied

解決方法:

有人說要在named.conf里加:

 additional-from-cache  yes;

 additional-from-auth  yes;

 recursion  yes;

經過實驗,這個不行,正確的是加:

allow-query-cache { any; };

重新啓動named即可。

3.LAME Server 的問題 。

Jan  9 19:23:22 ns1-shpbs named-sdb[15720]: lame server resolving 'dns2.name-services.com' (in 'dns2.name-services.com'?): 98.124.194.1#53

當我們的 DNS 主機在向外面的 DNS 系統查詢某些正反解時,可能由於對方 DNS 主機的設定錯誤,導致無法解析到預期的正反解結果,這個時候就會發生所謂的 lame server 的錯誤! 

那麼這個錯誤會讓我們的 DNS 主機發生什麼嚴重的後果嗎?當然不會啦!因爲錯誤的是對方的 DNS 設定,只是我們的 DNS 主機在查詢時,會發生無法正確解析的警告信息而已,這個訊息雖然不會對我們的 Linux 主機發生什麼困擾,不過,對於系統管理員來說,要天天查詢的 /var/log/messages 檔案竟然有這麼多的登錄信息,這是很討厭的一件事!   

好了,我們知道 lame server 是對方主機的問題,對我們主機沒有影響,但是卻又不想要讓該訊息出現在我們的登錄檔 /var/log/messages 當中,怎麼達到這樣的功能呢?呵呵!就直接利用 BIND 這個套件所提供的登錄檔參數啊!動作很簡單,在您的 /etc/named.conf 檔案當中的最底下,加入這個參數即可:

解決方法:

[root@test root]# vi /etc/named.conf 

// 加入底下這個參數: 

logging { 

        category lame-servers { null; }; 

}; 

// 注意一下,那個 logging 是主要的參數,至於 category 則是定義出什麼信息, 

// 因爲我們不要 lame server ,所以選擇 lame-servers 這個參數,並定義 

// 參數值爲 null (空的的意思),這樣就修改完成了! 

2. 重新啓動 bind  

[root@test root]# /etc/rc.d/init.d/named restart

記得重新啓動 named 之後,還是要察看一下 /var/log/messages 喔!以確定 named 的正確啓動與否!然後,嘿嘿,以後就不會看到 lame server 咯!

4.rndc的問題 。

[root@server /]# /etc/init.d/named status

rndc: connection to remote host closed

This may indicate that the remote server is using an older version of

the command protocol, this host is not authorized to connect,

or the key is invalid.  

解決方法:

出現rndc: connection to remote host closed多半是rndc.conf中

key "key" {

        algorithm       hmac-md5;

      secret "c3Ryb25nIGVub3VnaCBmb3IgYSBtYW4gYnV0IG1hZGUgZm9yIGEgd29tYW4K";

};

secret與rndc.key中的secret不一致引起的。我的rndc.key內定如下:

key "rndckey" {

        algorithm       hmac-md5;

        secret "aIfie6oTVvSxcXv7gAPAfDJaoFNMG1iRv1Rb2BRFG8FPJtAL5jpkuBHUlPne";

};

於是修改rndc.conf中的secret與rndc.key中的一致就可以了。

key "key" {

        algorithm       hmac-md5;

      secret "aIfie6oTVvSxcXv7gAPAfDJaoFNMG1iRv1Rb2BRFG8FPJtAL5jpkuBHUlPne";

};

rndc的配置如下:

配置文件的生成

#rndc-confgen >/etc/rndcs.conf (#rndc-confgen -a 生成rndc.key)

查看內容爲:注意文件名是rndcs.conf

# Start of rndc.conf

key "rndc-key" {

        algorithm hmac-md5;

        secret "O3GzUMY5WJLFHNaYOajb7Q==";

};

options {

        default-key "rndc-key";

        default-server 127.0.0.1;

        default-port 953;

};   是rndc的配置

# End of rndc.conf

# Use with the following in named.conf, adjusting the allow list as needed:

# key "rndc-key" {

#       algorithm hmac-md5;

#       secret "O3GzUMY5WJLFHNaYOajb7Q==";

# };

# controls {

#       inet 127.0.0.1 port 953

#               allow { 127.0.0.1; } keys { "rndc-key"; };

# };   這些內容拷貝到/ect/named.conf中,這樣named就是rndc的一個應用了。

5.iptables 保護DNS-BIND服務器

如果您使用iptables來保護您的服務器,你可以添加DNS服務,這些規則。

[root@dns1 ~]#  iptables -A INPUT -p udp --sport 53 -m state --state ESTABLISHED,RELATED -j ACCEPT

[root@dns1 ~]#  iptables -A INPUT -p udp --dport 53 -j ACCEPT

[root@dns1 ~]#  iptables -A INPUT -p tcp --sport 53 -j ACCEPT

[root@dns1 ~]#  iptables -A INPUT -p tcp --dport 53 -j ACCEPT

[root@dns1 ~]#  iptables -A INPUT -p tcp -d 192.168.1.88 --dport 22 -j ACCEPT

[root@dns1 ~]#  iptables -A OUTPUT -p tcp -s 192.168.1.88 --sport 22 -j ACCEPT

[root@dns1 ~]#  iptables -A INPUT -p icmp -j ACCEPT

[root@dns1 ~]#  iptables -A OUTPUT -p icmp -j ACCEPT

[root@dns1 ~]#  service iptables save

經過測試沒問題!注:紅色22端口策略一定要寫上不然你是無法連接服務器,***可寫可不寫,

6.bind啓動報錯,啓動失敗

DNS-BIND安裝調試及過程問題分析解決
查看磁盤使用情況
DNS-BIND安裝調試及過程問題分析解決
磁盤空間已滿,清理日誌文件
DNS-BIND安裝調試及過程問題分析解決
CACTI監控情況(主)

DNS-BIND安裝調試及過程問題分析解決

CACTI監控情況(從)
DNS-BIND安裝調試及過程問題分析解決
7。dns啓動報錯
Sep 12 15:26:12 dns2 named[1541]: could not open entropy source /dev/urandom: file not found
Sep 12 15:26:12 dns2 named[1541]: using pre-chroot entropy source /dev/urandom

解決方法:

mknod -m 0444 /dev/random c 1 8; mknod -m 0444 /dev/urandom c 1 9

[root@dns2 dev]# ll urandom
crw-rw-rw- 1 root root 1, 9 Sep 12 15:26 urandom    //看到這個文件就OK

 

http://forums.gentoo.org/viewtopic-t-331958-view-previous.html

 

 

8。服務器日誌大量出現snmpd[3331]:Connection from UDP: [127.0.0.1]:1024

snmpd[3331]: Connection from UDP: [127.0.0.1]:1024

解決方案:

http://blog.sina.com.cn/s/blog_4a9e49b501012dbl.html

 

9.centos6.3日誌報錯kernel: nf_conntrack: table full, dropping packet

 

Feb 11 13:19:12 ns1-shpbs kernel: nf_conntrack: table full, dropping packet.

Feb 11 13:19:13 ns1-shpbs kernel: nf_conntrack: table full, dropping packet.

Feb 11 13:19:15 ns1-shpbs kernel: nf_conntrack: table full, dropping packet.

Feb 11 13:19:56 ns1-shpbs kernel: nf_conntrack: table full, dropping packet.

解決方案:

#echo 2097152 > nf_conntrack_max
#echo 300 > nf_conntrack_tcp_timeout_established

vi /etc/sysctl.conf

net.netfilter.nf_conntrack_tcp_timeout_established = 300
net.netfilter.nf_conntrack_max = 2097152

詳解http://blog.sina.com.cn/s/blog_4a9e49b501012dbd.html

然後執行/sbin/sysctl -p讓參數生效

 

10。BIND 9.9.0源碼安裝完,啓動後提示沒有權限提示

Mar 27 00:25:34 ns2-shpbs named[23623]: Could not open '/usr/local/named/var/run/named/session.key'.
Mar 27 00:25:34 ns2-shpbs named[23623]: Please check file and directory permissions or reconfigure the filename.
Mar 27 00:25:34 ns2-shpbs named[23623]: could not open file '/usr/local/named/var/run/named/session.key': Permission denied
Mar 27 00:25:34 ns2-shpbs named[23623]: could not create /usr/local/named/var/run/named/session.key
Mar 27 00:25:34 ns2-shpbs named[23623]: failed to generate session key for dynamic DNS: permission denied
Mar 27 00:25:34 ns2-shpbs named[23623]: sizing zone task pool based on 5 zones
Mar 27 00:25:34 ns2-shpbs named[23623]: set up managed keys zone for view _default, file 'managed-keys.bind'

解決方法:

#chown -R bind:bind var/run

http://blog.sina.com.cn/s/blog_4a9e49b50100zg65.html

bind9.9.0 版本有bug ,程序無怨無故會關閉,用9.9.0的朋友,建議還是趕快升級吧。



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章