[comp.unix.questions] Host name and internet id

Brian.Chan@samba.acs.unc.edu (Brian Chan) (03/28/91)

I hope this is the right newsgroup for my question: 

how do you find out the host numeric addess (eg 128.x.x.x) if you only
know its name like foo.bar.edu? 

Nicname and whois only work partially. If a site is not registered
at some location, how can you find out this numeric address besides
sending mail to root@foo.bar.edu?

Thank you very much for your time,

Brian
Stuttgart, FRG

--
=============================================================================
	Extended Bulletin Board Service, Research & Development
Office of Information Technology, University of North Carolina at Chapel Hill
	      internet: bbs.acs.unc.edu or 128.109.157.30

jik@athena.mit.edu (Jonathan I. Kamens) (04/03/91)

In article <3131@beguine.UUCP>, Brian.Chan@samba.acs.unc.edu (Brian Chan) writes:
|> how do you find out the host numeric addess (eg 128.x.x.x) if you only
|> know its name like foo.bar.edu? 

  I'm assuming that you're using a machine that uses Internet name service to
resolve hostnames, rather than a large /etc/hosts table.  If your site uses
/etc/hosts, then go find your site admin, shoot him, and then replace him with
a site admin who will upgrade your software so that it uses Internet name
server (that's a joke, OK? :-).

  You can use the bindtest, nslookup or dig utilities to find out an Internet
address given a host name.  All of those utilities have sources floating
around the net; if you can't find them and want to, let me know and I'll see
what I can dig up.

  Alternatively, if you're not interested in the complexity of those
utilities, you can just write a short C program to call gethostbyname() on the
string you pass it, and then print out the address in the data that is
returned using inet_ntoa.

  In fact, we've got a utility here to do that.  I've shar'd the source file
and the man page together into a shar file and put it in
/pub/tmp/hostinfo.shar on pit-manager.mit.edu (18.72.1.58).  It's also
retrievable via E-mail by sending a message to
"mail-server@pit-manager.mit.edu" with "send tmp/hostinfo.shar" in the subject
or body of the message.  It'll only stay there for a week, though, so make
sure to grab it.  

  A couple notes: First of all, you should know that a site can have more than
one IP address.  The hostinfo program I mentioned above deals with that
properly.  Second, you should know that a host that looks like an internet
site can have no IP addresses at all.  Most of those are Mail eXchange, or MX,
addresses, which means that when mailers ask the name servers, "How do I send
mail to this host?" the name server responds with, "You send the mail to this
other host instead, and it'll take care of final delivery of the mail."

-- 
Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik@Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8085			      Home: 617-782-0710