Matching Domain Names with IP Numbers

When accessing a computer on the Internet, you generally type in a domain name (such as www.raycomm.com) and your system translates it into an IP number (such as 204.228.141.12). 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 www.raycomm.comns1.netrack.net
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:         ns1.netrack.net
Address:        206.168.112.16#53

Non-authoritative answer:
Name:   www.raycomm.com
Address: 206.168.112.83

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 www.raycomm.com → ns1.netrack.net

    At the shell prompt, type nslookup followed by the domain name you want to look up and the server you want to do the looking for you (Code Listing 12.8). Remember, if you get one of those pesky “failed DNS lookup” messages, the problem likely resides with your name server; therefore, you’ll need to specify a different name server to match the domain name and IP number for you.

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

  • dig @ns1.netrack.net www.raycomm.com

    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 @ns1.netrack.netwww.raycomm.com

; <<>> DiG 9.2.1 <<>> @ns1.netrack.net
→ www.raycomm.com
;; 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:
;www.raycomm.com.             IN     A

;; ANSWER SECTION:
www.raycomm.com.       3585     IN   A
→ 206.168.112.83

;; AUTHORITY SECTION:
raycomm.com.           3585     IN   NS
→ ns2.raycomm.com.
raycomm.com.           3585     IN   NS
→ ns1.raycomm.com.

;; Query time: 60 msec
;; SERVER:
→ 206.168.112.16#53(ns1.netrack.net)
;; WHEN: Sun Jan 26 18:20:47 2003
;; MSG SIZE  rcvd: 85

jdoe /home/jdoe $

✓ Tips

  • 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 192.168.1.23 (substituting the appropriate IP address) or dig –x 192.168.1.82 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 http://www.internic.net/whois.html 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.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.102.114