0

I'm attempting to set up FreeIPA on a Centos KVM guest and one of the prerequisites is to make sure static hostname is set and that the hostname resolves to guest's IP address. My /etc/hosts file is as follows:


27.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.122.134 ipaserver.example.com   ipaserver

After issuing dig +short ipaserver.example.com nothing is returned. ping is able to resolve the hostname and I checked /etc/nsswitch.conf as well as /etc/resolv.conf and they look appropriate. Any help or guidance would be greatly appreciated.

kenlukas
  • 2,886
  • 2
  • 14
  • 25

1 Answers1

1

Ping works because you are using a host file to resolve the name. Dig fails because your server is not registered to dns. Depending on how security is setup on your dns server you will need to manually add it or if the dns server allows updates use nsupdate.

  • thanks for the quick response. so am i correct in saying dig doesn't check /etc/hosts first but instead resorts to querying a name server? i thought they would both follow the order of services listed in the nsswitch.conf file which is currently listed as 'files dns myhostname'. – Randy Tang Feb 16 '20 at 03:46
  • Dig only queries dns. – superbovine Feb 16 '20 at 03:52