The Computer Oracle

If I enter an IP for a website rather than the string form, does my local DNS server understand this and will I bypass the DNS process?

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 2 Looping

--

Chapters
00:00 If I Enter An Ip For A Website Rather Than The String Form, Does My Local Dns Server Understand This
00:34 Accepted Answer Score 18
01:26 Answer 2 Score 3
01:52 Thank you

--

Full question
https://superuser.com/questions/1072343/...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#dns

#avk47



ACCEPTED ANSWER

Score 18


If you use an IP address, the OS will know that it is an IP address immediately, and will not do a forward lookup.

When you do a HTTP request, the first step is to obtain the IP address of the destination, so that the browser can communicate with the server. For communication with the server, everything happens over IP, from IP address to IP address, and so the name of the server is not needed for this communication. However, it is passed in the HTTP headers as a Host: header to let the web server know which website you are after, if it is hosting multiple sites.

In the case of accessing by IP address, this does not happen, and the default site is presented.

Your hosts file is a static file, it does not change by any action you take, except if you directly edit it (or have scripts or applications that modify it).




ANSWER 2

Score 3


As others have written, by using an IP address you are indeed skipping the DNS which allows accessing for example development sites without a host name.

Adding an IP - mock host name into /etc/hosts is extremely common again for development sites. Unlike using the IP address directly this will a) still skip DNS b) make the browser add the Host request header to the HTTP request allowing virtual hosts on a local server for example.