Search code examples
ipipv6ipv4

Understanding IP . The requested URL was not found on this server


I'm a student, and I'm trying to understand the idea behind IP addresses. I learn that typing in a url is the same as typing in the corresponding IP address - either way, we'll be directed to the same web page.

I used the ping command to find the IP address of howstuffworks.com . I then typed that IP address in my browser ( google chrome ) but got this error :

The requested URL was not found on this server.

Why? I tried the same with google.com IP, and it worked fine.

Also, the IP addresses that I found using the ping command were IPv4 ( for google, it was 173.194.40.80) . Why did it not show an IPv6 address??


Solution

  • The relation between FQDNs (e.g. www.stackoverflow.com) and IP addresses (e.g. 198.252.206.140) is not necessarily a one-to-one relation. For instance, if I do a DNS lookup for www.stackoverflow.com, I get 198.252.206.140. So, the website for www.stackoverflow.com is hosted on a web server with the IP address 198.252.206.140. But, it's possible that there may be other web sites hosted at 198.252.206.140 as well.

    That's why we have the Host command in the http protocol. After the browser makes a connection to the web server on port 80, the browser sends the host command to indicate which site on the web server it is attempting to connect to. See http://blog.tonycode.com/tech-stuff/http-notes/making-http-requests-via-telnet for a good tutorial on how this works. Copied below is a telnet session with 198.252.206.140, where an http connection is made, and the host command is issued to select www.stackoverflow.com, and the default response for www.stackoverflow.com is returned (which in this case is a 301 redirect to stackoverflow.com):

    $ telnet 198.252.206.140 80
    Trying 198.252.206.140...
    Connected to 198.252.206.140.
    Escape character is '^]'.
    GET / HTTP/1.1
    Host: www.stackoverflow.com
    
    HTTP/1.1 301 Moved Permanently
    Content-Type: text/html; charset=UTF-8
    Location: http://stackoverflow.com/
    Date: Tue, 04 Mar 2014 10:58:36 GMT
    Content-Length: 148
    
    <head><title>Document Moved</title></head>
    <body><h1>Object Moved</h1>This document may be found <a   
    HREF="http://stackoverflow.com/">here</a></body>