Internet And Network
Tags: networking, network, webdev, tutorial
Published: 2023-09-07 16:33:33

# Internet
## WWW (World Wide Web)
The World Wide Web (also known as the **web** or **WWW**) refers to **all the public websites or pages that users can access** on their local computers and other devices through the internet. These pages and documents are **interconnected by means of hyperlinks that users click** on for information. This information can be in different formats, including text, images, audio and video.

### Introduction
The World Wide Web (WWW), often simply referred to as the web, has undergone a remarkable evolution since its inception. This evolution can be categorized into **three key phases**: **Web1, Web2, and Web3**. we'll explore the history of the web and delve into each phase with examples.

### History

#### Web 1
also known as the **Static Web**, represents the early days of the internet. During this phase, **web pages were primarily static** and **consisted of simple HTML** (Hypertext Markup Language) code. **Interactivity was limited**, and the focus was on presenting information in a straightforward manner.

#### Example

The first web page ever created by **Tim Berners-Lee in 1991** serves as a quintessential example of Web1. **It was a basic HTML document with no multimedia elements**, and it aimed to provide **information about the World Wide Web project itself**. Here's a simplified version:

```html
<!DOCTYPE html>
<html>
<head>
    <title>The World Wide Web</title>
</head>
<body>
    <h1>Welcome to the World Wide Web</h1>
    <p>This is the first web page ever created.</p>
    <a href="https://www.example.com">Visit Example.com</a>
</body>
</html>
```
#### Web 2
Web2 brought a significant transformation to the web. It introduced **interactive and dynamic web applications**, **user-generated content**, and a strong focus on **user engagement** and **collaboration**. This phase marked the rise of social media, online communities, and e-commerce.

#### Example
**Facebook**, founded by Mark Zuckerberg in 2004, is a **prime example of Web2**. It is a **social networking platform** that revolutionized online communication. Facebook allows users to **create profiles**, **connect with friends**, **share content**, and engage in **real-time interactions**. Features like the news feed, status updates, and photo sharing exemplify the interactivity and user-generated content of Web2.

#### **Key Features of Web2**:
- **User-generated content**: Users contribute to the platform by sharing text, images, videos, and more.

- **Interactivity**: Real-time communication and feedback mechanisms enhance user engagement.

- **Online communities**: Social media platforms and forums foster communities and discussions.

- **Collaboration**: Users can collaborate on projects, documents, and content creation.


#### Web 3
Web3 represents the future of the internet, emphasizing **decentralization**, **blockchain** technology, and **user empowerment**. While it is still evolving, Web3 aims to provide **users with greater control** over their data and online identities, prioritizing trust and security.

#### Example
**Ethereum**, launched by Vitalik Buterin in 2015, **serves as a prominent example of Web3 principles**. It is a decentralized **blockchain platform** that enables the development of decentralized applications (DApps) and smart contracts. Ethereum's core features include:

- **Decentralization**: No single entity controls Ethereum; it relies on a distributed network of nodes.

- **Smart contracts**: Self-executing contracts with predefined rules and conditions.

- **Digital identity**: Users have ownership of their online identities and data.

- **Cryptocurrency**: Ethereum introduced its cryptocurrency, Ether (ETH), which powers transactions and operations within the network.

As Web3 continues to evolve, it holds the promise of reshaping online interactions, governance, and commerce, while giving individuals more control over their digital lives.


# Networking

## Network Layers (OSI Model)

### Introduction

The OSI model is a **conceptual framework that defines how different networking protocols and technologies interact to enable seamless communication between devices across a network**. It was developed by the International Organization for Standardization (ISO) in the late 1970s, and **it consists of seven distinct layers**, each responsible for specific functions in the data transmission process.

