Friday, January 21, 2011

/etc/hosts file setting for no dns lookup

Can you explain me what I need to add in my hosts file for no dns look up

  • You probably want to just create an empty /etc/resolv.conf if you want to stop DNS lookups from working.

    From carson
  • Can you explain me what I need to add in my hosts file for no dns look up

    That is the wrong question to ask. The hosts file does not control whether or not DNS lookups are performed; it just provides a way to obtain IP addresses w/o DNS.

    To control lookup behaviour, you need to modify /etc/nsswitch.conf (at least on Linux).

    From sleske
  • The file you need is host.conf, this configures the DNS resolver for the system. To disable external DNS lookups and to use only the hosts file use:

    order hosts

    In addition, depending on the distribution, you may need to edit nsswitch.conf as well.

0 comments:

Post a Comment