Operating System Information --> Unix Information --> Unix Utilities --> Getting an IP-Address from a Hostname or Vice Versa -->

Getting an IP-Address from a Hostname or Vice Versa

The two most commonly used Unix commands for querying the Domain Name Service system (they are not always both present on any particular Unix system) are:

  • host-- which provides output such as this:
    • host ns1.umd.edu
      ns1.umd.edu has address 128.8.74.2
      host 128.8.74.2
      Name: ns1.umd.edu
      Address: 128.8.74.2
      Aliases:

If you get a Host not found or Host not found, try again message, either you misspelled the name or the name doesn't exist (or, if you specified an IP address, it may just be that the information for converting from IP to name simply hasn't been put into that domain's DNS).

  • nslookup-- which provides output such as this:
    • nslookup ns1.umd.edu
      Server: the Unix machine you're using
      Address: its IP address
      Non-authoritative answer:
      Name: ns1.umd.edu
      Address: 128.8.74.2


    • nslookup 128.8.74.2
      Server: the Unix machine you're using
      Address: its IP address
      Name: ns1.umd.edu
      Address: 128.8.74.2

The "Non-authoritative answer" message comes when your local DNS has already recently looked up the item and is reporting back directly based on what it has in its cache (storage of recent items), rather than going out to the DNS that is authorized to handle the domain in question.

How do I:
How are we doing? Comments on this page?
Office of Information Technology
Office of Information Technology Help Desk Web Site University of Maryland Web Site Office of Information Technology Web Site