name resolution puzzle
derek at computinginnovations.com
Fri Aug 3 22:19:08 UTC 2018
On 8/3/2018 4:41 PM, Valeri Galtsev wrote:
> Dear Experts,
> I just noticed some behavior of commands "host" and "nslookup" that
> puzzles me. Namely, they do not query /etc/hosts file first, but query
> nameserver instead, even though nsswitch.conf order is "files dns":
> $cat /etc/nsswitch.conf | grep hosts
> hosts: files dns
> $ cat /etc/hosts | grep holometer.uchicago.edu
> 184.108.40.206 holometer holometer.uchicago.edu
> $ host holometer.uchicago.edu
> holometer.uchicago.edu has address 220.127.116.11
> $ nslookup holometer.uchicago.edu
> Server: 18.104.22.168
> Address: 22.214.171.124#53
> Name: holometer.uchicago.edu
> Address: 126.96.36.199
> So, it appears, that the commands "host" and "nslookup" go directly to
> DNS server, and do not look into /etc/hosts first which I have expected.
> I should mention that other compiled programs do obey the
> nsswitch.conf query order.
> Can someone enlighten me on this?
> The reason I have different IP in /etc/hosts is: I'm building the box
> to migrate some host to, and I'd like to test some stuff that should
> work from other machines before I switch DNS records to new IP. So, on
> these external machines I am trying to have hostname resolve into
> future IP just by adding it to /etc/hosts.
man 5 hosts
You have the wrong order in your /etc/hosts file
188.8.131.52 holometer holometer.uchicago.edu
184.108.40.206 holometer.uchicago.edu holometer
Also try dig which is more current that nslookup.
This email has been checked for viruses by Avast antivirus software.
More information about the freebsd-questions