From owner-freebsd-questions Sat Nov 24 4:28: 3 2001 Delivered-To: freebsd-questions@freebsd.org Received: from post.mail.nl.demon.net (post-11.mail.nl.demon.net [194.159.73.21]) by hub.freebsd.org (Postfix) with ESMTP id E615737B405 for ; Sat, 24 Nov 2001 04:27:59 -0800 (PST) Received: from [212.238.77.116] (helo=buffy.raggedclown.net) by post.mail.nl.demon.net with esmtp (Exim 3.33 #1) id 167buX-0004SD-00 for freebsd-questions@FreeBSD.ORG; Sat, 24 Nov 2001 12:27:58 +0000 Received: by tanya.raggedclown.net (Postfix on SuSE Linux 7.3 (i386), from userid 500) id 2CCF11104; Sat, 24 Nov 2001 13:27:05 +0100 (CET) Date: Sat, 24 Nov 2001 13:27:04 +0100 From: Cliff Sarginson To: FreeBSD Questions Subject: Re: can't do reverse dns with /etc/hosts Message-ID: <20011124132704.A1048@raggedclown.net> References: <5.1.0.14.0.20011123164749.0245ec60@mail.enterit.com> <20011114173647.D66694@blossom.cjclark.org> <20011115012039.GA61093@shall.anarcat.dyndns.org> <20011114173647.D66694@blossom.cjclark.org> <5.1.0.14.0.20011123164749.0245ec60@mail.enterit.com> <5.1.0.14.0.20011123172728.02c61518@mail.enterit.com> <20011124103734.GB386@irrelevant.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20011124103734.GB386@irrelevant.org> User-Agent: Mutt/1.3.22.1i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sat, Nov 24, 2001 at 10:37:34AM +0000, Simon Dick wrote: > On Fri, Nov 23, 2001 at 05:30:43PM -0500, Jim Conner wrote: > > At 16:30 11.23.2001 -0500, The Anarcat wrote: > > >On Fri Nov 23, 2001 at 04:48:54PM -0500, Jim Conner wrote: > > >> At 16:14 11.23.2001 -0500, The Anarcat wrote: > > >> >On Wed Nov 14, 2001 at 05:36:47PM -0800, Crist J. Clark wrote: > > >> >> > > >> >> host(1) _always_ uses DNS. > > >> >> > > >> > > > >> >Doh! I should have RTFM... sorry. > > >> > > > >> >Is there a tool that doesn't use just DNS? > > >> > > >> grep hostname /etc/hosts > > >> grep password /etc/hosts > > >> > > >> Those ought to work. > > > > > >The thing is that I want to test the functionality of the resolver. > > > > > >I need a simple userland gethostby* interface. :) nslookup and host and > > >friends are all DNS oriented, IIUC. > > > > > >Anyways, I'll probably end up writing my own one-liner. ;) > > > > Unfortunately, I am not familiar with such a thing. I have been in need of > > the same kind of tool. I will be interested to see what others say. It > > seems obvious to me that this is not a name lookup mechanism but a type of > > Unix lookup since the /etc/hosts file was used way before DNS was ever > > thought up. There must be a built-in tool/library somewhere that can do > > what you are trying to accomplish. > > I guess my method of just using ping and seeing what IP it tries > to ping won't be suitable for this? :) > It is a little difficult to understand exactly what you are trying to achieve. If you want to get a hostname from an ip-address or vice-versa from your /etc/hosts file then a simple grep will do the job. However that really doesn't mean very much since you can put what you like in /etc/hosts. What would normally be in their is your local network hosts and possibly some common hosts that you access. A meaningful reverse DNS lookup can only be achieved through a DNS. The usual way to achieve this for a small network would be to have a caching only local DNS server with some external DNS server(s), probably your ISP's, defined as "forwarders". This is extremely easy to setup There are several players in the game here, there is the resolver, the name service switch, and possibly even a name service cache daemon (nscd). It is also complicated by the fact that some software may not even use the resolver library at all. Then there is NIS, of course. If you define a bit more precisely what you are trying to achieve it may help. The man is right btw, the days of HOSTS.TXT are long, long gone .. :). -- Regards Cliff To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message