I would expect IP address for your server to be fixed. Your /etc/hosts
should contain
127.0.0.1 localhost
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
xxx.x.x.1 rhel64.example.com rhel64
localhost
should never point to an address other than 127.0.0.1 or ::1. Add additional hosts with fixed addresses to /etc/hosts
as required.
For dynamic addresses, make sure that you have set the correct domain in /etc/dnsmasq.conf
, and ensure that the hostname is sent in the request. Check the dnsmasq.leases
file which should be in the /var/lib
directory try to verify. Domain should be specified like this.
domain=example.com
Alternatively you can provide fixed addresses in the dnsmasq.conf
file or /etc/ethers
. A line like this will map mac address aa.bb.cc.dd.ee.ff
to 192.0.2.1
. DNS name would be specified in /etc/hosts
as noted above.
aa.bb.cc.dd.ee.ff 192.0.2.1
EDIT: Diagnostics I would use include.
Running getent on the host with dnsmasq running.
getent hosts rhel64
This should return the value you entered in the hosts file or returned by DNS. If that works try using the host
command to lookup the address. Use nslookup
if hosts is not available. Try these commands. (It appears your dnsmasq
and apache
servers are on the same host.
hosts rhel64.
hosts rhel64.example.com.
hosts rhel64. localhost
hosts rhel64.example.com. localhost
hosts rhel64. rhel64.
hosts rhel64.example.com. rhel64.
hosts rhel64. rhel64.example.com.
hosts rhel64.example.com. rhel64.example.com.
Which command fails and how it fails should help you determine the problem. You may also want to ensure that dnsmasq is listening on all ip addresses.
When diagnosing the problem: Requests for rhel64.
are for the host name unqualified with a domain, and requests for rhel64.example.com.
are for fully qualified name. The final dot on the names tells the resolver not to try domains from the search list. The second host name if specified overrides the name servers listed in /etc/resolv.conf
. In this case, I have used the servers from /etc/resolv.conf
, the localhost address (127.0.0.1 or ::1), the address of the hostname as looked up from DNS, and address of the fully qualified name as looked up from the name sever. The last two servers won't work if the initial look for the name failed.
netstat -an | grep :53
EDIT: On re-reading your post, I notice you are getting your address from DHCP, the notes on setting a fixed IP address apply to Unix style DHCP servers. They should be applied to the dchp-server which is likely the router at xxx.x.x.1, which would not be your servers address. You should be able to get the curent IP address with either the command ifconfig
or the newer command ip addr
. This is the address which should be matched with your host name in the /etc/hosts file.
If you don't have access to the router, you can try to get DHCP to update the DNS service for you. Add the following entry to our DHCP configuration file:
option fqdn.fqdn rhel64.example.com;
or
option fqdn.fqdn rhel64;
After adding the entry you will need to restart the dhclient
process. Try the commands
sudo dhclient -r
sudo dhclient
Otherwise you will need to restart the interface or the entire networking setup.