我有一个名为 crow 的 Ubuntu 服务器:
$ hostname
crow
Run Code Online (Sandbox Code Playgroud)
但是当我尝试 ping 它(从它本身)时,我得到了未知主机:
$ ping crow
ping: unknown host crow
Run Code Online (Sandbox Code Playgroud)
尽管在 /etc/hosts 中明确添加了乌鸦:
$ sudo cat /etc/hosts
127.0.0.1 localhost crow
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
回复评论的附加信息:
/etc/nsswitch.conf 的 hosts 行如下所示:
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
Run Code Online (Sandbox Code Playgroud)