12
This is purely out of curiosity. But if I were to type in the IP of a website, would the request still go through the forward lookup process? If not, at what point and by which step is it realized that this is the location by IP and not a hostname as a string?
Also, how would this be recorded in my hostfile? If it goes through the entire lookup process, will the hostfile contain the string hostname as well as the IP and populate locally?
1
Domain Name System, this is what translates a url (google.com) into the ip address, so if you use an ip address it does not have to do a name lookup, bypassing the DNS system. https://en.wikipedia.org/wiki/Domain_Name_System
– Moab – 2016-05-03T00:34:09.803The answers below are correct, browsers are smart enough not to do a forward lookup of an IP address. Doing a forward lookup of an IP address is never a good idea, there are 3 ways a DNS server can react to it: 1) Most DNS servers will simply return the same IP address. 2) Other DNS servers cannot resolve the "dns name" to an IP and will tell you so. 3) Some (free) DNS servers cannot resolve the "dns name" and give you an IP which redirects you to their own search page (usually full of ads). – user1793963 – 2016-05-03T08:04:24.657
1Domain name is necessary if the web server hosts multiple sites. It has single IP and without domain name it cannot understand which site you want. If there is only one web site, then it will work with IP in the same way. – i486 – 2016-05-03T08:21:30.737
1Note that the hostname isn't only sent to DNS for translation, but also to the webserver itself. This means that a webserver which serves multiple websites can't know which of those sites you want. This of course is an IPv4 problem; with IPv6 every website can have its own IP address. – MSalters – 2016-05-03T08:50:35.990
1Now the next question is: How does a your browser know that
2001:feed:face:dead::beef:8080
is an IPv6 address with a specified port and not just a really badly formatted URL... ;) – Mark Henderson – 2016-05-03T11:10:00.787