Finding the numerical IP address of a website or domain URL is pretty easy. We’ll use a terminal utility called nslookup, the command can be used to discover whatever domain resolves to a specific IP. This works for Macs with OS X but also in other unix varieties and even Windows DOS prompt too.
Finding a Website / Domain Associated IP Address with nslookup
To get started on a Mac or Linux machine, open a new Terminal window and simply type the following command:
nslookup google.com
Replace ‘google.com’ with the domain you are interested in finding the IP for.
You’ll then see something like this printed back at you:
$ nslookup google.com
Server: 192.168.0.105
Address: 192.168.0.105#74
Non-authoritative answer:
Name: google.com
Address: 74.125.127.147
The ‘non-authoritative answer’ will show you the original domain name of the website or URL queried with the resolving IP address below.
In this example, the number underneath google.com is the IP address for Google.com.
If you want to cut to just the IP addresses of the target domain without your own information, you can grep for “Address” and ignore the first response like so:
nslookup google.com |grep Address
Note that some larger websites will have multiple IP responses for a variety of purposes, ranging from redundancy to distributing load and for DNS purposes.
Retrieving a Website / Domain IP Address with dig
An alternative approach is to use the dig command, which is similar to nslookup but provides a more detailed return of DNS lookup:
dig [domain]
For example, on the very own osxdaily.com set to a local environment, a dig lookup would provide the following DNS details for that website:
% dig osxdaily.com
; > DiG 9.8.3-P1 > osxdaily.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER
There’s any number of reasons why you’d want a websites numerical address rather than their resolved domain, from troubleshooting DNS problems, to determining domain neighbors, to configuring network settings.
Whether to use nslookup or dig is up to you, both work just fine in all versions of Mac OS X and in all versions of Linux. Happy domain resolving!
Follow Me:
Top Best Sellers!!