Add dns article, move to neophyte

This commit is contained in:
cool-mist 2021-11-27 18:35:47 +00:00
parent 076be33282
commit 5de79eef30
3 changed files with 36 additions and 30 deletions

View File

@ -1,8 +1,8 @@
# Setup
title: Bionic Beanie
title: The Neophyte
tagline: 'Blog'
description: 'I would expect that I write about video games, music, chess and tech for the most part'
url: https://blog.bionicbeanie.me
description: 'Article subjects all over the place, for fellow neophytes!'
url: https://blog.neophyte.me
baseurl: ''
paginate: 5
permalink: pretty
@ -18,9 +18,8 @@ plugins:
- jemoji
# Serving
host: blog.bionicbeanie.me
host: blog.neophyte.me
port: 4000
# Custom vars
version: 1.1.0
google_analytics_id: G-P48SVB77Y0

View File

@ -105,6 +105,3 @@ It is common practise to abbreviate the layers as **L4**, **L7** and so on.
## What's next
Developers program at the application layer and have constructs in the programming language that would talk to the Transport Layer of the machine. The implementation of the OSI model in practise is the **[Internet Protocol Suite (TCP/IP)](https://en.wikipedia.org/wiki/Internet_protocol_suite)**. It is important to have a practical understanding of TCP/IP which would prove useful in a variety of situations.
More on this in the next article!

View File

@ -16,27 +16,37 @@ You are told _Quality Coffee_ is at _No 4, Coffee Bean Avenue, Roasted County, C
With some reflection, you can see that the address is more useful to you when you need to navigate to the correct shop and order coffee. However, the product that you sought was _Quality Coffee_. When you later talk about this to your other colleagues back home, you would say you visited _Quality Coffee_ and not _No 4,..._. The shop can move to a different place, but the service that you experienced is tied to the brand and it would remain the same.
Here we two pieces of information - **Name** and **Address**. You seek the services of **Name**. You need to know the its current **Address** to actually get the services you need.
The **Name** is generally the branch associated with the service. In the computer world, the address, which, you might already guess, would be the **IP Address**.
Here we have two pieces of information - **Name** and **Address**. You seek the services of **Name**. You need to know the its current **Address** to actually get the services you need.
The **Name** is generally the brand associated with the service. In the computer world, the address would be the **IP Address**.
> Recall that an **IP Address** is the unique identifier for a machine. There are 2 versions of it - IPv4 and IPv6. An IPv4 IP address looks like this - `10.0.0.1`.
Software engineers behind the Youtube service, will have installed their softwares that makes video content searchable and playable, in a computer, and advertise its IP address to everyone. Users can go to their browser and type in the IP address of youtube and they could be presented with a web page - which is an interface used for searching and playing videos.
## OK, lets get to YouTube
Getting to YouTube is similar to walking into a restaurant to order coffee. YouTube is the service provider with the brand. The restaurant is your browser. Coffee is the video, or the service provided by the service provider.
In order to provide this service,
- Software engineers at YouTube have run programs in their own computers that makes video content searchable and playable.
- They then advertise its IP address to everyone.
- You go to the browser and type in the IP address of youtube.
- You are presented with a web page - which is an interface used for searching and playing videos.
## I hate memorizing numbers!
Everyone does!
As of writing this article, one of the Ip addresses of the youtube services is `74.125.68.93`.
As of writing this article, one of the P addresses of the youtube services is `74.125.68.93`.
It is impractical to remember IP addresses of any target service and address them. In the real world, these IP addresses would change over time more often than how real world addresses change. It would be a nightmare for both the youtube engineers as well as the end user to keep track of this.
It is impractical to remember IP addresses of any target service. In the real world, these IP addresses would change over time more often than how real world addresses change. It would be a nightmare for both the youtube engineers as well as the end user to keep track of this.
Enter the **Domain Name System** or **DNS** for short. DNS solves this problem of remembering arbitrary numbers for addresses to online services by providing it a more memorable **Domain Name** such as `www.youtube.com`. The engineers at youtube can simply say - if you want to search and watch videos, head over to **YouTube** (the name or brand). And hey, you can find YouTube at `www.youtube.com` (the address).
for most people `www.youtube.com` is more memorable than `74.125.68.93`. This also solves the problem of moving IP addresses. When the IP address changes to lets say `74.125.68.100`, we can simply update the domain name system so that the domain name `www.youtube.com` points to the new address. This change is silent and there is no impact on what the end user types in on their browser.
For most people `www.youtube.com` is more memorable than `74.125.68.93`. This also solves the problem of moving IP addresses. When the IP address changes to lets say `74.125.68.100`, we can simply update the domain name system so that the domain name `www.youtube.com` points to the new address. This change is silent and there is no impact on what the end user types in on their browser.
## How does address translation work ?
## I still have some questions
If you've come this far, you should be having a grasp of what a domain name is and know that there is a system called the domain name system that translates the domain names to IP addresses. If you are not content, and If you are curious to know how a domain name system is set up to translates the addresses, read on!
When you open your browser and type in `www.youtube.com`, the browser first negotiates with the domain name system to find out the IP address. This process is called **DNS address resolution**. Once the address is resolved, then the browser establishes a connection and is able to send and receive meaningful data (in this case, watch videos).
@ -44,35 +54,35 @@ It would seem there would be a straight forward process of maintaining a directo
- **Scalability** : There are a lot of websites and querying a single directory can be computationally expensive. If a lot of users are querying to resolve the address of `www.youtube.com`, this can negatively impact other users that are trying to resolve lesser queried domain names such as `www.mysite.com`. The owner of `www.youtube.com` should somehow be help accountable for traffic coming in to the domain name system querying their domain. Sites can also have multiple sub-domains such as `www.blog.mysite.com` so there isn't a strict one to one mapping with a owner of a web site.
- **Security** : Coordinating updates from different domain name owners securely is challenging. For example, I should not update the address of `www.yoursite.com` while I was updating `www.mysite.com`.
- **Conditional resolution** : Often times, a service is hosted in multiple locations (think multiple branches of _Quality Coffee_ setup in different cities so that the brand is more accessible), for a better user experience. The YouTube IP addresses shown above are probably the one on a computer physically closest to my house for better latencies. So the central directory should now keep track of different locations and determine where the lookup request is coming from.
- **Conditional resolution** : Often times, a service is hosted in multiple locations for better user experience (think multiple branches of _Quality Coffee_ setup in different cities so that the brand is more accessible). The YouTube IP addresses shown above are probably the one on a computer physically closest to my house so that my computer has a fast connection to YouTube. So the central directory should now keep track of different locations and determine where the lookup request is coming from.
- **Cost** : Solving any of the above problems would require more money to set up this domain name system directory. More disk space, computing power (to serve domain name queries), power supply, cooling system etc.
## Delegated resolution
### Delegated resolution
Instead of storing all the domain names in a single directory (called a DNS server), there are multiple directories for every sub-domain level. As an example imagine knowledge of a separate DNS server for `mysite.com` that serves all DNS requests that end in `mysite.com`.
- `www.mysite.com`
- `blog.mysite.com`
- `about.mysite.com`
- `potato.chips.mysite.com`
Instead of storing all the domain names in a single directory (called a DNS server), there are multiple DNS servers for every sub-domain level. As an example imagine knowledge of a separate DNS server for `youtube.com` that serves all DNS requests that end in `youtube.com`.
- `www.youtube.com`
- `gaming.youtube.com`
- `about.youtube.com`
- `photography.youtube.com`
This distributes the DNS traffic and it is now up to the owners of the domain name to securely manage and scale their DNS servers.
> But, there is still a problem. How do I figure out what is the DNS server for `mysite.com` ?
> But, there is still a problem. How do I figure out what is the DNS server for `youtube.com` ?
There are a set of reserved suffixes by which a domain name can end. Example `com`, `in`, `us`, `org`, `net`. These are called **Top Level Domains (TLD)**.
Each one of this have their own DNS server operated by an organisation or a country. The owner of `mysite` would set up a DNS server resolving IP addresses of all his sub domains ending in `mysite.com`. Then they would get hold of the operator for the `com` domain and ask them to add a record for `mysite` pointing to a DNS server that he just set up.
Each one of this have their own DNS server operated by an organisation or a country. The owner of `youtube` would set up a DNS server resolving IP addresses of all their sub domains ending in `youtube.com`. Then they would get hold of the operator for the `com` domain and ask them to add a record for `youtube` pointing to a DNS server that they just set up.
> Wait, how do I figure out what is the DNS server for `com` ?
> So if I know the DNS server of `com` I can reach the DNS server for `youtube.com`. But wait, how do I figure out the DNS server for `com` ?
All the top level domains are hosted in another DNS server called the **Root DNS Server**. These are operated by a non-profit [Internet Assigned Numbers Authority](https://en.wikipedia.org/wiki/Internet_Assigned_Numbers_Authority) organization. The list of the root dns servers are hard coded in your computer when you buy it.
Now a typical name resolution works like this
- You enter www.mysite.com on the browser
- You enter `www.youtube.com` on the browser.
- Your browser consults the Root DNS server to find where the `com` DNS server is.
- Your browser consults the `com` DNS server to find out where `mysite` is.
- Your browser consults the `mysite` DNS server to find out where `www.mysite.com` is.
- Your browser consults the `com` DNS server to find out where `youtube` is.
- Your browser consults the `youtube` DNS server to find out where `www.youtube.com` is.
- Your browser gets the IP address and makes a connection to the website.
Notice how the domain name is parsed from right to left - from the more generic to the more specific. If you think about it, this is similar to how we parse location addresses. When you needed to know where _No 4, Coffee Bean Avenue, Roasted County, Coffee Land_ is, you would parse it from right to left as
@ -82,4 +92,4 @@ Notice how the domain name is parsed from right to left - from the more generic
- Find _Coffee Bean Avenue_ inside _Roasted County_.
- Find _No 4_ inside _Coffee Bean Avenue_.
Fin!
If you are still here, you should definitely head over to youtube and listen to [this](https://www.youtube.com/watch?v=L-9s4nTLSdA) and relax.