performance impact of large /etc/hosts files

Nikos Vassiliadis nvass at
Tue Dec 11 07:15:31 PST 2007

On Tuesday 11 December 2007 05:18:40 Erich Dollansky wrote:
> Hi,
> I wonder what the performance impact of the entries in /etc/hosts really
> is.
> What is your experience?
> Google tells me a lot of hosts running FreeBSD but I could not find
> anything regarding the hosts file itself.
> I use hosts for filtering all unwanted content on my personal machine.

That's not apparent. What are your filtering?
and how do your filter using /etc/hosts?

From "man hosts":
     The hosts file contains information regarding the known hosts on the net-
     work.  It can be used in conjunction with DNS, and the NIS maps
     `hosts.byaddr' and `hosts.byname', as controlled by nsswitch.conf(5).

For example, my computer's name is This
is not a fully qualified hostname. It's not in the Domain
Name System. So, I have to enter this information manually
to my /etc/hosts, so my OS will know that
is the local host. Example /etc/hosts: iris

I recall that before DNS(that's a long time ago) the mapping
between IP addresses and hostnames was achieved using /etc/hosts.
And one could get a hosts file from a well known place(IANA?)

The only "filtering" I can imagine of, is using something like
But all you get is misinforming *your* resolver that is on, that is, *you* cannot
connect to can connect to your machine just fine.
And I doubt that's what you want.

Please, clarify a bit.


More information about the freebsd-questions mailing list