SUMMARY: Get hostname from IP address

SUMMARY: Get hostname from IP address

Post by Francisco X DeJes » Wed, 23 Dec 1992 03:28:04

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:


Quote:> set type=ptr

...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.\!$ ) | 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...


  * disclaimer: Opinions expressed here are mine. Typos and errors are yours *
 "Duck Season!" "Rabbit Season!" "...rabbit season." "It's Duck Season! SHOOT!"


1. Help with getting remote hostname/ip address


Could someone direct me to a good resource for network programming. I

need a simple routine that will return the hostname/IP address of the

connecting computer.  This is before a login/authentication takes place,

so there is no utmp entry, only the network connection.  A good book with

good examples would be very helpful.


Ralph Spangler

/                                                    \
| Ralph L. Spangler, Jr.         HARRIS CORPORATION  |
| UNIX System Administrator      AEROSPACE SYSTEMS   |
| Engineering and Information                        |
|  Systems                       P. O. Box 94000     |

| voice: 407.727.5361            Melbourne, FL       |
| fax: 407.729.1735              32902-9400          |
Ex. 15:11

< 1K Download

2. SCO programs on linux : compiling, linking, running

3. using mac address instead of an IP address of hostname

4. ##### Poster can't accept E-Mail? #####

5. ping works for IP Addresses but fails for hostname

6. Solstice AdminSuite 2.3 and Solaris 8

7. How to change a hostname and IP address?

8. PPP configuration problem, Help please

9. Dynamic IP address and hostname

10. Resolving Hostnames/IP-Adresses from MAC-Address

11. command to convert hostname to IP address

12. How do I lookup a hostname's ip address from a bourne shell script?

13. iptables can filter by hostname and not ip address ?