![image](https://cdn.discordapp.com/attachments/887387395538948166/1148996912855404574/image.png)

### **Physical Layer**: 
At the bottom of the OSI model, the Physical Layer **deals with the physical medium** through which data is transmitted. It encompasses hardware aspects like cables, connectors, and electrical signals.

Some common protocols are (That are mentioned in previous article Wired Communication):
- Ethernet
- USB
- Fiber Channel
  
*This Layer associated with Wired/Wireless Communication.*

### **Data Link Layer**: 
The Data Link Layer focuses on **establishing a reliable link between two directly connected nodes**. It manages **data framing**, **error detection**, and **flow control**. Protocols like Ethernet and Wi-Fi operate within this layer.

Some common protocols are:
#### - MAC Address (Media Access Control Address)
MAC (Media Access Control) addresses are vital at the Data Link Layer. They **are hardware-based addresses assigned to network interface cards (NICs)** and play a crucial role in local network communication. **MAC addresses ensure data frames are sent to the correct destination within the local network**.

*This Layer associated with Wired/Wireless Communication.*


### **Network Layer**: 
The Network Layer is **responsible for routing data packets from the source to the destination across multiple networks**. IP (Internet Protocol) is a key protocol in this layer, and it **enables devices to locate and communicate with each other** on a global scale.

Some common protocols are:
#### - **IP (Internet Protocol)**
IP, or Internet Protocol, is a cornerstone of the OSI model's Network Layer. Its primary function is to route data packets across networks. IP addresses are used to **uniquely identify devices on a network**, allowing global connectivity across the internet.

### **Transport Layer**: 
The Transport Layer ensures **end-to-end communication reliability**. It **divides data into smaller segments and provides error checking** and correction. **TCP** (Transmission Control Protocol) and **UDP** (User Datagram Protocol) are common transport layer protocols.

Some common protocols are:
#### - **TCP (Transmission Control Protocol)**
TCP operates within the Transport Layer of the OSI model. **It provides reliable**, **connection-oriented communication**. **TCP ensures data integrity**, **sequencing**, and **error correction**, making it suitable for applications where **data accuracy is critical**.

#### - **UDP (User Datagram Protocol)**
UDP, also at the Transport Layer, offers a **lightweight, connectionless communication** approach. It is ideal **for applications that prioritize speed over data integrity**, such as **real-time video** and **voice streaming**.
  
### **Session Layer**: 
The Session Layer **establishes, maintains, and terminates communication sessions between two devices**. It also manages synchronization and checkpointing. **NetBIOS** and **RPC** (Remote Procedure Call) are examples of session layer protocols.

Some common protocols are:
#### - **NetBIOS (Network Basic Input/Output System)**
NetBIOS resides within the Session Layer of the OSI model. It **provides session establishment, maintenance, and termination services**, making it essential for legacy Windows networking and file sharing.
  
### **Presentation Layer**: 
This layer deals with **data translation**, **encryption**, and **compression**. It ensures that **data sent by one device can be understood by another**. Common encryption protocols like **SSL/TLS** operate here.

Some common protocols are:
#### - **SSL/TLS (Secure Sockets Layer/Transport Layer Security)**
SSL/TLS protocols operate across two layers of the OSI model. At the **Presentation** Layer, they handle **data encryption**, **decryption**, and presentation to **ensure secure data exchange**. At the **Transport** Layer, they provide **data integrity**, **authentication**, and **encryption during communication**.
  
### **Application Layer**: 
The Application Layer is the topmost layer and is responsible for **end-user services and applications**. It provides an **interface for software** to interact with the network. Protocols such as **HTTP**, **FTP**, and **SMTP** are part of this layer.

#### - **HTTP (Hypertext Transfer Protocol)**
HTTP operates at the OSI model's Application Layer. It is the **foundation of data communication on the World Wide Web** and governs how web browsers and web servers interact, allowing **users to access and retrieve web pages and resources**.

#### - **HTTPS (Hypertext Transfer Protocol Secure)**
HTTPS, an **extension of HTTP**, also operates within the Application Layer. It **adds a layer of security by encrypting data exchanged between web browsers and servers**. This encryption helps protect sensitive information, making it suitable for secure online transactions.

#### - **SMTP (Simple Mail Transfer Protocol)**
SMTP operates within the OSI model's Application Layer and is **responsible for sending and receiving email messages**. It ensures that emails are routed correctly and delivered to the intended recipients.


### The OSI Model in Action

To understand how the OSI model works in practice, let's consider a scenario where you visit a website:

1. When you enter a website's URL in your browser, the Application Layer initiates the request.

2. The browser uses HTTP (Hypertext Transfer Protocol) at the Application Layer to request the web page.

3. The request is passed down through each lower layer. The Transport Layer may use TCP to ensure data integrity, and the Network Layer uses IP to route the request across the internet.

4. The Data Link Layer, which handles data framing, sends the request to the appropriate router, and the Physical Layer manages the actual transmission of data over cables or wireless signals.

5. Once the request reaches the destination server, the process reverses through the layers, and the server sends back the requested web page.

# Credits
- Fawaz Khosifan @fawazkh80