Question: I added an entry to my hosts file for the development of a website.

I put a new line in `/etc/hosts`

```
xx.xx.xx.xx www.mysite.com

```

But even after a reboot when I use chrome or firefox the host name is not resolved to the IP I put in the file.

I'm running Fedora 14 x86\_64.

Answer: 
Hum, don't you have /etc/resolv.conf?

There should be a line:

> 
> lookup file bind
> 
> 
> 

Meaning the system's resolver will look in /etc/hosts (file) first and if it can't found will ask the configured name server(s) in the same file (bind is a DNS server). The order is important.

No need to reboot it will look in the /etc/resolv.conf each time to know how to resolve names.

Usually the dhcp client will override the content of /etc/resolv.conf, one some systems (most? all?) you can create /etc/resolv.conf.tail, its content will be appended to /etc/resolv.conf after the override.

So unless I'm all wrong or your system is different, you know how to fix it now :)

EDIT: on some systems now they seem to use /etc/nsswitch.conf for the resolution order, so not everything is in /etc/resolv.conf.

EDIT2: "The introduction of the GNU C Library 2.0 was accompanied by the introduction of the “Name Service Switch” (NSS). Refer to man 5 nsswitch.conf and The GNU C Library Reference Manual for more details." Seems like another GNU weirdness, argh. There used to be one way to do stuff, which made learning and administration easier. Sounds like windows practices (don't care about others, everyone uses our stuff).
ALL common versions of \*NIX use a file /etc/nsswitch.conf to determine the order that files are queried in.

The line:

```
    hosts:          files dns myhostname mdns4_minimal [NOTFOUND=return] 

```

is where this is done. In many instatllions "dns" is listed ahead of "files" like this:

```
    hosts:          dns files myhostname mdns4_minimal [NOTFOUND=return] 

```

Try changing it to have "files" first like in the first example.

The change affects the system instantly. If you are running bind or some form of DNS locally, stop/restart it so that it will flush its own cache. 

We process billions of transactions daily and found that bind (as much as I love it) and no dns caching server or number of them has been able to keep up with our lookups, so we had to go to using our /etc/hosts file for some of what we do.