How to know the IP address of a website

5

2

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?

SpringLearner

Posted 2014-02-03T08:22:52.003

Reputation: 441

There is no such thing as "the IP address of a website". – David Schwartz – 2014-02-11T23:07:47.740

@DavidSchwartz Thanks for sharing information.When we ping google.comthen we get 74.125.236.195. Isnt 74.125.236.195 IP address of google,If not then what we call this? – SpringLearner – 2014-02-12T03:30:33.400

That's the IP address of some machine, possibly one of many, that you can contact to access the website. – David Schwartz – 2014-02-12T05:00:29.570

@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 – 2014-02-12T05:04:49.210

"It didn't work" is not a helpful problem description. – David Schwartz – 2014-02-12T05:36:19.317

@DavidSchwartz Me and my friend have been trying since last 20 days.And he has also posted a question in superuser with bounty but none of the answer is helpful http://superuser.com/questions/706948/port-forwarding-in-d-link-dir-524-router

– SpringLearner – 2014-02-12T05:40:30.613

I posted a comment in that thread. I suspect the problem is double NAT. – David Schwartz – 2014-02-12T05:45:39.323

@DavidSchwartz Thanks,I am not sure if he is online now because he had night shift and may be he is sleeping now.If he is online then he will defintely respond you – SpringLearner – 2014-02-12T05:50:57.590

Answers

13

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.

Paul

Posted 2014-02-03T08:22:52.003

Reputation: 52 173

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 – 2014-02-03T08:52:15.277

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 – 2014-02-03T09:10:34.243

I just wanted know the IP address of websites.This only I want. – SpringLearner – 2014-02-03T09:18:31.540

@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 – 2014-02-03T11:53:55.620

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 – 2014-02-12T00:56:48.350

5

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

lesca

Posted 2014-02-03T08:22:52.003

Reputation: 223

Can you please tell me what is the meaning of this Server: google-public-dns-a.google.com – SpringLearner – 2014-02-03T09:33:15.310

this is the server name of 8.8.8.8. You can test by pinging google-public-dns-a.google.com – lesca – 2014-02-03T10:15:33.087

for every site do I need to give 8.8.8.8? – SpringLearner – 2014-02-03T10:18:36.310

@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 – 2014-02-03T10:21:12.137

1

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

Matthew Williams

Posted 2014-02-03T08:22:52.003

Reputation: 4 149

Thanks for the answer.Isnt there any way from command prompt or by any other way without using plugins – SpringLearner – 2014-02-03T08:32:29.113

Well ping works just fine or any IP lookup service online should be able to provide the information you want. – Matthew Williams – 2014-02-03T08:36:25.193

Ping works for some sites.As i said it works for google but not superuser – SpringLearner – 2014-02-03T08:37:24.320

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 – 2014-02-03T08:39:30.490

what is the IP you are getting when you ping superuser – SpringLearner – 2014-02-03T08:41:31.943

Well bare in mind you're pointing at a web server. So it won't point at a specific site. There are multiple sites on the server and an IP doesn't point at any specific one. – Matthew Williams – 2014-02-03T08:43:28.210

1

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.

jon rosen

Posted 2014-02-03T08:22:52.003

Reputation: 11