SUMMARY: DNS nslookup under SunOS 4.1.3

From: Brian Decker (
Date: Sun Nov 21 1993 - 21:04:31 CST

Sorry about the long delay before the summary, but I wanted to be sure
that my DNS/NIS setup worked before spouting off. OK...key facts were
that I'm running 4.1.3 with NIS, and decided to install DNS in prep for
connecting to "the Net". Rebuilt NIS hosts map with the B=-b flag, set up
my DNS configuration files, and started in.named.

1. I can run nslookup and look up IP addresses by hostname...but I am not
    receiving the hostname as I think I should when lookup IP addresses.

    The fix for this was rather simple. Use nslookup properly, or use an
    alternate tool such as dig.

( (Birger A. Wathne)) writes:
|> Look up instead.
|> nslookup
|> >set q=any
|> >
|> (lists a pointer to the host name)

( "Stephen J. Roznowski") writes:
|> You should really get the following DNS tools:
|> dig - replacement for nslookup. much better. For example,
|> to do the above lookup you'd type "dig -x"
|> doc - analyzes your domain for problems.
|> dnswalk - walks the domain space looking for problems. There
|> is also a TIP file that should answer most of your
|> questions above.
|> ddt - yet another dns debugging tool
|> These should all be available on

So I ftp'ed dig, doc, and dnswalk. They were a great help in getting
things sorted out. I recommend them to anyone just starting out with DNS.

2. What are the rules for using canonical names versus CNAMES in various
    config files, esp /etc/netgroup.

According to Timothy G. Smith - Special Projects <tgsmith@Sun.COM>:

|> Ughh. You have run into some ugliness in SunOS. In general to avoid
|> trouble you should use the cannonical hostname in any configuration
|> file that is going to convert an IP address into a hostname and
|> compare that hostname with the value in the config file.

Good answer. :) Now I use the canonical hostname in all my config files;
/etc/netgroup, /usr/local/etc/hosts.[deny|allow] (for tcp_wrapper), /etc/
hosts.equiv, and any .rhosts files that I happen to have lying about.

Actually, I have another minor inconvenience. We use a locally-developed
IPC package built on sockets that requires short hostnames, like "sun123".
So for each host that uses this pkg, I have an entry in the NIS hosts map
along with a CNAME record:

lancelot IN A
            IN HINFO "Sun IPX" SunOS-4.1.3
sws062 IN CNAME lancelot

and in /var/yp/hosts: sws062

It seems like a kludge, but it has worked out OK. I can address this
particular host as "lancelot" or "sws062" from inside my local domain;
or as "" or ""
from .outside the local domain.

3. Is there something about the gethostbyname() call that breaks when
    using DNS? I wrote a short hack to execute gethostbyname for an
    input hostname, and I receive the DNS canonical name along with the
    IP address, but no aliases, unless the aliases are set up in the
    NIS hosts map.

Again from Timothy G. Smith - Special Projects <tgsmith@Sun.COM>:

|> I am pretty sure that gethostbyname when using /etc/hosts or a NIS map
|> returns all of the aliases for a host simply because it happens to
|> have all of the information available (it all came from one line in
|> the file).
|> gethostbyname when using DNS is looking specifically for an A record
|> to match the host you asked for. If it finds an A record it gives you
|> your answer. It if cannot find an A record it checks for a CNAME
|> record and then gives you the for the record that the CNAME points to.

I also have a document from Craig Richmond ( "Setting
up a basic DNS server for a domain" that describes in detail the settings
in various DNS files. I also recommend the O'Reilly "DNS and BIND" book.
Using those two docs, along with "dig", "doc", and "dnswalk", I am now
running happily along without having to rebuild my shared libs.

Thanks to all who answered! Special "DNS guru Oreo cookie awards" go out to:
 Stephen J. Roznowski - <>
 Timothy G. Smith - Special Projects <tgsmith@Sun.COM>
 Craig Richmond - division <>
 Doug Grote - <>

Brian D. Decker E-Systems, Ashburn,VA,USA 001.703.729.6000 x3658
"Young enough to remember the future - the way things ought to be" - NP

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:08:29 CDT