域名解析錯誤分析及解決

1.1.1    初步判斷
查看網絡是否連接, 執行命令
ifconfig

執行命令,看是否能被解析:
ping localhost
ping www.baidu.com
不能被解析時,會提示錯誤: ping: bad address xxx

1.1.2    文件檢查
查看本地以下路徑內容:
/etc/hosts
/etc/resolv.conf
/etc/nsswitch.conf

比如:
# cat /etc/hosts
127.0.0.1       localhost

# cat /etc/resolv.conf
nameserver 192.168.0.1 # wlan0

查看/usr/lib/,  /lib/是否有以下文件:
libnss_dns*
lib/libnss_files*
libresolv*
命令比如: find /usr/lib/ -name "*libresolv*"


1.1.3    幫助命令
# netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG        0 0          0 wlan0
192.168.0.0     0.0.0.0         255.255.255.0   U         0 0          0 wlan0

# nslookup www.baidu.com
Server:    192.168.0.1

 

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