Using both /etc/hosts and domain name server to get host addrs

Using both /etc/hosts and domain name server to get host addrs

Post by Mark All » Tue, 13 Aug 1991 02:40:47

I have a situation here where I need to have some machines access
both the /etc/hosts file and the domain name server for host  name
and address resolution.

Our site has Suns running sunos 4.1.1. We use network file system and
NIS extensively throughout the site therefore the machines need to
access the /etc/hosts (which is NIS mapped) so they can know where
to access NFS files at boot time.

Currently, we are not using the name server that is being established
for the company but we are thinking about connecting to it.

I am concerned because once we connect to it (by establishing a
resolv.conf file) we may no longer have access to the /etc/hosts file
locally. We have requirement where we have to set up temporary machines
in our network which we dont want to have listed in the domain name
server but we want to put in the local NIS host map or the machine's
local /etc/hosts file.

I have tried the manuals and some experimenting and found:

1. The manuals were not clear on how to have the gethost functions access
   both the domain name server and the local host files.

2. A local site that I have an account on using a Vax running ULTRIX seems
   to have done the trick, but I poked around and could not see anything
   special with their resolv.conf file and they are running as a domain
   server (no named.boot files and nothing in rc files to start the named

3. Another site that I have access to which is running resolv but not a
   name server (a Sun running sunos 4.0.3) will not access both the
   name server and the /etc/hosts file at the same time. ( I tried
   to rlogin into itself using the name of the machine without the
   domain name and it could not find it)

I would greatly appreciate any help you folks may have. Thanks!

Mark Allyn


Using both /etc/hosts and domain name server to get host addrs

Post by Jeff Beadl » Tue, 13 Aug 1991 13:56:48

>I have a situation here where I need to have some machines access
>both the /etc/hosts file and the domain name server for host  name
>and address resolution.

Well, I had the same problem when we connected to the Internet.  I didn't see
an apparent solution, so I ended up modifying gethostbyxxx, in libc/libresolv.

If you would like a copy of this, please let me know.  Basically it understands
DNS/bind, and /etc/hosts.  I have no use for YP/NIC, so I didn't bother.  The
order of resolution is configurable.

Drop me a note if you would like a copy.  It's no harder to install than adding
the resolver stuff to libc.



1. /etc/hosts (or NIS host map): official-host-name vs nicknames

I am setting up a couple of NIS domains on the same physical LAN.  Will not
be using DNS or
connecting to the internet.  Can someone explain to me:

1) What the official-host-name is? Is it hostname or hostname | domainname?
What are the pros
and cons of using just the hostname for the official-host-name?  What are
the pros and cons
of using hostname | domainname as the official-host-name?

2)  How is the official-host-name entry treated differently then the aliases
Do certain applications or os components use the official-host-name entry
while others
use the aliases entries?


2. Athlon oops traced to CONFIG_MK7 code in arch/i386/lib/mmx.c

3. Server Domain name & Host name

4. pty-based scripting program?

5. Is there any point to full host names in /etc/hosts ?

6. Linux Bootup Sequence and required files

7. Can't ping the host name or host IP address from host.

8. TIN for term ???

9. Sendmail 8.6.12: using /etc/hosts to send to domainless hosts

10. Host name, primary name, domain name...?

11. 'host' command not using /etc/hosts?

12. free access_log analysis program: page-by-page, host-by-host, domain-by-domain

13. Host names unmatched when using telnet or rlogin to local hosts