Only use /etc/hosts for resolving hostnames on Linux

dnshosts

I want to disable DNS lookups via DNS server and only resolve host names that are listed in /etc/hosts. I am on Raspbian 9. How would I set this up?

Best Answer

Remove dns from hosts field in /etc/nsswitch.conf:

hosts:          files

You might also want to remove the DNS servers from /etc/resolv.conf.

Related Question