** server can't find hostname.com nxdomain
Asked Answered
B

1

8

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.

Bo answered 26/7, 2013 at 13:6 Comment(0)
H
6

You should use a DNS server that is able to resolve the name; the one you are using now, at xxx.xxx.32.1, isn't.

Adding the hostname to /etc/hosts doesn't fix it.

This is because nslookup does a DNS lookup always, it does not read the hosts file. Try using getent instead, for example I get:

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

(By the way, you should use example.com as an example almost always, so you don't inadvertently link to adult-only websites)

Header answered 26/7, 2013 at 13:16 Comment(7)
Are you the sysadmin for the DNS server? getent hosts looks up names from the different services available to the system in the order specified in /etc/nsswitch.conf, make sure the line for "hosts" says "files" before "dns"Header
Is there a way to add the name to a dns conf file so where it CAN resolve it? If not what would be an alternate DNS server?Bo
I am the sysadmin yesBo
getent now returns the host name of the vm. Still not able to test an html file from the browserBo
If getent is able to resolve the name so is Firefox. It's possible that Apache is not well configured. What error do you get? dnsmasq reads the ip-to-host assignments from /etc/hosts and from other files you specify, depending on settings in the config file or on the command line.Header
I created a simple html file that I use for reference. When I type in hostname/index.html I get a time out error in the browser as well as the error listed in the initial questionBo
Since I am only testing, dnsmasq is what were staying with. Any idea on how to fix it without changing the DNS server?Bo

© 2022 - 2024 — McMap. All rights reserved.