From 5ee1e3e800b39141672de44759ef2e0b5d748761 Mon Sep 17 00:00:00 2001 From: Ajay Dhangar Date: Thu, 30 Oct 2025 09:18:10 +0530 Subject: [PATCH] Docs: updated --- docs/internet/cdn.mdx | 151 ++++++++++++++++++++++++- docs/internet/firewalls.mdx | 153 +++++++++++++++++++++++++- docs/internet/routing-and-packets.mdx | 129 +++++++++++++++++++++- docs/internet/security-basics.mdx | 121 +++++++++++++++++++- docs/internet/tcp-ip-model.mdx | 122 +++++++++++++++++++- 5 files changed, 671 insertions(+), 5 deletions(-) diff --git a/docs/internet/cdn.mdx b/docs/internet/cdn.mdx index e345ed2..6bcc4e5 100644 --- a/docs/internet/cdn.mdx +++ b/docs/internet/cdn.mdx @@ -1 +1,150 @@ - \ No newline at end of file +--- +title: "Understanding CDNs (Content Delivery Networks)" +description: "Learn how CDNs make websites faster, more reliable, and globally accessible by caching and delivering content from distributed servers close to users." +tags: [cdn, performance, caching, networking, internet, web, optimization] +sidebar_label: CDN +--- + +Modern websites and apps serve millions of users worldwide but sending data directly from one central server to everyone would be slow and inefficient. That’s where **CDNs (Content Delivery Networks)** come in. + +A **CDN** is a distributed network of servers located across the globe that **deliver content faster** by caching it closer to users. + +## What Is a CDN? + +A **Content Delivery Network (CDN)** is a group of geographically distributed servers that work together to deliver web content such as images, videos, CSS, JavaScript, and HTML pages to users based on their location. + +Instead of fetching data from your website’s origin server every time, a CDN stores (or *caches*) copies of static files on its **edge servers** around the world. + +```mermaid +graph TD + A[User in India] --> B[Nearest Edge Server - Mumbai] + B --> C[Origin Server - USA] + A2[User in France] --> D[Nearest Edge Server - Paris] + D --> C + C -->|Updates Cached Data| B + C -->|Updates Cached Data| D +``` + +> The closer the user is to the CDN edge server, the faster the content loads. + +## How a CDN Works + + + + A CDN keeps cached copies of your website’s files on global servers. + When a user visits your site, they automatically connect to the **closest** CDN node, reducing latency and improving speed. + + + 1. User requests a file (e.g., `index.html`). + 2. DNS redirects the request to the **nearest CDN edge node**. + 3. The edge server checks if it has a **cached copy** of the resource. + 4. If cached, it serves the file directly (cache hit). + 5. If not cached, it fetches it from the **origin server**, caches it, and serves it to the user (cache miss). + 6. The process repeats for users worldwide. + + + +## CDN Example (Simulation) + +```jsx live +function CDNExample() { + const handleRequest = (cached) => { + alert(cached ? "Served from CDN Edge (Cache Hit)" : "Fetched from Origin Server (Cache Miss)"); + }; + + return ( +
+

CDN Request Simulation

