Force ssl/ssh to use the hosts file

does anyone know how to force ssh/ssl to use the hosts file instead of DNS? I have disabled the DNS servers but ssh still will not resolve a host in the hosts file.

thanks in advance for the help!

DS

Not sure what OS you're using, but if available, you could set the nsswitch.conf file to default to files (meaning /etc/hosts) and then dns:

Comment out these lines if they exists:
hosts:          dns files
hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4

And replace with this line:
hosts:          files dns

RHEL 6.5

nsswitch is set to files dns

it will eventually resolve to the hosts file, but it takes about a minute to do so.

thanks!
DS

Inside

```text
 and 
```

tags, an you paste the contents of /etc/nsswitch.conf and /etc/resolv.conf so we can look at all the settings. It sounds to me like you are still going DNS first and there is a problem on the DNS servers. I assume that the name you are using is not in DNS, but the DNS should recognise it and return a "not found" sort of response much faster.

Do you have multiple DNS servers and is one broken? Can you do the following to each configured DNS server IP:-

nslookup known.good.name dns.server.ip.address

Do you get a response in a suitable time? It is possible that you need to adjust your time-out values for your DNS query. There are different ways of implementing the TIMEOUT and RETRY values so you get a sensible response.

Regards,
Robin