Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I wanted to know the IP address of a website.One way is to ping the website.For example if I want to know the ip address of google.com then I can ping in command prompt.

Pinging google.com [74.125.236.195] with 32 bytes of data:

Reply from 74.125.236.195: bytes=32 time=36ms TTL=49
Reply from 74.125.236.195: bytes=32 time=35ms TTL=49
Reply from 74.125.236.195: bytes=32 time=64ms TTL=49
Reply from 74.125.236.195: bytes=32 time=47ms TTL=49

So here 74.125.236.195 is the IP address of google.But for suppose I want to know the IP address of superuser.com and if I try using the same way then I get 198.252.206.16 IP address.But If I put this IP addess in browser url then my browser does not take me to superuser.com.

Can anyone tell me how to get the IP address?

share|improve this question
    
There is no such thing as "the IP address of a website". –  David Schwartz Feb 11 at 23:07
    
@DavidSchwartz Thanks for sharing information.When we ping google.com then we get 74.125.236.195. Isnt 74.125.236.195 IP address of google,If not then what we call this? –  SpringLearner Feb 12 at 3:30
    
That's the IP address of some machine, possibly one of many, that you can contact to access the website. –  David Schwartz Feb 12 at 5:00
    
@DavidSchwartz I have a web application in my local system.Do you know how to access the app from WAN?I used port forwarding but its not successful –  SpringLearner Feb 12 at 5:04
    
"It didn't work" is not a helpful problem description. –  David Schwartz Feb 12 at 5:36

4 Answers 4

up vote 11 down vote accepted

Your starting assumption is that all websites can be accessed via their IP address directly. This is not the case.

In many cases (I'd venture most cases) the website that is presented at an IP address is dependent on the website name you are requesting. Ie, if you request superuser.com you will first resolve this to an IP address, then make a request to the IP address for a specific webpage. It looks like this:

GET / HTTP/1.1
Host: superuser.com:80

The first part says "get the first page of the site", and the second says "for the website superuser.com"

This is why a single webserver can host multiple websites using a single IP address. In the case of the Stack Exchange sites, any or all of them can be on each of their servers, and you'll get the one you ask for. If you just put in an IP address, you won't get any of them, because you are not telling the webserver which of the many websites you are after. In these cases, it may have a "default" website defined, or just return an error.

If you are trying to work around an issue with your DNS provider, then one option you have is to modify your hosts file so that you are resolving addresses yourself, rather than have an external party do it for you.

So for example, if you edit

/etc/hosts   (linux)
c:\windows\system32\drivers\etc\hosts   (windows)

You can enter

74.125.236.195 superuser.com

This way, if you type superuser.com into your browser, it will look in the hosts file, and resolve the IP address, but then still pass through the name of the website to the server it connects to.

share|improve this answer
    
Thanks for the answer.Pinging google.com gives me 74.125.236.195 and pinging gmail.com gives me 74.125.236.214 but if type 74.125.236.214 in the browser URL then it takes me to google.Can you please tell me why? –  SpringLearner Feb 3 at 8:52
    
For the same reason. There is a server at .214 that can serve both gmail or google.com. As you aren't specifying which one you want, it is serving google.com by default. Perhaps you can edit your question and describe the problem you are having that you are trying to solve by using IP addresses, and we can come up with a solution that works. –  Paul Feb 3 at 9:10
    
I just wanted know the IP address of websites.This only I want. –  SpringLearner Feb 3 at 9:18
    
@JqueryLearner: This is the correct answer. Websites can share an IP address, which in reverse means that one IP address can serve multiple websites. –  MSalters Feb 3 at 11:53
    
Also note that a website can have more than one IP address: yet another reason to regard "the IP address of a website" as a meaningless phrase. –  kreemoweet Feb 12 at 0:56

To get the IP address of a website. The best way is to use nslookup command. For example:

nslookup superuser.com 8.8.8.8
Server:  google-public-dns-a.google.com
Address:  8.8.8.8

Non-authoritative answer:
Name:    superuser.com
Address:  198.252.206.16

If you wonder why you cannot visit superuser directly from IP address (198.252.206.16), it is because of the settings of web server.

Here, superuser's site disallows user visit via IP address. Probably it is because the IP address is binding to other web sites (say stackoverflow.com).

If you use "IP reverse lookup" tool, you can find its binding sites.

One more lookup proves I am right:

nslookup stackoverflow.com  8.8.8.8
Server:  google-public-dns-a.google.com
Address:  8.8.8.8

Non-authoritative answer:
Name:    stackoverflow.com
Address:  198.252.206.16
share|improve this answer
    
Thanks for the answer +1 –  SpringLearner Feb 3 at 9:29
    
Can you please tell me what is the meaning of this Server: google-public-dns-a.google.com –  SpringLearner Feb 3 at 9:33
    
this is the server name of 8.8.8.8. You can test by pinging google-public-dns-a.google.com –  lesca Feb 3 at 10:15
    
for every site do I need to give 8.8.8.8? –  SpringLearner Feb 3 at 10:18
    
@JqueryLearner It's just a DNS used for resolving server names like superuser.com. Typically, you are using your local DNS, you can check it out by just typing nslookup. This command use the local DNS by default. –  lesca Feb 3 at 10:21

Firefox have a nice addon which shows the OP address of any website you visit which you can get from here

share|improve this answer
    
Thanks for the answer.Isnt there any way from command prompt or by any other way without using plugins –  SpringLearner Feb 3 at 8:32
    
Well ping works just fine or any IP lookup service online should be able to provide the information you want. –  Matthew Williams Feb 3 at 8:36
    
Ping works for some sites.As i said it works for google but not superuser –  SpringLearner Feb 3 at 8:37
    
Ping superuser works just fine for me. Must be a problem on your end. Any specific reason a plugin won't suite your needs? –  Matthew Williams Feb 3 at 8:39
    
what is the IP you are getting when you ping superuser –  SpringLearner Feb 3 at 8:41

Flagfox add-on for Firefox gives you the ip address of the current website, along with a wealth of other information about the website (including a geolocation map of the server location). A menu selection within the add-on's pulldown allows you to copy the IP address to your clipboard if desired.

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.