How to know the IP address of a website
Solution 1
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.
Solution 2
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
Solution 3
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.
Solution 4
Firefox have a nice addon which shows the OP address of any website you visit which you can get from here
Related videos on Youtube
peter
Updated on September 18, 2022Comments
-
peter over 1 year
In my project,I use
#include <list>
,then I found thatlist
linked to 'list.h'. But in other peoples' project,I found that 'list' linked to 'stl_list.h', and I coundnt find where he includes it. What is the difference between stl_list.h and list.h? Are they used in the same way?-
David Schwartz over 10 yearsThere is no such thing as "the IP address of a website".
-
SpringLearner over 10 years@DavidSchwartz Thanks for sharing information.When we
ping google.com
then we get74.125.236.195
. Isnt74.125.236.195
IP address of google,If not then what we call this? -
David Schwartz over 10 yearsThat's the IP address of some machine, possibly one of many, that you can contact to access the website.
-
SpringLearner over 10 years@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
-
David Schwartz over 10 years"It didn't work" is not a helpful problem description.
-
SpringLearner over 10 years@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 superuser.com/questions/706948/…
-
David Schwartz over 10 yearsI posted a comment in that thread. I suspect the problem is double NAT.
-
SpringLearner over 10 years@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 over 10 yearsPing works for some sites.As i said it works for google but not superuser
-
Matthew Williams over 10 yearsPing superuser works just fine for me. Must be a problem on your end. Any specific reason a plugin won't suite your needs?
-
SpringLearner over 10 yearswhat is the IP you are getting when you ping superuser
-
Matthew Williams over 10 yearsWell 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.
-
SpringLearner over 10 yearsThanks for the answer.Pinging google.com gives me
74.125.236.195
and pinging gmail.com gives me74.125.236.214
but if type74.125.236.214
in the browser URL then it takes me to google.Can you please tell me why? -
Paul over 10 yearsFor 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.
-
SpringLearner over 10 yearsI just wanted know the IP address of websites.This only I want.
-
SpringLearner over 10 yearsCan you please tell me what is the meaning of this
Server: google-public-dns-a.google.com
-
lesca over 10 yearsthis is the server name of 8.8.8.8. You can test by pinging google-public-dns-a.google.com
-
SpringLearner over 10 yearsfor every site do I need to give 8.8.8.8?
-
lesca over 10 years@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. -
MSalters over 10 years@JqueryLearner: This is the correct answer. Websites can share an IP address, which in reverse means that one IP address can serve multiple websites.
-
kreemoweet over 10 yearsAlso 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.