Skip to content

Commit 68ffda8

Browse files
authored
Merge pull request #63 from codeharborhub/dev-1
Docs: started new docs for Internet Topic
2 parents 719a3f0 + 312e621 commit 68ffda8

18 files changed

+906
-6
lines changed

docs/internet/browser-devtools.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<ComingSoon />

docs/internet/cdn.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<ComingSoon />
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
---
2+
title: "Clients and Servers"
3+
description: "Understand how clients and servers form the backbone of the Internet — how requests and responses flow, what roles each plays, and how they communicate using protocols."
4+
tags: [internet, client-server, networking, web, protocols]
5+
sidebar_label: Clients & Servers
6+
---
7+
8+
The Internet operates on a simple yet powerful concept: **clients and servers**. Every time you browse a website, watch a video, or send an email, your device (the *client*) communicates with another system (the *server*) that provides the requested data or service.
9+
10+
## The Core Idea
11+
12+
Think of the Internet as a giant conversation. Your computer, phone, or browser **asks questions** and servers **reply with answers**.
13+
14+
In this model:
15+
* The **client** initiates communication.
16+
* The **server** listens, processes, and responds.
17+
18+
## What Is a Client?
19+
20+
A **client** is any device or software that requests resources or services from a server.
21+
22+
Common examples:
23+
* Web browsers (like Chrome, Firefox, Edge)
24+
* Mobile apps
25+
* Command-line tools (like `curl` or `wget`)
26+
27+
Clients don’t store the data permanently, they only display or use it temporarily.
28+
29+
```mermaid
30+
graph TD
31+
A[User - Client] -->|Request| B[Server]
32+
B -->|Response| A
33+
```
34+
35+
## What Is a Server?
36+
37+
A **server** is a system (computer or application) that **stores**, **manages**, and **serves** data to clients over a network. It runs specialized software like:
38+
* **Web servers** (e.g., Apache, Nginx)
39+
* **Database servers** (e.g., MySQL, MongoDB)
40+
* **Mail servers** (e.g., Postfix)
41+
42+
Servers are designed for **reliability** and **availability**, often running 24/7 in data centers.
43+
44+
## How Clients and Servers Communicate
45+
46+
Communication follows a **request-response model**, using **protocols** such as HTTP or HTTPS.
47+
48+
1. The client sends a **request** to a server.
49+
2. The server **processes** the request.
50+
3. The server sends a **response** (like an HTML page or JSON data).
51+
52+
Here’s a simplified example:
53+
54+
```http
55+
GET /home HTTP/1.1
56+
Host: codeharborhub.github.io
57+
```
58+
59+
The server replies:
60+
61+
```http
62+
HTTP/1.1 200 OK
63+
Content-Type: text/html
64+
65+
<html>
66+
<body>Welcome to CodeHarborHub!</body>
67+
</html>
68+
```
69+
70+
## Real-World Example
71+
72+
When you visit **https://codeharborhub.github.io**:
73+
* Your browser (the client) sends a request.
74+
* GitHub Pages (the server) finds and returns the website files.
75+
* The browser displays them on your screen.
76+
77+
You never directly see the server, but every webpage you view comes from one.
78+
79+
## Types of Client–Server Architecture
80+
81+
| Type | Description | Example |
82+
|------|--------------|----------|
83+
| **1-Tier** | Client and server on the same machine | Local software like MS Word |
84+
| **2-Tier** | Direct client-server communication | Web browser ↔ Web server |
85+
| **3-Tier** | Includes a database layer | Browser ↔ App server ↔ Database |
86+
| **N-Tier** | Distributed services and APIs | Modern cloud-based systems |
87+
88+
## Security & HTTPS
89+
90+
When data travels between client and server, security is essential. With **HTTPS**, information is encrypted using **SSL/TLS**, preventing eavesdropping and tampering.
91+
92+
```mermaid
93+
sequenceDiagram
94+
participant Client
95+
participant Server
96+
Client->>Server: Request (HTTPS)
97+
Server-->>Client: Response (Encrypted)
98+
```
99+
100+
## Key Takeaways
101+
102+
* **Clients** request data or services.
103+
* **Servers** store and deliver that data.
104+
* They communicate through **standard protocols** (HTTP, HTTPS, FTP, etc.).
105+
* The **request–response model** is at the heart of how the Internet works.
106+
* Modern systems often involve **multiple servers and APIs** behind the scenes.
107+
108+
109+
> “Every click, every page, every message you send, is just one client talking to one server somewhere in the world.”

