Xref: utzoo comp.unix.admin:1181 comp.unix.questions:29381 Path: utzoo!news-server.csri.toronto.edu!rutgers!usc!samsung!uakari.primate.wisc.edu!caen!sol.ctr.columbia.edu!ira.uka.de!fauern!NewsServ!sunmanager!a2824ak From: a2824ak@sunmanager.lrz-muenchen.de (Thomas Kaiser) Newsgroups: comp.unix.admin,comp.unix.questions Subject: Re: Getting SunOS 4.1 to use DNS -and- /etc/hosts (long) Message-ID: Date: 12 Mar 91 18:44:16 GMT References: <1991Mar9.171331.22378@unhd.unh.edu> <1991Mar11.014434.23710@wdl1.wdl.loral.com> Sender: news@Informatik.TU-Muenchen.DE Organization: Technische Universitaet Muenchen, Germany Lines: 31 >I retrieved bindon41.shar, hoping it would eventually produce a smarter >resolver. It includes instructions for FTPing the BIND source from >ucbarpa.berkeley.edu and applying a few (included) patches. When I followed >the instructions, I got a working version of DNS, but it still ignored the >/etc/hosts file! However, I had the source, so all was not lost. >The routine used by the network programs (telnet, ftp, etc.) to translate from >a host name to a host address is gethostbyname(). I found this entry in the >BIND source file gethostnamadr.c. At then end of gethostbyname(), it does >check the /etc/hosts file if connection to the name server was refused. I >broadened this behavior to check /etc/host if the name wasn't resolved for any >reason. Here's the diff output for my modification. I also modified the original bind4.8.2 resolver routines. In mine i use first /etc/hosts and then the resolver. I've done for both gethostbyname and gethostbyaddr. The problem with the other way round, is that the resolver routines have to wait for timeout, if there is no information or nameserver. You can also put shortnames in your /etc/hosts-file Thomas Kaiser Leibniz Computing Centre Munich smtp =kaiser@sunmanager.lrz-muenchen.de X.400=kaiser@lrz.lrz-muenchen.dbp.de -- ------------------------------------------------------------------------- Thomas Kaiser Internet: kaiser@sunmanager.lrz-muenchen.de LRZ-Muenchen X400: C=DE;A=DBP;P=LRZ-MUENCHEN;OU=LRZ;S=Kaiser -------------------------------------------------------------------------