無法透過主機名稱 ping 某些計算機

無法透過主機名稱 ping 某些計算機

我安裝的是11.04。

它已加入網域。我可以透過某些電腦的名稱 ping 通它們,但有些則不能。我無法使用的是我們的 NAS 機器 (Readynas Netgear)。我只能從我的 Ubuntu 機器上透過 IP 來 ping 通它們。但我可以從任何其他 Windows 電腦透過主機名稱定期對它們執行 ping 操作。

請告知我該檢查什麼?

答案1

只需添加WINS到文件hosts:中的行/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 lsass
group:          compat lsass
shadow:         compat

hosts:          files mdns4_minimal [NOTFOUND=return] wins dns mdns4
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

這告訴系統使用 WINS 來尋找 netbios。winbind必須安裝該軟體包才能使其運作。

答案2

對於一種更黑客的方法,然後列出的方法@薩里科您可以編輯您的主機檔案。這不是一個可靠的解決方案,如果您的網路設定發生變化,則必須手動更新。

如果名稱無法透過其他工具(例如wins和dns)正確解析,它還可以隱藏網路問題

在 Ubuntu 和許多其他 *nix 上找到主機文件

/etc/主機

在Windows中,通常可以找到hosts文件

C:\WINDOWS\system32\drivers\etc\hosts
%systemroot%\system32\drivers\etc\hosts

若要在 Ubuntu 中進行更改,請編輯該檔案並輸入所需的 IP 位址和主機名稱。

sudo vi /etc/hosts
192.168.1.1 伺服器名稱
192.168.1.2 伺服器2名稱

在我的主機檔案中,我新增了為 Web 開發設定的所有 Web 伺服器

127.0.0.1 local.home 127.0.0.1 local.site1

然後我就可以 ping 通了

$ ping 本地.home
PING local.home (127.0.0.1) 56(84) 位元組資料。
來自本地主機 (127.0.0.1) 的 64 位元組:icmp_seq=1 ttl=64 時間=0.037 毫秒

相關內容