Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -209,20 +209,14 @@ Check HSTS list
DNS lookup
----------

* Browser checks if the domain is in its cache. (to see the DNS Cache in
Chrome, go to `chrome://net-internals/#dns <chrome://net-internals/#dns>`_).
* If not found, the browser calls ``gethostbyname`` library function (varies by
OS) to do the lookup.
* ``gethostbyname`` checks if the hostname can be resolved by reference in the
local ``hosts`` file (whose location `varies by OS`_) before trying to
resolve the hostname through DNS.
* If ``gethostbyname`` does not have it cached nor can find it in the ``hosts``
file then it makes a request to the DNS server configured in the network
stack. This is typically the local router or the ISP's caching DNS server.
* If the DNS server is on the same subnet the network library follows the
``ARP process`` below for the DNS server.
* If the DNS server is on a different subnet, the network library follows
the ``ARP process`` below for the default gateway IP.
* The browser first checks its local **DNS cache** to see if it already knows the IP address.
* If not found, it checks the **operating system’s DNS cache**.
* If still unresolved, it sends a request to the **configured DNS resolver** (often an ISP’s DNS server).
* The resolver may return a cached response or forward the request to **root DNS servers**.
* The process continues until it reaches an **authoritative DNS server** that provides the correct IP address.
* A `dig` command can demonstrate this process:
```bash
dig google.com


ARP process
Expand Down