Debian
Debian 無法解析主機名
我在解析在 VMWare 上執行的 Debian 上的主機名時遇到問題。
它只是突然停止工作。在解除安裝 percona 伺服器並刪除 /etc/mysql. 最初它認為這是一個網路問題,當主機在來賓執行時進入睡眠狀態,這是 VMWare 的一個已知問題。但它不可能。
Debian 7.4,已安裝 VMWare 工具
/etc/resolv.conf
# Generated by NetworkManager nameserver 8.8.8.8 nameserver 8.8.4.4
ping、dig 和 nslookup 輸出
ivar@debian:~$ ping 8.8.8.8 PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. 64 bytes from 8.8.8.8: icmp_req=1 ttl=47 time=40.0 ms 64 bytes from 8.8.8.8: icmp_req=2 ttl=47 time=39.7 ms ^C --- 8.8.8.8 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1002ms rtt min/avg/max/mdev = 39.747/39.874/40.001/0.127 ms ivar@debian:~$ dig google.com ; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> google.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 18895 ;; flags: qr rd ra; QUERY: 1, ANSWER: 11, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;google.com. IN A ;; ANSWER SECTION: google.com. 299 IN A 173.194.113.100 google.com. 299 IN A 173.194.113.99 google.com. 299 IN A 173.194.113.96 google.com. 299 IN A 173.194.113.103 google.com. 299 IN A 173.194.113.110 google.com. 299 IN A 173.194.113.102 google.com. 299 IN A 173.194.113.98 google.com. 299 IN A 173.194.113.105 google.com. 299 IN A 173.194.113.97 google.com. 299 IN A 173.194.113.101 google.com. 299 IN A 173.194.113.104 ;; Query time: 43 msec ;; SERVER: 8.8.8.8#53(8.8.8.8) ;; WHEN: Sat Mar 29 18:46:07 2014 ;; MSG SIZE rcvd: 204 ivar@debian:~$ nslookup google.com Server: 8.8.8.8 Address: 8.8.8.8#53 Non-authoritative answer: Name: google.com Address: 173.194.113.97 Name: google.com Address: 173.194.113.104 Name: google.com Address: 173.194.113.101 Name: google.com Address: 173.194.113.99 Name: google.com Address: 173.194.113.100 Name: google.com Address: 173.194.113.96 Name: google.com Address: 173.194.113.102 Name: google.com Address: 173.194.113.103 Name: google.com Address: 173.194.113.110 Name: google.com Address: 173.194.113.105 Name: google.com Address: 173.194.113.98 ivar@debian:~$ ping google.com ping: unknown host google.com
任何想法如何解決這個問題?
/etc/nsswitch.conf
# /etc/nsswitch.conf # # Example configuration of GNU Name Service Switch functionality. # If you have the `glibc-doc-reference' and `info' packages installed, try: # `info libc "Name Service Switch"' for information about this file. passwd: compat group: compat shadow: compat hosts: files mdns4_minimal wins [NOTFOUND=return] dns mdns4 networks: files protocols: db files services: db files ethers: db files rpc: db files netgroup: nis
使用您目前的 dns ,只有在請求失敗
nsswitch.conf
時才會請求。以下是我係統上手冊頁wins
的相關摘錄:nsswitch.conf
notfound
查找成功,但未找到請求的條目。此條件的預設操作是“繼續”。
return
現在返回一個結果。不要呼叫任何進一步的查找函式。
在您的範例中,您成功查詢了 WINS,但沒有檢索到
google.com
. 要解決此問題,您可以刪除[NOTFOUND=return]
或重新排序為主機查找而查詢的服務。這是一個範例修復:hosts: files mdns4_minimal dns wins [NOTFOUND=return] mdns4