Published on 2024-09-01
NetworkingIt's always a good time to go back to the basic. Simplicity at its best.
IP Address (for example: 185.4.123.53) is too cumbersome for people to remember, hence, a domain name is born. A domain name is a unique name that identifies an internet resource. for example, google.com is a domain name. Behind this domain name, there is an Internet Protocol Address, a numerical label assigned to each device connected to a computer network. 192.168.1.1 is a typical private IP address used in home networks (often the default for routers). There are two types of Internet Protocol: IPv4: Consists of four sets of numbers (0-255), separated by periods (e.g., 192.168.1.1). IPv6: Consists of eight groups of hexadecimal numbers (0-9, a-f), separated by colons (e.g., 2001:0db8:85a3::7334). IPv6 was developed to address the limitation of IPv4's address space, as the internet has grown massively.
DNS, known as Domain Name System, manages the domain name and its relevant IP Addresses stored in the DNS Server. The most important aspect of DNS Servers is the translation of domain names and hostnames into the corresponding numeric internet protocol (IP). We can think of a DNS server (machine) as the phone book of the internet. When we want to go to a site name 'boring-is-good.com', Internet Service Provider (ISP) provider looks it up in the DNS server and DNS server returns the IP Address of the site.
User (boring-is-good.com?) <---> Browser (boring-is-good.com?) <---> modern (boring-is-good.com?) <---> ISP (boring-is-good.com?, TTL: in seconds) <> DNS Server (boring-is-good.com is xxx.x.xxx.xx).
By the way, TTL is time to live.
Then, the user is redirected to xxx.x.xxx.xx which is an origin server who will serve the code for the web to function. In the web, there are dynamic and static contents. Example of static contents are images, CSS file, videos, etc. These contents do not interact with users. Therefore, these static contents are, most of the time, hosted in CDN (Content Distributed network) also known as Edge Server or caching server, in order to reduce the latency to load the web page when the original server locates far away from the requester (the requester is routed to CDN closer to their location).
Back to DNS, in DNS Servers, there are different types of record. We can think of them as tags. NS Record = nameservers - they tell ISP where to find the DNS records for the domain. When we buy a domain name with domain name provider (domain registrar), NS Records will be auto-created by the registrar, they are known as Default Name Servers. The name server checks its DNS records (e.g., A records, MX records) to find the IP address or relevant information. A Record = a 32-bit IPv4 address, most commonly used to map hostname to an IP address of the host and it’s marked with “A”. For IPv6 address, its is marked with “AAAA”. CNAME record = A Canonical Name record is a type of resource record in the Domain Name System that maps one domain name to another. In laymen term, it’s an alias of a domain name. It is used to mask the original domain name. MX Records = it maps a domain name to a list of message transfer agents (Mail eXchange machines) for that domain. Basically, mx record provides the mail exchange servers that a domain name is pointing to. So, the machine knows which mail exchange server to use to send the mail. TXT Record = it is now a text description of domain name. We now use TXT Record for email spam prevention an domain ownership verification though it was not designed for these uses originally. How? So, there are three TXT Record type: SPF (sender Policy Framework), DKIM (Domain Keys Identified Mail), DMARC (Domain-based Message Authentication, Reporting & Conformance). And many more.
In order to query about a domain name, in the terminal, we can issue
whois boring-is-good.com
From there, ISP knows in which nameserver, to look up the domain name. For boring-is-good.com, the response is (some parts are redacted/removed):
Domain Name: boring-is-good.com
Registry Domain ID: 2751430619_DOMAIN_COM-VRSN
Registrar WHOIS Server: whois.registrar.amazon
Registrar URL: https://registrar.amazon.com
Updated Date: 2024-09-08T18:38:08Z
Creation Date: 2023-01-14T20:16:59Z
Registrar Registration Expiration Date: 2025-01-14T20:16:59Z
Registrar: Amazon Registrar, Inc.
Registrar IANA ID: 468
Registrar Abuse Contact Email: xxx
Registrar Abuse Contact Phone: xxx
Domain Status: ok https://icann.org/epp#ok
Registry Registrant ID: Not Available From Registry
Registry Admin ID: Not Available From Registry
Admin Name: On behalf of boring-is-good.com owner
Admin Organization: Identity Protection Service
Registry Tech ID: Not Available From Registry
Tech Name: On behalf of boring-is-good.com owner
Tech Organization: Identity Protection Service
Name Server: NS-1512.AWSDNS-61.ORG
Name Server: NS-1840.AWSDNS-38.CO.UK
Name Server: NS-940.AWSDNS-53.NET
Name Server: NS-449.AWSDNS-56.COM
DNSSEC: xxx
URL of the ICANN WHOIS Data Problem Reporting System: http://wdprs.internic.net/
Is it possible to change the default nameserver? Of course, there are third-party DNS providers like Cloudflare, we just need to update the domain’s name servers to point to those services. ☕️