From: rogers@fangorn.wr.tek.com (Roger Southwick)
Newsgroups: comp.unix.admin,comp.sys.sun.admin
Subject: Re: NIS vs DNS
Date: 14 Sep 92 18:42:36 GMT
Followup-To: comp.unix.admin
Organization: Tektronix, Inc.
X-Newsreader: Tin 1.1 PL5

[ WARNING - A RATHER LONG WINDED ARTICLE FOLLOWS ]

> casper@fwi.uva.nl (Casper Dik) writes:
>
>> rsnyder@atl.ge.com (Bob Snyder) writes:
>>
>>> jonathan@gabriel.keele.ac.uk (Jonathan Knight) writes:
>>>
>>> We run NIS and DNS using the Sun approved method.  Each NIS master has
>>> a resolv.conf which it uses when a host lookup isn't in the NIS maps.
>>>
>>> Here's why:
>>
>> [Good reasons while deleted]
>>
>> Here's why not:
>>
>> The support for multi-homed hosts is abysmal.  You can't give multiple
>> IP addresses to an /etc/hosts file (from what I have been able to see),
>> and if you are willing to use only DNS for that, the NIS master will do
>> a DNS query, returning the addresses, with the best address first,
>> *from the server's point of view*.  Let's say I have a NIS server
>> (Machine A) on subnets 1 and 2.  I also have another multi-homed host
>> (Machine B) that sitts on subnets 1 and 2.  If a machine on subnet 2
>> looks up Machine B's address via NIS, it will get the address on subnet
>> 1, and will route to that host, even though it could reach the machine
>> directly, without routing.
>>
>> If something I showed here is wrong, please tell me, but this is what I
>> am seeing on my networks.
>
> If you put all the NIS servers on non-gateway machine, you won't have a
> problem like that. But I agree, the NIS server can take the address of
> the client and rearrange the returned addresses accordingly.

(Just as a preliminary, I don't pretend to be an DNS/NIS expert, although
I've been heavily using both for some years).

I think the situation with NIS/DNS depends on which machine is your NIS
master. Here is our situation, which {may,may not} be similar to Bob's:


				  [WS1 (NIS Master)]   [WS 2 (NIS client)]
		+--------+             |                    |
		|	 |-- net 1 ----+-----+--------------+-
		| Router |                   |
		|	 |-- net 2 -------+-------+-----[WS 3 (NIS slave)]
		|        |                |  |    |
		|        |-- net 3 ----+  |  |	  +-----[WS 4 (NIS client)]
		|        |             |  |  |
		|        |-- net 4 -+  |  |  |
		+--------+          |  |  |  |
		    |               |  |  |  |
	            | net 5         |  |  |  |
    [DNS Master]----+               |  |  |  |
		    |               |  |  |  |
		    +---------[BIG Sun FILESERVER ]
		    |         [with 4 NC 400 cards]
		  	      [and one ie port    ]


In the DNS master, we list all five addresses of the fileserver.

Because ALL of the workstations (I only showed 4 out of 100), are
all related, I must run the same NIS domain (shared password file).

The NIS master (WS1), which would runs DNS for the all the
workstations, has a /etc/resolv.conf file listing the DNS Master.  This
NIS master (WS1) should correctly answer to get the right address of
the FILESERVER when WS2 asks (the net 1 address), right?

For WS3 or WS4, what answer will we get?  The answer you want is
the net 2 address and NOT the net 1 address.  I *think* you will
get the net 1 address (I need to do the experiment).

What I did for our domain is to rip the NIS code out for the
gethostbyname()/gethostbyaddr() calls and put in the 4.8.3 resolver
code and rebuild the shared library (which is discussed elsewhere on
this net).

I made the FILESERVER be a DNS secondary for the domain, and then for
each workstation, made a /etc/resolv.conf file to point at the
FILESERVER.  Since DNS will sort the response according to the net it
received the query on, I get the correct address for the FILESERVER.

This is a good solution, BUT gets around the use of NIS.  I have some
utilities which, as a result, don't use DNS at all because there are
statically linked, and therefore only know NIS maps (like rcp, route,
and others).

Of course, having BSD sources, I was able to recompile rcp (which is 
the major objection), BUT I would rather not have to do this for
all applications unless I have to.

Any suggestions, comments or queries are, of course, welcome. 
--
    -Roger      (Roger.S.Southwick@tek.com)
		UUCP:	...!uunet!tektronix!Roger.S.Southwick
Xref: sparky comp.unix.admin:4885 comp.sys.hp:10077