Score:0

intranet dns lookup fetching incorrect ip

ng flag

We have a host entry on our server in /etc/hosts file. So there is an entry as follows:

10.74.74.76 foo

But on the same machine, via SSH I do the following:

$ host -t a foo
foo.internal.domain.com has address 10.43.55.23

Why is this not referencing the ip in /etc/hosts?

A.B avatar
cl flag
A.B
Does this answer your question? [Linux command line utility to resolve host names using /etc/hosts first](https://serverfault.com/questions/303716/linux-command-line-utility-to-resolve-host-names-using-etc-hosts-first)
Score:0
jp flag

The host command is a DNS lookup utility that always uses DNS as a resolver; never /etc/hosts file.

From host(1) man page:

host is a simple utility for performing DNS lookups.

server is an optional argument which is either the name or IP address of the name server that host should query instead of the server or servers listed in /etc/resolv.conf.

Score:0
la flag

host is a (simple) DNS lookup utility.

Any data in your /etc/hosts file is NOT DNS.

That means that the host command will always query the DNS servers you have configured and it does not honor the typical precedence your system resolver uses in first querying the local hosts database before attempting to resolve the host/FQDN.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.