Matching Domain Names with IP Numbers

When accessing a computer on the Internet, you generally type in a domain name (such as and your system translates it into an IP number (such as As a rule, the translation from domain name to IP number proceeds without a problem. Heck, most of the time, you won't even notice that it happened. Occasionally, though, you'll come across an error message that says something like "failed DNS lookups." All that this message means is that the domain name server (probably on your Unix system) cannot match the domain name you provided to an IP number.

Code Listing 12.8. You can manually translate a domain name into an IP address using nslookup.

jdoe /home/jdoe $ nslookup Note:  nslookup is deprecated and may be removed from future releases. Consider using the 'dig' or 'host' programs instead.  Run nslookup with the '-sil[ent]' option to prevent this message from appearing. Server: Address: Non-authoritative answer: Name: Address: 

So, what do you do?

  • Just be patient for a day or two until the problem is resolved. (In the meantime, make sure the problem isn't a typo on your part.)

  • Use nslookup or dig, which manually convert a domain name to the matching IP number (Code Listing 12.8). Then you can connect directly to the IP number, rather than use the domain name.

To match a domain name with an ip number using nslookup:

  • nslookup

    To match a domain name with an ip number using dig:

    • dig

      At the shell prompt, type dig followed by @server-you-want-to-query and the domain name you want to look up (Code Listing 12.9).

    Code Listing 12.9. You can use dig to look up domain names and IP numbers.

    jdoe /home/jdoe $ dig ; <<>> DiG 9.2.1 <<>> ;; global options:  printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status:  NOERROR, id: 32957 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1,  AUTHORITY: 2, ADDITIONAL: 0 ;; QUESTION SECTION: ;             IN     A ;; ANSWER SECTION:       3585     IN   A ;; AUTHORITY SECTION:           3585     IN   NS           3585     IN   NS ;; Query time: 60 msec ;; SERVER: ;; WHEN: Sun Jan 26 18:20:47 2003 ;; MSG SIZE  rcvd: 85 jdoe /home/jdoe $ 


    • You can also do reverse lookups (matching number to name). This can be handy for identifying the origins of unknown email (from the IP addresses in the email headers), among many other tasks. Use nslookup (substituting the appropriate IP address) or dig x to match a number to a name. Note that many servers have a single IP number that supports many domain names, so the answer from this may not be as definitive as it looks.

    • For most purposes, nslookup provides more quickly comprehensible output (Code Listing 12.8) than dig does. However, dig (with appropriate options) can help provide extra information that can be useful in some cases. See man dig for information about available options.

    • You can find alternate domain name servers by using the whois query server at and looking up the domain name you want. All domain names have to be listed with two different domain name servers that are responsible for the domain names. Either of those listed servers should be able to provide the IP number for the domain name you enter.

Unix(c) Visual Quickstart Guide
UNIX, Third Edition
ISBN: 0321442458
EAN: 2147483647
Year: 2006
Pages: 251

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: