dns - dwilson2547/wiki_demo GitHub Wiki
The Domain Name System (DNS) is a hierarchical, decentralized naming system that translates human-readable domain names (e.g., example.com
) into machine-readable IP addresses (e.g., 192.0.2.1
). It is a critical component of the internet, enabling users to access websites and services without memorizing numeric IP addresses.
- Resolution: Converts domain names to IP addresses (and vice versa).
-
Hierarchy: Organized in a tree-like structure with multiple levels:
- Root DNS Servers: Direct queries to top-level domains (TLDs).
-
TLD Servers: Manage domains like
.com
,.org
,.net
. -
Authoritative Servers: Store records for specific domains (e.g.,
google.com
). - Recursive Resolvers: Cache and return IP addresses to clients.
-
User Request: You type
example.com
in a browser. -
Recursive Resolver Query: Your ISP or a public DNS (e.g., Google DNS
8.8.8.8
) checks its cache. - Root Server Query: If not cached, the resolver queries a root server.
-
TLD Server Query: The root server refers the resolver to the
.com
TLD server. -
Authoritative Server Query: The TLD server refers the resolver to
example.com
's authoritative server. -
IP Address Returned: The authoritative server returns the IP address for
example.com
. - Response to User: The resolver caches the result and sends the IP to your device.
Record Type | Purpose | Example |
---|---|---|
A | Maps domain to IPv4 address | example.com → 192.0.2.1 |
AAAA | Maps domain to IPv6 address | example.com → 2001:0db8::1 |
CNAME | Alias for another domain | www.example.com → example.com |
MX | Mail server for the domain | example.com → mail.example.com |
TXT | Text records (e.g., SPF, DKIM) | example.com → "v=spf1 ..." |
NS | Authoritative name servers | example.com → ns1.example-dns.com |
SOA | Start of Authority (zone info) | example.com → ns1.example.com |
PTR | Reverse DNS (IP to domain) | 192.0.2.1 → example.com |
- A loopback address allows a device to send network traffic to itself.
- Used for testing and development without needing a physical network.
-
Address:
127.0.0.1
-
Hostname: Typically
localhost
. -
Purpose:
- Test network applications locally.
- Debug client-server applications.
- Bypass network hardware (e.g., testing web servers).
-
Address:
::1
(shorthand for0000:0000:0000:0000:0000:0000:0000:0001
). - Function: Same as IPv4 loopback but for IPv6.
- When you ping
127.0.0.1
orlocalhost
, the traffic never leaves your device. - The operating system routes it internally.
-
DNS:
- Enables user-friendly navigation of the internet.
- Supports load balancing, redundancy, and geolocation.
-
Loopback:
- Essential for developers to test applications locally.
- Used in
/etc/hosts
files to override DNS for testing.
-
nslookup
: Query DNS records from the command line.nslookup example.com
-
dig
: Advanced DNS querying (Linux/macOS)dig example.com MX
-
ping
: Test connectivity to a domain or loopback.ping 127.0.0.1
-
Flush DNS Cache
:- Windows: ipconfig /flushdns
- macOS/Linux: sudo dscacheutil -flushcache or sudo systemd-resolve --flush-caches
-
Check DNS Settings
: Ensure your device uses valid DNS servers (e.g., 8.8.8.8, 1.1.1.1). -
Test Connectivity
:ping google.com