What is DNS?
The full name is Domain Name Server, it is essentially a phone book for all domains on the internet, it instructs a computer to turn a plain text domain(facebook.com) into a string of numbers (192.168.0.10) that are machine readable. That enables browsers to locate the server/website that the user inputs on the browser’s search box.
How DNS works
When a user searches a website, the query goes through a sequence of four servers from the user’s computer(client) to the destination (Website server). This process doesn’t involve the user’s device. Let’s take a look at what happens when a user searches for “Facebook.com”.
The first stop over the query goes to is the DNS recursor. The server is operated by the user’s Internet Service Provider. It acts as a client or middleman and forwards the query down the line to the root server.
At the Root server, the plain text domain name is turned into machine readable IP address. It holds information about Top-Level Domains (TLD) i.e. .com, .org. Once it finds a correlating TLD, the query moves to the Top-Level Domain server.
The Top-Level domain server (TLD), hosts the final part of a hostname (the “Facebook” in Facebook.com). This enables the next server (Authoritative Server) to direct the query to the specific IP address.
The Authoritative nameserver is the final stop in the nameserver query. It houses the full domain in question. Once the server matches the domain, it sends this information back to the DNS recursor, then back to the user’s device. This is when a Facebook page opens on the user’s device. The whole process happens in a blink of an eye without the user’s knowledge.
Protocols are used by DNS?
Transmission Control Protocol (TCP)
This is one of the protocols used in transferring data on the internet. The protocol requires that a connection has to be made first for data to be sent back and forth. It contains mechanisms that check for errors to ensure data is sent in sequential order. While this is great for ensuring no data loss, it creates a disadvantage as it uses more bandwidth.
User Datagram Protocol (UDP)
Unlike TCP, UDP does not require that a connection be made and has no mechanisms to check for transfer errors. While this could be an advantage as it makes it much faster, this can result to loss of data in the long run.