3

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?

1 Answer 1

6

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 
1
  • Thanks, this is exactly what I needed.
    – Utkonos
    Dec 30, 2022 at 16:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .