Showing posts with label Hostname. Show all posts
Showing posts with label Hostname. Show all posts

Friday, 29 June 2012

Hostname not resolving to IP


Hello,

We have received error while /scripts/ipcheck

The hostname (server.domain.com) resolves to x1.x1.x1.x1. It
should resolve to x2.x2.x2.x2. Please be sure that the contents
of /etc/hosts are configured correctly, and also that there is a
correct 'A' entry for the domain in the zone file.


But we have modified the domain zone entries and /etc/hosts.

-------
root@ server  [~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
#::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
x2.x2.x2.x2  server.domain.com server
root@ server  [~]#

------

root@servidor [~]# hostname
server.domain.com 
root@servidor [~]# hostname -i
X2.X2.X2.X2
------

But while dig the hostname still the hostname has resolved to IP : X1.X1.X1.X1

root@servidor [~]# dig  server.domain.com  +short
X1.X1.X1.X1
root@servidor [~]#

Resolution :

This is because the resolver in /etc/resolve.conf was caching the old IP. I've changed the first resolver to 4.2.2.5 and now I get this while on the server
root@servidor [~]# dig  server.domain.com  +short
X2.X2.X2.X2
root@servidor [~]#