home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / unix / programm / 5754 < prev    next >
Encoding:
Internet Message Format  |  1992-12-21  |  1.8 KB

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