TOMIII@MTUS5.BITNET (Thomas Dwyer III) (09/10/90)
Does anyone know how to obtain the hostname of a machine given the IP address using a name server (the nslookup feature of unix?) ? Thanks, Thomas Dwyer III Email: tomiii@mtu.edu Network Programmer tomiii@mtus5.BITNET Computing Technology Services Voice: (906) 487-2110 Michigan Technological University Fax: (906) 487-2787
aaron@ux.acs.umn.edu (Aaron Y.T. Cheung) (09/10/90)
| Does anyone know how to obtain the hostname of a machine given the IP | address using a name server (the nslookup feature of unix?) ? Try the reverse mapping -- nslookup with the PTR type: Eg, to get the hostname of IP address 128.101.63.2, nslookup> set q=ptr nslookup> 2.63.101.128.in-addr.arpa. (note that the IP is supplied reversed) for the convenience of querying multiple IP's, nslookup> set q=ptr nslookup> set do=in-addr.arpa. nslookup> 2.63.101.128 nslookup> 1.63.101.128 etc. Works only if the IP address is connected to the Internet and someone did register his corresponding network.in-addr.arpa domain with Nic and someone actually put in the ptr records for their hosts and their primary and secondary nameservers are not down and.... :-) Hope it helps. /aaron.
mathisen@dali.cs.montana.edu (Jaye Mathisen) (09/10/90)
In article <90252.231430TOMIII@MTUS5.BITNET> TOMIII@MTUS5.BITNET (Thomas Dwyer III) writes: >Does anyone know how to obtain the hostname of a machine given the IP >address using a name server (the nslookup feature of unix?) ? To find the hostname for IP address 1.2.3.4: % nslookup > set type=ptr > 4.3.2.1.in-addr.arpa will do the trick... Assuming the .in-addr.arpa tables have been set up appropriately...
thomas@uplog.se (Thomas Tornblom) (09/10/90)
In article <90252.231430TOMIII@MTUS5.BITNET> TOMIII@MTUS5.BITNET (Thomas Dwyer III) writes:
Does anyone know how to obtain the hostname of a machine given the IP
address using a name server (the nslookup feature of unix?) ?
nslookup -query=ptr <ip-address reversed>.in-addr-arpa.
I.e:
For the host 192.16.142.80 the query would be:
nslookup -query=ptr 80.142.16.192..in-addr-arpa.
--
Real life: Thomas Tornblom Email: thomas@uplog.se
Snail mail: Telesoft Uppsala AB Phone: +46 18 189406
Box 1218 Fax: +46 18 132039
S - 751 42 Uppsala, Sweden
thomas@uplog.se (Thomas Tornblom) (09/10/90)
In article <THOMAS.90Sep10110602@uplog.uplog.se> thomas@uplog.se (Thomas Tornblom) writes:
For the host 192.16.142.80 the query would be:
nslookup -query=ptr 80.142.16.192..in-addr-arpa.
Sloppy fingers, it should of course be:
nslookup -query=ptr 80.142.16.192.in-addr.arpa.
--
Real life: Thomas Tornblom Email: thomas@uplog.se
Snail mail: Telesoft Uppsala AB Phone: +46 18 189406
Box 1218 Fax: +46 18 132039
S - 751 42 Uppsala, Sweden
--
Real life: Thomas Tornblom Email: thomas@uplog.se
Snail mail: Telesoft Uppsala AB Phone: +46 18 189406
Box 1218 Fax: +46 18 132039
S - 751 42 Uppsala, Sweden
karl_kleinpaste@cis.ohio-state.edu (09/10/90)
tomiii@mtus5.bitnet writes: Does anyone know how to obtain the hostname of a machine given the IP address using a name server (the nslookup feature of unix?) ? host(1) is better for 99+% of the usual queries you want to make, including automatic in-addr.arpa queries when given a dotted quad, no need to do special "query=ptr" things. | [78] [10:41am] giza:/n/giza/0/karl> host 128.146.8.60 | Name: tut.cis.ohio-state.edu | Address: 128.146.8.60 | Aliases: | | [79] [10:42am] giza:/n/giza/0/karl> host 128.146.0.0 | Name: net.ohio-state.edu | Address: 128.146.0.0 | Aliases: | | [80] [10:42am] giza:/n/giza/0/karl> host -a tut.cis.ohio-state.edu. | tut.cis.ohio-state.edu 1395 IN A 128.146.8.60 | tut.cis.ohio-state.edu 86400 IN HINFO pyramid-98x unix | tut.cis.ohio-state.edu 86400 IN MX 100 tut.cis.ohio-state.edu | tut.cis.ohio-state.edu 86400 IN WKS 128.146.8.60 udp 42 tftp sunrpc | tut.cis.ohio-state.edu 86400 IN WKS 128.146.8.60 tcp ftp telnet smtp nameserver sunrpc | Additional information: | tut.cis.ohio-state.edu 1395 IN A 128.146.8.60 You can pick it up as tut.cis.ohio-state.edu:pub/nameserver/host.[1c]. Chuck Hedrick/Rutgers is responsible for it. --karl
paul@uxc.cso.uiuc.edu (Paul Pomes - UofIllinois CSO) (09/11/90)
Thomas Dwyer III <TOMIII@MTUS5.BITNET> writes: >Does anyone know how to obtain the hostname of a machine given the IP >address using a name server (the nslookup feature of unix?) ? > >Thanks, >Thomas Dwyer III Email: tomiii@mtu.edu >Network Programmer tomiii@mtus5.BITNET >Computing Technology Services Voice: (906) 487-2110 >Michigan Technological University Fax: (906) 487-2787 Try these csh aliases (courtesy of Matt Crawford): # BIND aliases alias a "(" echo set q=A ";" echo \!\* ")" "|" nslookup alias cname "(" echo set q=CNAME ";" echo \!\* ")" "|" nslookup alias mx "(" echo set q=MX ";" echo \!\* ")" "|" nslookup alias hinfo "(" echo set q=HINFO ";" echo \!\* ")" "|" nslookup alias ns "(" echo set q=NS ";" echo \!\* ")" "|" nslookup alias any "(" echo set q=ANY ";" echo \!\* ")" "|" nslookup alias soa "(" echo set q=SOA ";" echo \!\* ")" "|" nslookup alias ptr echo \!$ \| awk -F. \'\{printf \"set q=PTR\\n%s.%s.%s.%s.in-addr.arpa\\n\",\$4,\$3,\$2,\$1\}\' \| nslookup or these ksh functions: # BIND functions function a # Addresses { nslookup <<- EOF set q=A $1 EOF } function cname # Canonical name { nslookup <<- EOF set q=CNAME $1 EOF } function mx # Mail eXchangers { nslookup <<- EOF set q=MX $1 EOF } function hinfo # Host information { nslookup <<- EOF set q=HINFO $1 EOF } function ns # Name servers { nslookup <<- EOF set q=NS $1 EOF } function any # Any query { nslookup <<- EOF set q=ANY $1 EOF } function soa # Start of authority { nslookup <<- EOF set q=SOA $1 EOF } function ptr # Inverse query { print $1 | awk -F. '{printf "set q=PTR\n%s.%s.%s.%s.in-addr.arpa\n",$4,$3,$2,$1}' | nslookup } -- Paul Pomes UUCP: {att,iuvax,uunet}!uiucuxc!paul Internet, BITNET: paul@uxc.cso.uiuc.edu US Mail: UofIllinois, CSO, 1304 W Springfield Ave, Urbana, IL 61801-2910
moraes@cs.toronto.edu (Mark Moraes) (09/12/90)
karl_kleinpaste@cis.ohio-state.edu writes: >host(1) is better for 99+% of the usual queries you want to make, >including automatic in-addr.arpa queries when given a dotted quad, no >need to do special "query=ptr" things. I'll second that -- host is a terrific way to ask a nameserver questions. Its default output is simple and understandable, even to ordinary users, and it can be convinced to produce it in the same format as nameserver input for the wizard. It can even be made as verbose as dig(1) if you really want that. >You can pick it up as tut.cis.ohio-state.edu:pub/nameserver/host.[1c]. >Chuck Hedrick/Rutgers is responsible for it. A somewhat modified version is available from cs.toronto.edu:pub/host.tar.Z. The mods were mostly for portability (to get it to work on our Ultrix systems, SunOS3.5 Suns and SGIs), plus a simple enhancement to allow it to accept multiple hosts to resolve. Mark.