Re: /etc/hosts file

Cameron Simpson <[email protected]>
Newsgroups gmane.linux.redhat.release.enigma
Message-ID <[email protected]>
On 13:51 21 May 2003, Bill Gradwohl <[email protected]> wrote:
| For arcane security reasons, I'm not permitted to start a name server on a particular box. Therefore I'm trying to use /etc/hosts.

You don't need a name server for what you seem to want.
Just use your company's name server.

| Given that /etc/nsswitch.conf contains a line as follows:
| hosts: files dns
| 
| Adding the following to the /etc/hosts file:
| 192.168.1.123          box1.private.xyz              box1
| allows 
| ping box1 
| or 
| ping box1.private.xyz
| to function as expected resolving to the 192.168.1.123 address.

Yep.

| Keying in:
| host box1
| or
| host box1.private.xyz
| fails on nxdomain. Why? Anyone know how to get 'host' to use /etc/hosts? I thought all utilities using library functions follow the nsswitch.conf specification for resolution.

But the "host" command is specificly for testing DNS.
There wouldn't be any point to it if it consulted /etc/hosts.

| Also, I'm unable to put any kind of reverse address resolution into the /etc/hosts file that works.
| Anyone know of a way to modify /etc/hosts to allow something like ping to reverse resolve as in:
| ping 192.168.1.123 
| and have it display the hostname next to the ip address?

Ping doesn't do reverse lookups!
You will find reverse lookup works just fine, if you use something that
actually tries reverse lookup. Ping does not try.

Cheers,
-- 
Cameron Simpson, DoD#743        [email protected]    http://www.zip.com.au/~cs/

When you say `I wrote a program that crashed Windows', people just stare at
you blankly and say `Hey, I got those with the system, *for free*'.
        - Linus Torvalds
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.