+ + +
+ ); +} +``` + +## Components of a CDN + +| Component | Description | +| ---------- | ------------ | +| **Origin Server** | The main server where the original content is hosted. | +| **Edge Server (PoP)** | CDN data centers close to users that cache content for faster delivery. | +| **Cache** | Stored version of website files to avoid repeated requests to the origin. | +| **DNS Routing** | Directs user requests to the nearest CDN node. | +| **Load Balancer** | Distributes traffic efficiently between servers. | + +## Example Flow: How a CDN Delivers a Web Page + +```mermaid +sequenceDiagram + participant U as User Browser + participant D as DNS Resolver + participant E as CDN Edge Server + participant O as Origin Server + + U->>D: Request website (www.example.com) + D-->>U: Resolve to nearest CDN Edge (Mumbai) + U->>E: Request content + E-->>U: Serve from Cache (if available) + E->>O: Fetch new content (if cache miss) + O-->>E: Send original content + E-->>U: Deliver optimized response +``` + +## Benefits of Using a CDN + +| Benefit | Description | +| -------- | ------------ | +| **Faster Load Times** | Users connect to nearby servers, reducing latency. | +| **Scalability** | Handles massive traffic loads without downtime. | +| **Reliability** | Multiple edge servers ensure uptime even if one fails. | +| **Security** | Protects against DDoS attacks and provides SSL/TLS encryption. | +| **Cost Efficiency** | Reduces bandwidth usage and load on origin servers. | + +## Performance Impact (Example) + +If your site’s origin is in the USA and a visitor from India requests it: + +| Delivery Type | Latency | Load Time | User Experience | +| -------------- | -------- | ---------- | ---------------- | +| **Without CDN** | 250 ms | 3.5s | Slow, laggy | +| **With CDN (India Edge)** | 45 ms | 1.2s | Fast, smooth | + +That’s nearly **3x faster**, thanks to edge caching. + +## CDN Caching Strategies + +| Strategy | Description | +| ---------- | ------------ | +| **Time-to-Live (TTL)** | Defines how long an asset stays cached before refresh. | +| **Cache Invalidation** | Removes outdated content from CDN nodes. | +| **Stale-while-revalidate** | Serves old content while fetching fresh data in the background. | + +> Example: Cloudflare and Akamai use *smart caching* to automatically refresh only changed files. + +## CDN and Security + +Modern CDNs not only improve performance — they also **protect websites**. + +### Built-in Security Features + +* **DDoS Protection** – Blocks malicious traffic before it reaches the origin. +* **WAF (Web Application Firewall)** – Filters harmful requests. +* **TLS/SSL Termination** – Ensures encrypted data transfer. +* **Bot Management** – Detects and mitigates automated attacks. + +## Popular CDN Providers + +| Provider | Description | +| --------- | ------------ | +| **Cloudflare** | Offers global caching, security, and edge compute features. | +| **Akamai** | One of the oldest and largest CDN providers. | +| **AWS CloudFront** | Integrated with Amazon Web Services. | +| **Fastly** | Known for real-time caching and edge logic. | +| **Google Cloud CDN** | Delivers content via Google’s backbone network. | + +## Key Takeaways + +* A **CDN** distributes your website’s content to servers closer to users, drastically improving performance. +* It reduces **latency**, **bandwidth usage**, and **server load**. +* CDNs use **edge caching** and **routing intelligence** to deliver fast, reliable, and secure content. +* For global applications, CDNs are **essential for scalability and user experience**. \ No newline at end of file diff --git a/docs/internet/firewalls.mdx b/docs/internet/firewalls.mdx index e345ed2..8942efa 100644 --- a/docs/internet/firewalls.mdx +++ b/docs/internet/firewalls.mdx @@ -1 +1,152 @@ - \ No newline at end of file +--- +title: "Understanding Firewalls" +description: "Learn what firewalls are, how they protect networks from unauthorized access, and explore the different types of firewalls used in modern Internet security." +tags: [firewall, security, networking, internet, protection, cybersecurity] +sidebar_label: Firewalls +--- + +The Internet is a powerful and open system but that openness also creates risks. To keep networks secure, we rely on **firewalls**, the first line of defense against unwanted traffic, hackers, and cyberattacks. + +## What Is a Firewall? + +A **firewall** is a **security barrier** that monitors and controls incoming and outgoing network traffic based on a set of rules. It acts as a **filter between trusted and untrusted networks**, such as between your computer and the Internet. + +:::info +Think of a firewall as a security guard at the entrance of a building, checking IDs and only allowing authorized personnel to enter. + +In simple terms, firewalls help ensure that only safe and approved data can pass through to your network. +::: + +```mermaid +graph LR + A[Internet] -->|Allowed Traffic| B(Firewall) + B -->|Filtered & Safe| C[Internal Network] + A -.->|Blocked Traffic| B +``` + +## How Firewalls Work + +Firewalls inspect **data packets** as they travel across networks. Each packet is analyzed against **security rules**, such as: + +* Source and destination IP addresses +* Port numbers +* Protocols (HTTP, HTTPS, FTP, etc.) +* Packet contents (in advanced firewalls) + + + + A basic firewall might allow web traffic (port 80/443) but block suspicious connections or file transfers on other ports. + + + 1. Packet enters the firewall. + 2. Firewall checks **header information** (source, destination, port). + 3. Rules are applied — e.g., “block all incoming SSH except from admin IPs.” + 4. Packet is either **allowed**, **blocked**, or **logged** for review. + + + +## Example: Simple Firewall Simulation + +```jsx live +function FirewallSimulator() { + const handleRequest = (type) => { + if (type === "http") alert("Allowed: Web traffic (Port 443)"); + else alert("Blocked: Unauthorized traffic (Port 23)"); + }; + return ( +
+

Firewall Traffic Filter

+ + +
+ ); +} +``` + +## Types of Firewalls + +Firewalls can operate at different layers of the network stack and offer varying levels of security: + +| Type | Layer | Description | +|------|--------|-------------| +| **Packet-Filtering Firewall** | Network | Checks basic info like IPs and ports; fast but limited. | +| **Stateful Inspection Firewall** | Transport | Tracks active connections and allows related packets. | +| **Proxy Firewall** | Application | Intercepts and inspects data at the application layer (HTTP, FTP). | +| **Next-Generation Firewall (NGFW)** | Multiple | Includes intrusion detection, malware filtering, and deep inspection. | +| **Cloud Firewall (FWaaS)** | Cloud | Firewall-as-a-Service — protects cloud apps and virtual networks. | + +```mermaid +graph TD + A[Packet Filtering] --> B[Stateful Inspection] + B --> C[Proxy Firewall] + C --> D[Next-Gen Firewall] + D --> E[Cloud Firewall] +``` + +## Firewall Rules Example + +| Rule | Action | Description | +|------|---------|-------------| +| Allow TCP port 443 | Allow | Enable secure web browsing (HTTPS). | +| Block TCP port 23 | Block | Disable Telnet — an insecure protocol. | +| Allow ICMP from internal network | Allow | Permit internal ping requests. | +| Block all inbound traffic by default | Block | Enforce a default-deny security posture. | + +```bash +# Example Linux UFW firewall commands +sudo ufw default deny incoming +sudo ufw allow 443/tcp +sudo ufw deny 23/tcp +sudo ufw enable +``` + +## Network Placement of Firewalls + +Firewalls can exist in multiple forms hardware, software, or cloud-based — and are typically placed between the **LAN** and **Internet**. In a typical home or office setup: + +```mermaid +graph LR + A[Internet] --> B[Firewall] + B --> C[Router] + C --> D[Local Network - Devices] +``` + +Some organizations use multiple layers of firewalls **perimeter firewalls** at the network edge and **internal firewalls** between departments or services. + +## Stateful vs Stateless Firewalls + +| Feature | Stateless Firewall | Stateful Firewall | +|----------|-------------------|-------------------| +| Tracks connections | No | Yes | +| Security level | Basic | High | +| Performance | Fast | Slightly slower | +| Use case | Simple traffic filtering | Complex enterprise networks | + +:::note +Stateful firewalls are generally preferred for modern networks due to their ability to monitor ongoing connections and provide enhanced security. +::: + +## Firewall Limitations + +While firewalls are powerful, they aren’t a complete solution on their own. + +* Cannot detect **internal threats** or **phishing attacks**. +* May slow down traffic if poorly configured. +* Need **regular updates** to remain effective. +* Must be combined with antivirus, intrusion detection, and monitoring tools. + +## Real-World Examples of Firewalls + +| Vendor | Product | Highlights | +|--------|----------|------------| +| **Cisco ASA** | Enterprise Firewall | Hardware-based security with advanced inspection. | +| **Fortinet FortiGate** | Unified Threat Management | Combines firewall, VPN, and intrusion prevention. | +| **Palo Alto Networks NGFW** | Next-Gen Firewall | Application-level inspection with ML-driven threat detection. | +| **Cloudflare WAF** | Cloud Firewall | Protects websites from online attacks at the edge. | + +## Key Takeaways + +* A **firewall** is a traffic filter that protects your system from unauthorized access. +* It uses predefined **rules** to allow or block network traffic. +* Modern **Next-Gen Firewalls** combine inspection, intrusion prevention, and threat intelligence. +* Firewalls are essential for **network security**, but should be part of a **multi-layered defense strategy**. \ No newline at end of file diff --git a/docs/internet/routing-and-packets.mdx b/docs/internet/routing-and-packets.mdx index e345ed2..92cf504 100644 --- a/docs/internet/routing-and-packets.mdx +++ b/docs/internet/routing-and-packets.mdx @@ -1 +1,128 @@ - \ No newline at end of file +--- +title: "Routing and Packets Explained" +description: "Understand how data moves across the Internet through packets and routers. Learn how routing works, how packets are delivered, and why this system keeps the Internet fast and reliable." +tags: [routing, packets, ip, networking, internet, routers] +sidebar_label: Routing & Packets +--- + +Data on the Internet travels in small units called **packets**. These packets are like digital envelopes that carry pieces of information from one device to another. The process of sending these packets across networks is known as **routing**. Routing ensures that packets find the best path to their destination, allowing for efficient and reliable communication across the vast expanse of the Internet. + +## What Are Packets? + +**Packets** are small chunks of data that are transmitted over a network. When you send an email, browse a website, or stream a video, the information is broken down into these packets. + +### Packet Structure + +Each packet typically contains: + +| Component | Description | +|------------------|--------------------------------------------------| +| Header | Contains metadata such as source and destination IP addresses, packet number, and protocol information. | +| Payload | The actual data being transmitted (e.g., part of an email or webpage). | +| Footer | Contains error-checking information to ensure data integrity. | + +```mermaid +graph LR + A[Header - Source, Destination, Protocol] --> B[Payload - Data] + B --> C[Footer - Checksum, Control] +``` + +Packets allow large amounts of data to be sent efficiently by breaking it into manageable pieces. This also helps in error detection and correction, as only the affected packets need to be resent if there’s an issue during transmission. + +## How Routing Works + +**Routing** is the process of determining the best path for packets to travel from their source to their destination. This is done by devices called **routers**, which are specialized computers that direct traffic on the Internet. + +Each packets may travel through **multiple routers**, which act like digital post offices, forwarding packets based on their destination IP addresses. Routers use routing tables and protocols to decide the most efficient path for each packet. + +Now let’s look at a simplified example of how a packet travels from your device to a web server: + +```mermaid +graph LR + A[Your Device] --> B[Local Router] + B --> C[ISP Router] + C --> D[Regional Network] + D --> E[Internet Backbone Router] + E --> F[Destination Server] +``` + +In this example: + +1. **Your Device**: When you request a webpage, your device creates packets containing the request data. +2. **Local Router**: The packets are sent to your local router, which forwards them +3. **ISP Router**: The local router sends the packets to your Internet Service Provider (ISP) router. +4. **Regional Network**: The ISP router forwards the packets through regional networks. +5. **Internet Backbone Router**: The packets reach the Internet backbone, where they are routed through high-capacity networks. +6. **Destination Server**: Finally, the packets arrive at the destination server, which processes the request and sends back the requested data in packets. + +## How Routers Decide the Path + +Routers use various algorithms and protocols to determine the best path for packets. Routers use **routing tables** that contain information about the network topology and the best routes to different IP addresses. They also use **routing protocols** to share information with other routers and update their routing tables. + +### Common Routing Protocols + +| Protocol | Type | Purpose | +| --------- | ---- | -------- | +| **RIP (Routing Information Protocol)** | Interior | Uses hop count to determine path | +| **OSPF (Open Shortest Path First)** | Interior | Chooses the fastest route based on link cost | +| **BGP (Border Gateway Protocol)** | Exterior | Manages routing between large networks (ISPs) | + +:::info +**BGP** is what keeps the global Internet connected. It allows different ISPs to exchange routing information, ensuring that packets can travel across various networks worldwide. +::: + +## Example: Visiting a Website + +When you visit **https://codeharborhub.github.io**, here’s what happens behind the scenes: + +1. Your browser sends a request to your **router**. +2. The router forwards it to your **ISP** (Internet Service Provider). +3. The ISP routes packets through various **networks and routers**. +4. Each router uses **IP headers** to forward packets toward the destination. +5. The server receives all packets and **reassembles** them into the webpage. + +```mermaid +sequenceDiagram + participant C as Client + participant R1 as Local Router + participant R2 as ISP Router + participant I as Internet Backbone + participant S as Server + C->>R1: Send Packets + R1->>R2: Forward Based on IP + R2->>I: Route via BGP + I->>S: Deliver Packets + S-->>C: Response Packets Reassembled +``` + +## Packet Fragmentation and Reassembly + +Sometimes, networks have limits on how large a packet can be (called the **MTU — Maximum Transmission Unit**). If a packet is too large, it’s **fragmented** into smaller pieces. + +When all fragments arrive, the destination system **reassembles them** in the correct order using sequence numbers. + +| Concept | Description | +| -------- | ------------ | +| **Fragmentation** | Breaking large packets into smaller pieces | +| **Reassembly** | Combining fragments back into the original message | +| **Sequence Numbers** | Help identify the correct order | + +## Reliability and Error Handling + +The **TCP protocol** ensures packet delivery by: +* Assigning sequence numbers +* Acknowledging received packets (ACK) +* Retransmitting lost packets +* Verifying integrity via checksums + +This is why even if some packets get lost or delayed, your webpage still loads perfectly once all packets arrive. + +## Key Takeaways + +* **Packets** are the building blocks of Internet communication. +* **Routers** decide how these packets travel based on IP addresses and routing protocols. +* **BGP** powers global routing between Internet providers. +* **TCP/IP** ensures reliable delivery through sequencing and error checking. +* The system’s **decentralized nature** makes the Internet scalable and resilient. + +Understanding packets and routing is crucial to grasping how the Internet functions. This knowledge helps appreciate the complexity and efficiency of modern digital communication. \ No newline at end of file diff --git a/docs/internet/security-basics.mdx b/docs/internet/security-basics.mdx index e345ed2..cac18fe 100644 --- a/docs/internet/security-basics.mdx +++ b/docs/internet/security-basics.mdx @@ -1 +1,120 @@ - \ No newline at end of file +--- +title: "Security Basics" +description: "Understand the core principles of Internet security — encryption, authentication, and data protection — and learn how to stay safe online." +tags: [internet, security, https, encryption, firewall, vpn] +sidebar_label: Security Basics +--- + +Internet security is the **foundation of safe communication** and data transfer online. Every time you log in, make a payment, or send a message, multiple security layers work behind the scenes to protect your information. + +## What Is Internet Security? + +**Internet security** refers to the set of technologies, protocols, and practices designed to **protect data** and **secure communication** over networks. It ensures that data sent between clients and servers remains **private, authentic, and intact**. + +:::info +Think of Internet security as a digital shield that guards your information from hackers, eavesdroppers, and malicious software. +::: + +Common threats include: +* Malware and viruses +* Phishing attacks +* Data interception (Man-in-the-Middle) +* Unsecured public Wi-Fi usage + +## Core Principles of Cybersecurity + +| Principle | Description | +| ---------- | ------------ | +| **Confidentiality** | Ensures that information is only accessible to authorized users (e.g., via encryption). | +| **Integrity** | Prevents unauthorized alteration of data during transmission. | +| **Availability** | Keeps systems and data accessible to authorized users when needed. | + +These three are known as the **CIA Triad**, forming the foundation of security design. They work together to provide a comprehensive security framework. + +## Encryption: Protecting Your Data + +**Encryption** converts readable data (plaintext) into an unreadable format (ciphertext). +Only users with the correct **decryption key** can restore the original message. + +```mermaid +graph LR + A[Plain Text] -->|Encrypt| B[Cipher Text] + B -->|Decrypt| C[Plain Text] +``` + +Example: +* When you access a website with **HTTPS**, your browser and server exchange data in an **encrypted** form, using protocols like **TLS (Transport Layer Security)**. + +:::info +Encryption is like sending a locked box — only the person with the key can open it and read the contents. +::: + +## Authentication and Authorization + +Two terms often confused but very different: + +| Term | Description | Example | +| ------ | ------------ | -------- | +| **Authentication** | Verifying the identity of a user or system. | Logging in with a username and password. | +| **Authorization** | Granting permission to access resources based on identity. | Accessing your email inbox after logging in. | + +To enhance security, many systems implement **Multi-Factor Authentication (MFA)**, requiring two or more verification methods (e.g., password + SMS code). + +:::info +Authentication is like showing your ID to prove who you are, while authorization is like getting a ticket to enter a concert after your ID is verified. + +**Key Differences:** +* Authentication = *who you are*; +* Authorization = *what you can do*. +::: + +## Firewalls and Network Protection + +A **firewall** acts as a **barrier** between your device or network and potential external threats. It filters incoming and outgoing traffic based on defined security rules. + +```mermaid +graph TD + A[Internet] -->|Blocked Traffic| B[Firewall] + B -->|Allowed Traffic| C[User Device] +``` + +Types of Firewalls: +* **Packet Filtering Firewall** – Filters data packets based on IP and port. +* **Proxy Firewall** – Acts as an intermediary between users and the web. +* **Next-Gen Firewall (NGFW)** – Uses deep packet inspection and AI-based analysis. + +## Safe Browsing Practices + +Here are simple but effective steps to stay safe online: + +* [X] Always use **HTTPS websites** +* [X] Keep your **software and browsers updated** +* [X] Avoid clicking on **suspicious links** +* [X] Use **strong, unique passwords** (or a password manager) +* [X] Enable **Two-Factor Authentication (2FA)** +* [X] Be cautious when using **public Wi-Fi** + +## Example: Why HTTPS Is Safer + +Let’s see the difference in data transfer: + +| Protocol | Encryption | Data Safety | Example | +| -------- | ----------- | ------------ | -------- | +| **HTTP** | None | Data can be intercepted | `http://example.com` | +| **HTTPS** | Encrypted with TLS | Data is protected end-to-end | `https://example.com` | + +So, when you see a 🔒 lock in your browser, it means your connection is **secured with encryption**. + +:::info +Using HTTPS is like sending a letter in a sealed envelope instead of a postcard — only the intended recipient can read it. +::: + +## Key Takeaways + +* Security ensures **confidentiality, integrity, and availability** of data. +* **Encryption** protects your data in transit. +* **Authentication** and **authorization** verify identity and access. +* **Firewalls** and **HTTPS** safeguard your network and browsing. +* Practicing **safe online habits** is the first line of defense. + +Stay informed and proactive about your Internet security to enjoy a safer online experience! \ No newline at end of file diff --git a/docs/internet/tcp-ip-model.mdx b/docs/internet/tcp-ip-model.mdx index e345ed2..439e428 100644 --- a/docs/internet/tcp-ip-model.mdx +++ b/docs/internet/tcp-ip-model.mdx @@ -1 +1,121 @@ - \ No newline at end of file +--- +title: "Understanding the TCP/IP Model" +description: "Dive into the TCP/IP model — the foundation of how data travels across the Internet. Learn about its layers, protocols, and how it powers communication between devices." +tags: [tcp, ip, networking, internet, protocols, model] +sidebar_label: TCP/IP Model +--- + +The **TCP/IP model** is the backbone of modern networking — a layered framework that defines how data is transmitted, routed, and received across the Internet. It ensures that billions of devices can communicate **efficiently and reliably**, regardless of their hardware or location. + +:::info +Every byte of data that crosses the Internet follows the TCP/IP model quietly making global communication possible. +::: + +## What Is the TCP/IP Model? + +**TCP/IP** stands for **Transmission Control Protocol / Internet Protocol**. It’s a **set of communication rules (protocols)** that allow computers to connect and exchange data across networks from your home Wi-Fi to global Internet backbones. + +While there are other models (like the OSI model), TCP/IP is the **practical implementation** that powers the Internet today. + +## The Four Layers of the TCP/IP Model + +Unlike the seven-layer OSI model, TCP/IP has **four layers**, each responsible for a specific part of data transmission. + +```mermaid +graph TD + A[Application Layer] --> B[Transport Layer] + B --> C[Internet Layer] + C --> D[Network Access Layer] +``` + +### 1. Application Layer + +This is the **topmost layer** where user-facing applications and services operate. It provides protocols that applications use to communicate with users and the network. + +**Responsibilities:** +* Provides services like web browsing, email, and file transfer +* Defines protocols for application-specific communication + +**Common Protocols:** +* **HTTP/HTTPS** – Web browsing +* **DNS** – Domain resolution +* **FTP** – File transfer +* **SMTP/IMAP** – Email + +### 2. Transport Layer + +This layer ensures **reliable data transfer** between devices. It manages how data is broken into smaller packets and reassembled at the destination. + +**Responsibilities:** +* Manages data segmentation and reassembly +* Handles flow control and error detection + +**Key Protocols:** +* **TCP (Transmission Control Protocol)** – Reliable, connection-oriented communication +* **UDP (User Datagram Protocol)** – Faster, connectionless transmission (used in streaming, gaming) + +### 3. Internet Layer + +This layer is responsible for **addressing and routing** packets across networks. It ensures that data finds its way from the source to the destination. This layer determines **how data packets find their way** from source to destination across multiple networks. + +**Responsibilities:** +* Logical addressing (IP addresses) +* Routing and path selection + +**Key Protocols:** +* **IP (Internet Protocol)** – Defines packet structure and addressing +* **ICMP (Internet Control Message Protocol)** – Error reporting (e.g., ping) +* **ARP (Address Resolution Protocol)** – Maps IP to MAC addresses + +### 4. Network Access Layer + +The **foundation layer** that handles the physical transmission of data. It defines how data is sent over various physical media. + +**Responsibilities:** +* Defines how bits are sent over cables, Wi-Fi, or fiber +* Includes drivers, hardware interfaces, and local network protocols + +**Common Technologies:** +* **Ethernet**, **Wi-Fi**, **Bluetooth**, **PPP** + +## Example: Sending a Web Request + +Let’s see how the TCP/IP model works when you visit a website like **https://codeharborhub.github.io** + +| Step | Layer | Example Activity | +| ---- | ------ | ---------------- | +| 1 | **Application Layer** | Browser sends an HTTP request | +| 2 | **Transport Layer** | TCP ensures the request arrives intact | +| 3 | **Internet Layer** | IP routes the packet to the correct server | +| 4 | **Network Access Layer** | Data travels physically via Ethernet/Wi-Fi | + +```mermaid +sequenceDiagram + participant A as Browser + participant B as TCP + participant C as IP Network + participant D as Web Server + A->>B: Send HTTP Request + B->>C: Encapsulate into TCP Segments + C->>D: Deliver via IP Routing + D-->>A: Send Response (HTTP 200 OK) +``` + +## How TCP/IP and OSI Relate + +| OSI Model (7 Layers) | TCP/IP Model (4 Layers) | +| --------------------- | ------------------------ | +| Application, Presentation, Session | **Application** | +| Transport | **Transport** | +| Network | **Internet** | +| Data Link, Physical | **Network Access** | + +While OSI provides a **conceptual** model, TCP/IP defines a **real-world implementation**. + + +## Key Takeaways + +* **TCP/IP** is the protocol suite that drives the Internet. +* It has **four layers**, each handling a different part of communication. +* **TCP** ensures reliability; **IP** handles addressing and routing. +* Understanding TCP/IP helps you grasp how devices truly "talk" on the Internet. \ No newline at end of file