4

I am trying to set up an apache web server on my vm and im running into some issues. When I do an 'nslookup' on the hostname of the machine this is what I get:

nslookup rhel64.xxxxx.xxxxx.com
Server:         xxx.xxx.32.1
Address:        xxx.xxx.32.1#53

** server can't find rhel64.xxxxx.xxxxx.com: NXDOMAIN

I'm sure this is a common problem but I'm not sure how to fix it. It seems that dnsmasq can't resolve the hostname. Adding the hostname to /etc/hosts doesn't fix it. Running on an RHEL6.4 machine. Thanks in advance.

4

1 回答 1

5

您应该使用能够解析名称的 DNS 服务器;您现在在 xxx.xxx.32.1 使用的不是。

将主机名添加到 /etc/hosts 并不能修复它。

这是因为nslookup总是进行 DNS 查找,它不读取hosts文件。尝试getent改用,例如我得到:

$ getent hosts rhel64.xxxxx.xxxxx.com
176.74.176.178  rhel64.xxxxx.xxxxx.com

(顺便说一句,您应该几乎总是使用 example.com 作为示例,因此您不会无意中链接到仅限成人的网站)

于 2013-07-26T13:16:18.673 回答