host.conf(5)

๐Ÿ’– host.conf(5) โ€” bestie's guide to the resolver config file ๐Ÿ’–

okay so before we even start: this is host.conf(5), and it lives in the File Formats Manual section of the man pages (section 5, the file-formats girlies ๐ŸŽ€). grab a snack, we're doing the resolver's lil config file.


โœจ NAME โœจ

host.conf โ€” the resolver configuration file, no cap ๐Ÿฆ‹


๐ŸŒธ SYNOPSIS ๐ŸŒธ

/etc/host.conf

๐Ÿ’œ DESCRIPTION ๐Ÿ’œ

So the file /etc/host.conf holds all the configuration info that's specific to the resolver library. That's it, that's the whole vibe.

The rules of the house: it should have one configuration keyword per line, and then the appropriate configuration info follows after it. Like, keyword first, details second, every single line. ๐Ÿ’…

These are the keywords it recognizes, and yes we're going through all of them, bestie:

  • trim โ€” this one is the main character and it's allowed to show up more than once โœจ Every time it appears it should be followed by a list of domains, separated by colons (':'), semicolons (';') or commas (','), with the leading dot. When it's set, the resolver library will automatically trim that given domain name off the end of any hostname that got resolved via DNS. It's meant for local hosts and domains. (Related note, and this is important: trim will not affect hostnames gathered via NIS or via the hosts(5) file. So be careful โ€” you need to make sure the first hostname for each entry in the hosts file is fully qualified or unqualified, whichever is appropriate for your local installation. no notes, just facts ๐Ÿ™ˆ)
  • multi โ€” valid values are on and off. If you set it to on, the resolver library will return all valid addresses for a host that shows up in the /etc/hosts file, instead of just the first one. It's off by default though, and honestly? iconic of it, because turning it on may cause a substantial performance loss at sites with big hosts files. ๐Ÿ˜ญ
  • reorder โ€” valid values are on and off. Set it to on and the resolver library will attempt to reorder host addresses so that local addresses (like, ones on the same subnet) get listed first when a gethostbyname(3) is performed. The reordering happens for all lookup methods. Default value is off. periodt.

๐Ÿฆ‹ ENVIRONMENT ๐Ÿฆ‹

These environment variables let users override the behavior that's configured in /etc/host.conf. yes, override. the users have that power ๐Ÿซถ

  • RESOLV_HOST_CONF โ€” if it's set, this variable points to a file that should be read instead of /etc/host.conf.
  • RESOLV_MULTI โ€” overrides the multi command.
  • RESOLV_REORDER โ€” overrides the reorder command.
  • RESOLV_ADD_TRIM_DOMAINS โ€” a list of domains, separated by colons (':'), semicolons (';'), or commas (','), with the leading dot, which will be added to the list of domains that should be trimmed.
  • RESOLV_OVERRIDE_TRIM_DOMAINS โ€” same deal: a list of domains, separated by colons (':'), semicolons (';'), or commas (','), with the leading dot, but this one will replace the list of domains that should be trimmed. It overrides the trim command. ๐Ÿ’…

๐ŸŽ€ FILES ๐ŸŽ€

  • /etc/host.conf โ€” resolver configuration file
  • /etc/resolv.conf โ€” resolver configuration file
  • /etc/hosts โ€” local hosts database

โญ NOTES โญ

here's the tea โ˜• โ€” the following differences exist compared to the original implementation:

A new command spoof and a new environment variable RESOLV_SPOOF_CHECK can take arguments like off, nowarn, and warn.

Also, line comments can appear anywhere, not only at the beginning of a line. glow up โœจ


๐ŸŒˆ Historical ๐ŸŒˆ

The nsswitch.conf(5) file is the modern way of controlling the order of host lookups. (iykyk โ€” if you know you know, and if you don't, go read that one next ๐Ÿงš)

In glibc 2.4 and earlier, this keyword was recognized:

  • order โ€” this keyword specifies how host lookups are to be performed. It should be followed by one or more lookup methods, separated by commas. Valid methods are bind, hosts, and nis.
  • RESOLV_SERV_ORDER โ€” overrides the order command.

Since glibc 2.0.7, and up through glibc 2.24, the following keywords and environment variable were recognized but never implemented โ€” so like, they were there, but they were not there there ๐Ÿ’€:

  • nospoof โ€” valid values are on and off. If set to on, the resolver library will attempt to prevent hostname spoofing to enhance the security of rlogin and rsh. How it works: after performing a host address lookup, the resolver library will perform a hostname lookup for that address. If the two hostnames do not match, the query fails. The default value is off.
  • spoofalert โ€” valid values are on and off. If this option is set to on and the nospoof option is also set, the resolver library will log a warning of the error via the syslog facility. The default value is off.
  • spoof โ€” valid values are off, nowarn, and warn. If this option is set to off, spoofed addresses are permitted and no warnings will be emitted via the syslog facility. If it's set to warn, the resolver library will attempt to prevent hostname spoofing to enhance the security and log a warning of the error via the syslog facility. If it's set to nowarn, the resolver library will attempt to prevent hostname spoofing to enhance the security but not emit warnings via the syslog facility. Setting this option to anything else is equal to setting it to nowarn.
  • RESOLV_SPOOF_CHECK โ€” overrides the nospoof, spoofalert, and spoof commands in the same way as the spoof command is parsed. Valid values are off, nowarn, and warn.

๐Ÿ’– SEE ALSO ๐Ÿ’–

gethostbyname(3), hosts(5), nsswitch.conf(5), resolv.conf(5), hostname(7), named(8)


and that's the whole page bestie, slay ๐Ÿ’…โœจ

this gorgeous little number is from Linux man-pages 6.20, dated 2026-02-08, and it covers host.conf(5) ๐Ÿฆ‹ mwah, go touch some config files ๐Ÿ’œ

๐Ÿ“ฆ where this page comes from
  • arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
  • nixpkgs unstable: man-pages 6.20
  • ๐Ÿ“œ the page's license: GPL-2.0-or-later
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms