# dnslookup order hosts,bind - hosts file is not read

## pointers

Hi,

      My entries in /etc/hosts file are not used by my resolver. Here is my /etc/host.conf and nsswitch.conf files

host.conf

 *Quote:*   

> order hosts, bind
> 
> 

 

nsswitch.conf

 *Quote:*   

> hosts:       files dns
> 
> networks:    files dns
> 
> 

 

#strace host domain.com 

doesnt show any evidence such that resolver looks at /etc/hosts file. Permissions are ok.

What can be the problem ?

Thanks a lot.[/quote]

----------

## fvant

Is an nss cache running, such as nscd?

----------

## pointers

Hi it is not running,

here is the rc-status

 *Quote:*   

> 
> 
> Runlevel: default
> 
>  local                                                                                                                         [ started ]
> ...

 

----------

## Katphish

Hi,

It is working.  Try to ping a name that is in your host file.

The `host` command is a DNS tool according to the man page.

----------

## pointers

ping looks at /etc/hosts file ok. But Before host command was using /etc/hosts file too, my aim is to

to tell some of the entries in /etc/hosts into the postfix but postfix does not look at this file and directly use resolv.conf

According to postfix documents if order in host.conf or nsswitch.conf files are like mine,

then postfix should look at hosts file. Before postfix was using this file now it isnt.

I dont know what the problem is:(

----------

## Katphish

What are you trying to do with postfix?  Route mail locally?

It might be worth setting up a DNS server if you have a few machines.

----------

## pointers

Hi,

     It is just a simple entry and I dont want to use dns for this purpose.  I just would like to fix this problem on the postfix side.

Now I am using a simple routing solution. 

Thanks for your helps friend I will try to find it.

----------

## xglad

I've got this same problem. Same circumstances as the OP. No nscd, same stuff in host.conf and nsswitch.conf.

<edit>

See the smtp_host_lookup in $ man 5 postconf. The possible values seem a little half-baked (there is no native,dns order apparently), but for pure /etc/hosts usage, this fixes my problem.

</edit>

----------

