❓ What is DNS?
DNS stands for Domain Name System, which is used to translate the human-readable domain names (like google.com) into IP addresses (like 192.168.1.1) and render the response back to the browser.
❓ Why Do We Need DNS?
Why we need this translation? Why can’t we reach out directly using google.com?
We need FQDN to reach out address or server , each server will have unique IP address and When we try to reach any server via internet we should use this IP address.
Problem: It’s impossible to remember all IP addresses for all websites and moreover these IP addresses keep changing right. So for this reason we use DNS on top of server to resolve corresponding IP address.
❓ How Does DNS Work?
Domain Name Resolution: When you enter a domain name (ex: www.thecloudopscommunity.org) in your web browser, your device first checks its local DNS cache to see if the IP address is already known. If not, it sends a request to a DNS server.
DNS Server Lookup: The DNS server then searches its own database to find the corresponding IP address for the requested domain name. If the DNS server doesn't have the information, it will forward the request to higher-level DNS servers until the IP address is found.
Response Delivery: Once the IP address is located, the response is sent back to the device allowing it to establish a connection with the web server and retrieve the content.
✴ Issues:
What if we have billions of load requests to handle one DNS server ?
Solution: Implement caching for optimal performance and reduced latency. This can involve multi-level caching, like:
DNS Caching: Stores recent DNS queries to avoid repeated lookups.
Browser-Level Caching: Browsers retain DNS information for previously visited sites, reducing the need for repeated DNS lookups.
Router-Level Caching: Routers can cache DNS queries to serve multiple devices without contacting DNS servers each time.
ISP Caching: Internet Service Providers can cache DNS records, improving response times for their customers.
Example of DNS Caching
When accessing a new website, the browser performs a DNS lookup to resolve the server's IP address. After the initial lookup, refreshing the page does not trigger another DNS query, as the browser retrieves the IP address from its cache. This behaviour explains browser-level caching.
✴ DNS Redundancy and Reliability
To ensure high availability and reliability, the DNS system is designed with redundancy:
Root Name Servers: There are 13 root name servers that serve as the starting point for all DNS queries. These servers are owned and operated by various organizations to provide a decentralized and resilient system.
Top-Level Domain (TLD) Servers: TLD servers are responsible for managing the top-level domains (ex: .com, .org, .net) and directing queries to the appropriate authoritative name servers.
Authoritative Name Servers: These servers hold the actual records for a specific domain and provide the final answer to DNS queries.
Each Root name server expose at 1 IP address but can resolve to different DNS servers, meaning internally have more servers but advertised to the same IP address (these 13 Root DNS server will act as a load balancer and balanced the load to the backend DNS servers ).
✴ DNS Record Types
Common DNS Record Types
When managing DNS settings, we will encounter various types of DNS records. Here are some of the most common ones:
A Record: Maps a domain name to an IPv4 address.
AAAA Record: Maps a domain name to an IPv6 address.
CNAME Record: Creates an alias, allowing one domain name to point to another domain name.
TXT Record: Stores text-based information(Human readable), often used for domain verification or email authentication.
NS Record: Specifies the authoritative name servers for a domain.
MX Record: Defines the mail server responsible for accepting email messages for a domain.
Troubleshooting DNS Issues
When facing DNS-related problems, we can use the following troubleshooting steps:
Checking Local DNS Configuration
Linux/macOS:Look at the
/etc/hosts
file, which has local DNS records. If there's an A record in this file, the browser will resolve the domain to the specified IP address by default.DNS Configuration File: On Linux/macOS systems, the
/etc/resolv.conf
file contains the DNS server settings, indicating which DNS server is used for name resolution.Popular DNS Servers: Some well-known public DNS servers include Cloudflare (1.1.1.1) and Google DNS (8.8.8.8).
nslookup: A command-line tool that allows you to perform manual DNS lookups and troubleshoot DNS-related issues.
In some cases, you may want to resolve DNS queries locally without going over the public internet. To do this, you can configure your system to use a local DNS server instead of the default DNS provided by your network or ISP.
#Kubernetes #DNS #NameServer #DNSrecords #40DaysofKubernetes #CKASeries