解決自己的主機名稱問題

解決自己的主機名稱問題

我正在運行 10.04 LTS 伺服器。我無法解決此問題:「無法解析主機 serverubuntu」。

我已經嘗試了所有推薦的解決方案,但沒有一個有效。我讀到此問題可能是由主機和主機名稱檔案中的不正確設定引起的:

以下是這些文件的競賽:

檔案:主機名

serverubuntu

文件:主機

127.0.0.1       localhost
127.0.1.1       serverubuntu

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

注意:我已經為主機檔案的第二行嘗試了幾個不同的條目:

127.0.1.1  serverubuntu  serverubuntu.hvc.rr.com
127.0.1.1  serverubuntu  serverubuntu.hvc.rr.com serverubuntu

沒有一個有效。

我確實為我的伺服器分配了靜態 IP 位址:192.168.1.199

答案1

你的 /etc/hosts 檔案應該讀取

127.0.0.1       localhost
127.0.1.1       serverubuntu//change this to 127.0.0.1
192.168.1.199   serverubuntu//add your static IP


# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

相關內容