home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.unix.programmer:5754 comp.sources.wanted:5457
- Newsgroups: comp.unix.programmer,comp.sources.wanted
- Path: sparky!uunet!spool.mu.edu!agate!dog.ee.lbl.gov!news!avalon.nwc.navy.mil!archimedes!dejesus
- From: dejesus@archimedes.nwc.navy.mil (Francisco X DeJesus)
- Subject: SUMMARY: Get hostname from IP address
- Message-ID: <BzMGMs.1CM@avalon.nwc.navy.mil>
- Sender: usenet@avalon.nwc.navy.mil (NWC News Admin)
- Organization: Science Applications International Corp.
- Date: Mon, 21 Dec 1992 18:28:04 GMT
- Lines: 30
-
- A little over a week ago I posted to ask about some way (from the command
- line) to get a hostname from an IP address. Here's the results:
-
- A lot of people suggested using nslookup for this. The way to find out
- the hostname associated with IP address A.B.C.D with this method is:
-
- nslookup
- > set type=ptr
- > D.C.B.A.in-addr.arpa
-
- ...this works, though it can be a bit tedious. Someone suggested the following
- alias to make it simpler:
-
- alias ptr '( echo set q=PTR ; echo \!$:e.\!$:r:e.\!$:r:r:e.\!$:r:r:r.in-addr.arpa ) | nslookup'
-
- ...then, typing "ptr A.B.C.D" from your prompt gives you back the answer
- (assuming you had nslookup running to begin with).
-
- I also got a few pointers to a couple of programs out there that may be
- handy to have installed: "dig", "host", and "hname" (consult your nearest
- archie server). Finally, I received source code in C and Perl for programs
- that do the same thing (drop me a line if you want 'em).
-
- Thanks to everyone who replied...
-
- --
- Francisco X DeJesus ----- S A I C ----- dejesus@chinalake.navy.mil
- ------------------------------------------------------------------------------
- * disclaimer: Opinions expressed here are mine. Typos and errors are yours *
- "Duck Season!" "Rabbit Season!" "...rabbit season." "It's Duck Season! SHOOT!"
-