performance impact of large /etc/hosts files

Nikos Vassiliadis nvass at teledomenet.gr
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":
DESCRIPTION
     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 iris.teledomenet.gr. 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 iris.teledomenet.gr
is the local host. Example /etc/hosts:

192.168.1.71 iris iris.teledomenet.gr

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
127.0.0.1 badhosts.com
But all you get is misinforming *your* resolver that
badhosts.com is on 127.0.0.1, that is, *you* cannot
connect to badhosts.com.
badhosts.com can connect to your machine just fine.
And I doubt that's what you want.

Please, clarify a bit.

Nikos


More information about the freebsd-questions mailing list