docs/internet/dns.mdx

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
---
2+
title: "Domain Name System (DNS)"
3+
description: "Explore the Domain Name System (DNS) — the backbone of the Internet that translates human-readable names into IP addresses. Learn its structure, types of records, and how the DNS resolution process works."
4+
tags: [dns, networking, internet, domain, ip, infrastructure]
5+
sidebar_label: DNS
6+
---
7+
8+
The **Domain Name System (DNS)** is one of the most essential — yet often overlooked components of the Internet. It’s what allows us to use memorable names like `codeharborhub.github.io` instead of complex numerical IP addresses.
9+
10+
DNS acts as the **Internet’s phonebook**, translating **domain names** into **IP addresses** so browsers can locate and communicate with servers worldwide.
11+
12+
## Why DNS Exists
13+
14+
Computers communicate using numbers (IP addresses), not words. Before DNS, users had to manually look up and remember numeric addresses — an unscalable and error-prone process.
15+
16+
DNS was created to solve this by introducing a **distributed, hierarchical naming system** that’s:
17+
* **Human-friendly**: You type names, not numbers.
18+
* **Scalable**: Works across billions of domains.
19+
* **Automatic**: Queries happen invisibly in milliseconds.
20+
21+
## DNS Hierarchy Overview
22+
23+
The DNS system is hierarchical, like a tree:
24+
25+
```mermaid
26+
graph TD
27+
A[Root Zone - .] --> B[Top-Level Domains - .com, .org, .io]
28+
B --> C[Second-Level Domains - example.com]
29+
C --> D[Subdomains - blog.example.com]
30+
D --> E[Hostnames - www, mail]
31+
```
32+
33+
Each level plays a specific role in locating resources on the Internet.
34+
35+
## How a DNS Query Works (Step-by-Step)
36+
37+
When you enter a URL such as **https://codeharborhub.github.io**, your browser performs several steps to find its IP address:
38+
39+
```mermaid
40+
sequenceDiagram
41+
participant User
42+
participant Browser
43+
participant Resolver
44+
participant RootServer
45+
participant TLDServer
46+
participant AuthoritativeServer
47+
48+
User->>Browser: Enter codeharborhub.github.io
49+
Browser->>Resolver: Request IP address
50+
Resolver->>RootServer: Ask for .io TLD info
51+
RootServer-->>Resolver: Return .io TLD name servers
52+
Resolver->>TLDServer: Ask for github.io info
53+
TLDServer-->>Resolver: Return authoritative server
54+
Resolver->>AuthoritativeServer: Ask for codeharborhub.github.io
55+
AuthoritativeServer-->>Resolver: Return IP address
56+
Resolver-->>Browser: 185.199.108.153
57+
Browser->>185.199.108.153: Send HTTP Request
58+
```
59+
60+
All this happens in a fraction of a second.
61+
62+
## The Four Key DNS Server Types
63+
64+
| Server Type | Description |
65+
|--------------|--------------|
66+
| **DNS Resolver (Recursive Resolver)** | Usually provided by your ISP or a public DNS service (like Google `8.8.8.8`). It initiates and manages DNS lookups on your behalf. |
67+
| **Root Name Server** | The top-level of DNS — knows where to find TLD servers (like `.com`, `.io`, `.net`). |
68+
| **TLD Name Server** | Stores information about domains under a specific top-level domain. |
69+
| **Authoritative Name Server** | The final authority — provides the actual IP address for a domain. |
70+
71+
## Common DNS Record Types
72+
73+
DNS uses **resource records (RRs)** to store information. Each type serves a specific purpose:
74+
75+
| Record Type | Description | Example |
76+
|--------------|--------------|----------|
77+
| **A** | Maps a domain to an IPv4 address. | `codeharborhub.github.io → 185.199.108.153` |
78+
| **AAAA** | Maps a domain to an IPv6 address. | `example.com → 2606:2800:220:1:248:1893:25c8:1946` |
79+
| **CNAME** | Alias for another domain name. | `www.example.com → example.com` |
80+
| **MX** | Mail server record (used for email routing). | `example.com → mail.example.com` |
81+
| **TXT** | Stores arbitrary text info (SPF, DKIM, verification). | `v=spf1 include:_spf.google.com ~all` |
82+
| **NS** | Identifies the authoritative name servers for a domain. | `example.com → ns1.example.net` |
83+
84+
## DNS Caching — Speed Optimization
85+
86+
To reduce lookup time and network load, DNS results are **cached** at multiple levels:
87+
* **Browser Cache** – Short-term memory for recently visited domains.
88+
* **Operating System Cache** – Local DNS records stored temporarily.
89+
* **Resolver Cache** – Managed by ISPs or public DNS resolvers.
90+
91+
Each record has a **TTL (Time To Live)** that defines how long it stays valid before a recheck.
92+
93+
## Practical Example — DNS Lookup Flow
94+
95+
<Tabs>
96+
<TabItem value="nontechnical" label="Simple View" default>
97+
You type `codeharborhub.github.io` → DNS finds its IP → Browser connects → Website loads.
98+
It’s that simple — all automatic.
99+
</TabItem>
100+
<TabItem value="technical" label="Technical Flow">
101+
1. The browser checks its cache.
102+
2. If not found, it asks the **local resolver**.
103+
3. The resolver queries **root**, **TLD**, and **authoritative** servers.
104+
4. The IP is returned and cached.
105+
5. The browser sends the HTTP request to that IP.
106+
</TabItem>
107+
</Tabs>
108+
109+
## DNS in Action — Simulation
110+
111+
```jsx live
112+
function DnsDemo() {
113+
const [resolved, setResolved] = React.useState(false);
114+
const resolve = () => setResolved(true);
115+
116+
return (
117+
<div style={{ textAlign: "center" }}>
118+
<h3>DNS Resolution Simulation</h3>
119+
<p>Domain: codeharborhub.github.io</p>
120+
<button onClick={resolve}>Resolve Domain</button>
121+
{resolved && <p> IP Address: 185.199.108.153</p>}
122+
</div>
123+
);
124+
}
125+
```
126+
127+
## Security in DNS
128+
129+
DNS was designed for speed and reliability — not security. Attackers exploit this through methods like:
130+
131+
* **DNS Spoofing / Cache Poisoning:** Injecting false IP mappings.
132+
* **DNS Hijacking:** Redirecting users to malicious servers.
133+
* **Amplification Attacks:** Overloading DNS servers to cause downtime.
134+
135+
To counter these, **DNSSEC (Domain Name System Security Extensions)** was introduced. It digitally signs DNS data, ensuring authenticity and integrity.
136+
137+
## Key Takeaways
138+
139+
* DNS is the **Internet’s distributed naming system** that maps domain names to IP addresses.
140+
* The DNS hierarchy consists of **Root**, **TLD**, and **Authoritative** servers.
141+
* DNS uses various **record types** (A, AAAA, CNAME, MX, TXT) to manage different data.
142+
* **Caching** makes DNS fast, while **DNSSEC** makes it secure.
143+
* Every click, website, or API request starts with a DNS lookup — it’s the silent foundation of the web.
144+
145+
:::tip
146+
Learn about [IP Addressing](./ip-addresses.mdx) — the numerical system that identifies every device on the Internet.
147+
:::

docs/internet/firewalls.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<ComingSoon />

0 commit comments

Comments
 (0)