raja@bombay.cps.msu.edu (Narayan S. Raja) (12/25/90)
Given a hostname (e.g. zip.foo.bar.edu), one can use a network information program like nslookup to find its Internet address. How about the other way round? Given an internet address (e.g. 1.2.3.4), how would one find the complete hostname? (Assuming, of course, that it's not available in /etc/hosts or equivalent host database). Narayan Sriranga Raja. PS: One could "mail unlikely-username@\[1.2.3.4\]" and wait for the mail to bounce back from the MAILER-DAEMON (usually giving the hostname), but surely there must be a simpler way.
rickert@mp.cs.niu.edu (Neil Rickert) (12/26/90)
In article <1990Dec25.070328.4413@msuinfo.cl.msu.edu> raja@cpswh.cps.msu.edu writes: > >about the other way round? Given an internet >address (e.g. 1.2.3.4), how would one find the >complete hostname? > The library function gethostbyaddr() is provided for this purpose. But if you want to use 'nslookup', set type=PTR, then resolve the address 4.3.2.1.in-addr.arpa. -- =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= Neil W. Rickert, Computer Science <rickert@cs.niu.edu> Northern Illinois Univ. DeKalb, IL 60115 +1-815-753-6940
haynes@ucscc.UCSC.EDU (99700000) (12/26/90)
In article <1990Dec25.070328.4413@msuinfo.cl.msu.edu> raja@cpswh.cps.msu.edu writes: > >Given a hostname (e.g. zip.foo.bar.edu), one >can use a network information program like >nslookup to find its Internet address. How >about the other way round? Given an internet >address (e.g. 1.2.3.4), how would one find the >complete hostname? The latest version of nslookup (from BIND.4.8.3) will take either a number or a name. Or you could throw together a little program using gethostbyaddr(). Or there is some arcane manipulation involving nslookup and in-addr.arpa haynes@ucscc.ucsc.edu haynes@ucscc.bitnet "Any clod can have the facts, but having opinions is an Art." Charles McCabe, San Francisco Chronicle
palkovic@zippy.fnal.gov (John A. Palkovic) (12/27/90)
In article <1990Dec25.070328.4413@msuinfo.cl.msu.edu> raja@bombay.cps.msu.edu (Narayan S. Raja) writes: Given a hostname (e.g. zip.foo.bar.edu), one can use a network information program like nslookup to find its Internet address. How about the other way round? Given an internet address (e.g. 1.2.3.4), how would one find the complete hostname? I use the following shell script. You may have to tweak the args to sed or the sleep command. #!/bin/sh # # Map an IP address to a host name # OIFS=$IFS IFS=. set -- $1 IFS=$OIFS PTR=`echo $4.$3.$2.$1.in-addr.arpa` ( echo set q=ptr sleep 1 echo $PTR ) | nslookup | sed -e 1,3d -e 's/^.*> //' -- John Palkovic (708) 840-3527 | palkovic@linac.fnal.gov "A Superconductor generates electricity without resistance when cooled." - Chicago Tribune, Oct. 21, 1990, A-18