0

First, I checked Wikipedia's IP address using the ping command... enter image description here

Then I tried to access their website using the IP address directly...

enter image description here

Why do I not get to the main Wikipedia page? I thought that when I type in wikipedia.org, DNS resolves the IP address for wikipedia.org (which according to the ping command is 208.80.154.224), and then the browser makes the GET request using this IP address. So why is there a different page when I type in 208.80.154.224 directly instead of letting DNS resolve 208.80.154.224 from wikipedia.org?

0

1 Answer 1

2

It's in the nature of a GET request. A server can host multiple domains, so the browser tells the server which one to retrieve:

GET /infotext.html HTTP/1.1
Host: www.example.net

If you replace the Host name by the IP address, it becomes ambiguous.

However, Wikimedia foundation has obviously set up a simple web page for the domain 208.80.154.224 that is delivered explicitly to tell you that you have just hit this ambiguosity.

3
  • Thanks, but isn't the host name replaced by the IP address via DNS behind the scenes? e.g. the browser sends a query to the DNS servers asking what IP address www.example.net is, and then uses that IP address that is returned in the GET request Sep 26, 2014 at 20:30
  • For making the request, the host name is replaced by the IP address in order to find the destination. This is done in the header of the IP part of the packet. Note that the GET request is the content of the HTTP packet. And there, it is not replaced. Sep 27, 2014 at 9:25
  • Ahh, I see! The IP address resolved by DNS for the given host name is used in the "internet layer" of the packet while the host name itself is used as-is in the "application layer" of the packet a.k.a. in the HTTP GET request. Thanks, it finally makes sense! Sep 27, 2014 at 20:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .