Score:3

How to Use /etc/hosts on FreeBSD 13.1

mx flag

This is a plain vanilla fresh install of FreeBSD 13.1. The resolv.conf file is as follows and Unbound is not enabled.

nameserver 192.0.2.1

DNS resolution on the local machine is ignoring /etc/hosts. What is missing from the configuration?

Score:6
la flag

Possibly your assumption that DNS includes entries from /etc/hosts.

All commands/tools designed to test DNS such as dig , nslookup , host and such only query DNS servers and by default use the DNS server that is configured in /etc/resolv.conf.

To test how the C library resolver works, and all programs that use the system resolver routines who do honour /etc/nsswitch.conf precedence and which normally prefer the hosts file over DNS, requires testing with something like getent :

getent hosts some.hostname.in.etc.hosts
getent hosts IP.in.etc.hosts 
mx flag
Thanks, this is exactly what I needed.
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.