Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How to I get the IP address of a given website,such as serverfault.com?

share|improve this question
add comment

10 Answers 10

up vote 12 down vote accepted

From a command-prompt:

nslookup <web site fully-qualified domain name>

Bear in mind that with load-balancers, geo-DNS systems, etc, that the IP address you get back might have no real relationship to the IP address actually assigned to the web server.

share|improve this answer
4  
The "host <fqhn>" command on GNU system is also nice. If you're curious about how the queries get handled, try "dig a serverfault.com +trace" and it will show which name servers were used. –  Andrioid Jul 7 '09 at 16:47
    
nslookup is deprecated. Use dig instead. –  Peter May 12 '13 at 7:38
    
@Peter - And dig isn't available in Windows NT-based operating systems by default, whereas nslookup is. It's nice to be "current" w/ the tools you use, but there's also the reality of the tools that are available by default. –  Evan Anderson May 12 '13 at 14:35
add comment

on a linux or mac system you can also use the command dig which will give some extra information. nslookup is deprecated so you should use dig where available. They have similar output.

$ dig serverfault.com

; <<>> DiG 9.4.3-P1 <<>> serverfault.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 53701
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;serverfault.com.   	IN	A

;; ANSWER SECTION:
serverfault.com.    1285	IN	A	69.59.196.212

;; Query time: 5 msec
;; SERVER: 10.0.1.1#53(10.0.1.1)
;; WHEN: Tue Jul  7 12:30:26 2009
;; MSG SIZE  rcvd: 49
share|improve this answer
    
dig also accesses the DNS infrastructure just like any other application; nslookup does not. So for debugging, dig is much better. IT's also put out by the same folks that bring you BIND (the definitive name server). –  Mei Jul 7 '09 at 23:42
add comment

If you do this a lot, I would suggest a Firefox Add-on like ShowIP.

share|improve this answer
add comment

Notice, that there could be hundreds or even thousands web sites "hiding" behind a single ip address if the web server serves named virtual hosts. See e.g. the VirtualHost keyword in the Apache documentation. I.e. a web site need not have a dedicated ip address of its own.

share|improve this answer
add comment

ping serverfault.com look for the IP address in the output.

C:\Documents and Settings\user>ping serverfault.com

Pinging serverfault.com [**69.59.196.212**] with 32 bytes of data:

Reply from 69.59.196.212: bytes=32 time=63ms TTL=111
Reply from 69.59.196.212: bytes=32 time=58ms TTL=111
Reply from 69.59.196.212: bytes=32 time=63ms TTL=111
Reply from 69.59.196.212: bytes=32 time=67ms TTL=111

Ping statistics for 69.59.196.212:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 58ms, Maximum = 67ms, Average = 62ms
share|improve this answer
3  
Don't use ping in preference to nslookup. Ping will suck in all kinds of local wierdness such as host files and Netbios. –  Dan Carley Jul 7 '09 at 16:37
add comment

you probably want the A record, host(1) is the simplest way to get it:

$ host -t A serverfault.com
serverfault.com has address 69.59.196.212

dig(1) gives you a little more information:

$ dig serverfault.com

; <<>> DiG 9.5.1-P2-RedHat-9.5.1-2.P2.fc10 <<>> serverfault.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 17080
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2

;; QUESTION SECTION:
;serverfault.com.       IN  A

;; ANSWER SECTION:
serverfault.com.    3484    IN  A   69.59.196.212           <--- this is what you want

;; AUTHORITY SECTION:
serverfault.com.    3484    IN  NS  ns22.domaincontrol.com.

dig(1) is also telling you that ns22.domaincontrol.com is the name server for serverfault. If you want to be sure you're getting the right IP address, you can query that nameserver:

$ dig @ns22.domaincontrol.com serverfault.com

; <<>> DiG 9.5.1-P2-RedHat-9.5.1-2.P2.fc10 <<>> @ns22.domaincontrol.com serverfault.com
; (1 server found)
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 4726
;; flags: qr aa; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 0

;; QUESTION SECTION:
;serverfault.com.       IN  A

;; ANSWER SECTION:
serverfault.com.    3600    IN  A   69.59.196.212  <-- we had the right one using "host"
share|improve this answer
add comment

In Windows, open a command prompt (Start->Run, type cmd) and run the command:

nslookup serverfault.com

share|improve this answer
add comment
ping serverfault.com

Pinging serverfault.com [69.59.196.212] with 32 bytes of data:
Reply from 69.59.196.212: bytes=32 time=189ms TTL=110
Reply from 69.59.196.212: bytes=32 time=185ms TTL=110
Reply from 69.59.196.212: bytes=32 time=185ms TTL=110
Reply from 69.59.196.212: bytes=32 time=188ms TTL=110
share|improve this answer
add comment

If you're on a host that only permits root to ping:

$ ping google.com
ping: icmp open socket: Operation not permitted

then you can use wget to check ip:

$ wget serverfault.com -O /dev/null
--21:53:22--  http://serverfault.com/
       => `/dev/null'
Resolving serverfault.com... 69.59.196.212
Connecting to serverfault.com|69.59.196.212|:80... connected.
HTTP request sent, awaiting response... 200 OK

As a bonus you get to know if the server is up and running.

share|improve this answer
    
often domain names (and thus websites) can be pointed to multiple IP addresses, so wget is not a good solution as it will only show you one of the possible addreses in those cases. dig (or even depreciated nslookup) are better tools that actually are designed to give you DNS information. –  Jehiah Aug 14 '09 at 3:03
add comment

A web site may have more than one IP -- for instance, what is the IP address of www.google.com? Well, the answer is that it depends. For me it is an alias to www.l.google.com, which itself is either 64.233.161.147 or 64.233.161.104.

But if I ask a different DNS server, I get 74.125.65.147 or 74.125.65.99 or 74.125.65.103 or 74.125.65.104.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.