Skip to content

Moral-Victory/CNT_Lab_exam

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CNT_Lab_exam

This response details the complete content taught in the video, covering the history, fundamental concepts, and deep dives into the networking models and protocols, drawing entirely from the provided source material.

I. Introduction and Fundamental Concepts

The video presents a complete computer networking course, emphasizing that networking is crucial for all developers (mobile, web, and Devops). It promotes a mindset of understanding how core computer science components work, such as RAM, computer architecture, and the internet's internals.

Definitions and History

  • Computer Network: Computers connected together.
  • Computer Full Form: Commonly Oriented Machine Particularly Used for Training Education and Research.
  • Internet: A collection of computer networks spread globally across houses, cities, and countries.

The internet originated during the Cold War rivalry between the United States and the Soviet Union. Following the Soviet Union's launch of the first satellite (Sputnik in 1957), the US government created ARPA (Advanced Research Projects Agency) to lead scientific discovery.

  • ARPANET: Developed by ARPA to enable communication between its facilities, initially connecting four places: MIT, Stanford, UCLA, and the University of Utah.
  • Protocols: Sets of rules defining how data is sent, ensuring reliability or speed depending on the data type (e.g., secure files need 100% data transfer, video conferencing can drop frames). Early ARPANET used TCP (Transmission Control Protocol).

Evolution of Information Sharing

  • WWW (Worldwide Web): Developed by Tim Berners-Lee, this project allows storage and access of documents, identified by URLs and interlinked by hyperlinks, accessible over the internet via web servers. The first website, info.cern.ch/hypertext/WWW/TheProject.html, is referenced.
  • Search Engines: Developed later because early WWW relied only on following hyperlinks, which did not scale.

Protocol Governance

  • The Internet Society is responsible for writing, controlling, and creating new rules and regulations for the internet.
  • Submissions for new internet features are made via RFCs (Request for Comments).

Client-Server Model and Data Units

  • Client-Server: The client (your computer) sends a request (e.g., google.com) to the server (e.g., Google's server), which sends back a response (e.g., a webpage). A computer can act as both a client and a server (e.g., when working on Local Host).
  • Data Centers: Large collections of servers used by big companies (like YouTube or Google) to handle high traffic and ensure availability.
  • P2P (Peer-to-Peer): An architecture where various devices connect directly to each other, acting as both clients and servers (e.g., BitTorrent).
  • Packets/Segments: Data is not sent all at once but in chunks known as packets or segments.

Addressing and Identification

  • IP Address (Internet Protocol Address): Uniquely identifies every device (computer, server, etc.) connected to the internet.
    • Global IP: Assigned to your modem by the ISP.
    • Local IP: Assigned to devices connected to your Wi-Fi/modem.
  • Ports: 16-bit numbers (up to 65,000 possible ports) that identify the application running on a device.
    • IP address identifies the computer; the port number identifies the application.
    • Well-known ports (0-1023) are reserved, like Port 80 for HTTP.
  • DHCP (Dynamic Host Configuration Protocol): The protocol used by the modem to assign Local IP addresses.
  • NAT (Network Address Translator): Used by the router to determine which internal device requested a specific data response coming back from the internet.

II. Physical Network Connections

Data transmission occurs via two methods: guided (wired, set path) and unguided (wireless, no single path).

Global Connection

  • The internet is physically connected globally using submarine cables laid under the ocean, which is faster than using satellites.

Network Types (from high school)

  • LAN (Local Area Network): For a small house or office.
  • MAN (Metropolitan Area Network): Across a city.
  • WAN (Wide Area Network): Across countries, typically using optical fiber cables.
  • The internet is a collection of LANs connected via MANs and WANs. WAN technologies include SONET (Synchronous Optical Networking) and Frame Relay.

Network Hardware and Topologies

  • Modem: Converts digital signals to electrical/analog signals and vice versa.
  • Router: Routes data packets based on IP addresses (Network Layer).
  • Repeater: (Physical Layer) Regenerates a signal on the same network.
  • Bridge: (Data Link Layer) Filters content by reading Mac addresses.
  • Switch: A multi-port bridge (Data Link Layer), improving performance and efficiency.

Topologies describe how computers are connected:

  1. Bus Topology: Connected to a single backbone cord.
  2. Ring Topology: Connected in a circular fashion.
  3. Star Topology: All computers connected to one central device.
  4. Tree Topology: Combination of bus and star.
  5. Mesh Topology: Every computer connected to every other computer.

III. The OSI and TCP/IP Models

OSI Model

The OSI (Open Systems Interconnection) model is a conceptual framework that standardizes communication between computers using seven layers. Data travels down from Layer 7 to Layer 1 on the sending machine and up from Layer 1 to Layer 7 on the receiving machine.

Layer # Layer Name Primary Function (Overview) Data Unit
7 Application User interaction, provides network applications (e.g., browsers, email clients). Message
6 Presentation Data formatting, conversion (e.g., ASCII to binary), encryption, compression. Data
5 Session Setting up, managing, and terminating connections/sessions (e.g., login authentication). Data
4 Transport End-to-end reliable data transfer between applications (using ports). Segments
3 Network Routing data across different networks (computer-to-computer delivery using IP addresses). Packets
2 Data Link Transfers data over a physical link (using Mac addresses for local communication). Frames
1 Physical Physical transmission medium, converts data into electrical/light/radio signals (bits). Bits

TCP/IP Model

The TCP/IP model is more practical and uses five layers. It merges the Application, Presentation, and Session layers of the OSI model into a single Application layer.

  1. Application Layer
  2. Transport Layer
  3. Network Layer
  4. Data Link Layer
  5. Physical Layer

IV. Deep Dive into Layers and Protocols

Layer 7/5 (Application, Presentation, Session Layers)

Application Layer Protocols:

  1. HTTP (Hypertext Transfer Protocol): A client-server application layer protocol defining how data is requested and responded to.

    • HTTP uses TCP in the transport layer.
    • HTTP is a stateless protocol (it doesn't store information about the client by default).
    • Methods: GET (requesting data), POST (submitting data/forms), PUT, and DELETE.
    • Status Codes: Indicate the status of a request: 200s (Success), 400s (Client Error, e.g., 404), 500s (Server Error).
    • Cookies: Unique strings stored in the client's browser that are sent with subsequent requests, allowing the server to maintain state for the stateless HTTP protocol.
  2. Email Protocols:

    • SMTP (Simple Mail Transfer Protocol): Used to send emails. It uses TCP to ensure the entire email is delivered reliably.
    • POP (Post Office Protocol): Used to receive emails; often downloads and deletes the email from the server, making it unavailable on other devices.
    • IMAP (Internet Message Access Protocol): Used to receive emails; allows viewing and syncing emails across multiple devices as emails are kept on the server.
  3. DNS (Domain Name System): A database service (directory) that maps human-readable domain names (URLs) to numerical IP addresses.

    • DNS lookup process starts by checking the local cache, then the local DNS server (often the ISP).
    • If not found locally, the request goes to Root DNS Servers.
    • The Root Server directs to the Top Level Domain (TLD) Server (e.g., .com, .org), which gives the final IP address.

Layer 4 (Transport Layer)

This layer transports data between the network layer and the correct application on the end system.

  • Multiplexing: Combining data streams from multiple applications into one stream for network transmission.
  • Demultiplexing: Delivering incoming data to the correct application based on port numbers.
  • Congestion Control: Algorithms (built into TCP) manage the amount of data transferred to prevent traffic and packet loss.
  • Error Control Mechanisms:
    • Check Sums: A calculated value attached to the data to detect corruption during transfer.
    • Retransmission Timers: If the sender does not receive an acknowledgment (ACK) within the set time, it retransmits the data packet.
    • Sequence Numbers: Used to ensure segments are reassembled in the correct order and identify duplicate packets.

Transport Layer Protocols:

  1. UDP (User Datagram Protocol):

    • Connectionless protocol.
    • Data may be lost, corrupted, or arrive out of order.
    • Uses check sums but does not attempt error recovery.
    • Faster than TCP; used for video conferencing, DNS lookups, and gaming.
    • Header: Source Port, Destination Port, Length of Datagram, and Check Sum (8 bytes total).
  2. TCP (Transmission Control Protocol):

    • Connection-oriented protocol. A connection must be established before data transfer.
    • Ensures reliable, ordered, and error-controlled delivery (full duplex).
    • Segments the raw application data into chunks, adds headers, and manages sequence numbers.
    • Three-Way Handshake: The process for establishing a connection:
      • Client sends a SYN (Synchronization) flag and a random sequence number.
      • Server responds with a SYN flag and an ACK (Acknowledgement) flag.
      • Client sends a final ACK flag to confirm the establishment.

Layer 3 (Network Layer)

This layer handles the actual transportation of data packets from one computer to another, especially across different networks.

  • Devices: Routers.
  • Logical Addressing: IP addressing happens here, assigning sender and receiver IP addresses to the segments to form IP packets.
  • Routing: Moving packets based on IP addresses using Forwarding Tables (a fast data structure in the router) for hop-by-hop forwarding.
  • Control Plane: The mechanism that builds and updates routing tables, sometimes using pathfinding algorithms like Dijkstra's.

Internet Protocol (IP) Details:

  • IPv4: 32-bit addresses (approx. 4.3 billion unique addresses).
    • Subnetting: Divides the IP address into a Network Address (identifying the network) and a Device Address (identifying the host).
    • Reserved Addresses: E.g., 127.0.0.0/8 for Local Host (loopback addresses used for testing).
    • TTL (Time To Live): A packet header value that specifies the maximum number of hops a packet can take before being dropped, preventing infinite loops.
  • IPv6: 128-bit addresses, designed to replace IPv4 due to address depletion. It is four times larger than IPv4 and represented by hexadecimal digits.

Middle Boxes (Devices that interact with IP packets):

  • Firewall: Filters incoming packets based on address, port, protocol, or flags.
  • NAT (Network Address Translator): Maps private internal IP address space to a public external IP address space, often used to slow down the consumption of IPv4 addresses.

Layer 2 (Data Link Layer)

This layer is responsible for transferring packets over a physical link and handles communication between locally connected devices (LAN).

  • Data Unit: Frames.
  • Physical Addressing: Uses Mac addresses (Media Access Control).
    • Mac address is a unique 12-digit alphanumeric identifier assigned to a network interface (e.g., Wi-Fi, Bluetooth).
  • ARP (Address Resolution Protocol): Used to find the Mac address of a destination device on the local network when only its IP address is known (by checking the ARP cache or broadcasting a request).
  • The router works closely with this layer, assigning private IP and Mac addresses to ensure data reaches the correct device.

Layer 1 (Physical Layer)

This layer handles the actual hardware and transmission medium. It converts the frames from the data link layer into bits (zeros and ones) and transmits them as electrical signals, light signals (optical fiber), or radio signals (Wi-Fi).


Analogy for Layers: You can think of the OSI model like sending an international letter:

  • Application/Presentation/Session: You (the user) write the message, put it in a specific language (format), and seal it (session/encryption).
  • Transport Layer: A postal clerk in your city assigns the correct postal box (port number) within your house/office to receive the reply. They segment the letter if it's too long.
  • Network Layer: The central sorting office (router) assigns the destination country address (IP address) and figures out the best route (routing table) across borders.
  • Data Link Layer: The local courier service uses the local street address (Mac address) to deliver the package to the correct local building (the recipient's router).
  • Physical Layer: The physical means of travel—the roads, planes, and hands (wires, signals)—that carry the package bit by bit to the next hop.

The following is a detailed explanation of the OSI Model, Transport Layer, Network Layer, TCP, and UDP, drawing upon the provided source materials.


I. The OSI Model (Open Systems Interconnection Model)

The OSI model is a conceptual framework that establishes a standard way for two or more computers to communicate with each other. It is important to note that the OSI model is often considered concept based or theoretical, while the TCP/IP model is considered more practical. The OSI model is highly crucial and is a frequently tested topic in interviews.

The internet is highly complex, so the OSI model divides communication into seven distinct steps or layers. Data transmission conceptually flows down these layers on the sending machine and up these layers on the receiving machine.

The seven layers of the OSI Model are, starting from the top:

  1. Application Layer
  2. Presentation Layer
  3. Session Layer
  4. Transport Layer
  5. Network Layer
  6. Data Link Layer
  7. Physical Layer

Conceptually, when two parties communicate (e.g., chatting on WhatsApp), the Application Layer assumes it is talking directly to the Application Layer of the friend, even though the internal route involves traversing all seven layers down and then back up at the destination.

II. Transport Layer (Layer 4)

The Transport Layer is responsible for moving data between the network and the correct application on the end system (your device).

While the Network Layer handles the actual transportation of data from one computer to another (the air travel portion, if you will), the Transport Layer ensures that when the message arrives on the destination computer, it is delivered to the intended application (e.g., WhatsApp, Google Chrome, MongoDB). The Transport Layer is located on the end systems (computers or devices).

Core Functions of the Transport Layer:

  1. Segmentation and Reassembly: Data received from the Session Layer is divided into small data units called segments.
  2. Addressing (Port Numbers): To ensure data reaches the correct application, every segment contains the source and destination port number. Port numbers identify the specific application running on the device.
  3. Multiplexing and Demultiplexing:
    • Multiplexing allows data from multiple applications (e.g., email, video call, file transfer) to be combined and sent over a single network medium.
    • Demultiplexing delivers incoming data packets to the corresponding applications based on the port number.
  4. Sequence Numbers: Sequence numbers are added to segments to help reassemble them in the correct order at the destination.
  5. Flow Control: The Transport Layer controls the amount of data being transferred, ensuring that the sender does not overwhelm a slower recipient (e.g., a server sending at 40 Mbps when the client can only handle 20 Mbps).
  6. Error Control: It manages scenarios where data packets are lost or corrupted.
    • Check Sums: A check sum (a calculated value) is added to every data segment. The recipient recalculates the checksum; if the values differ, the data is corrupted.
    • Timers: A timer starts when a data packet is sent. If an acknowledgement (ACK) is not received before the timer expires, the sender assumes the packet was lost and retransmits it (retransmission timer).
  7. Congestion Control: Algorithms, usually built into protocols like TCP, prevent network traffic and packet loss by managing the rate at which data is transferred.

Transport Layer Protocols:

The two primary protocols operating at this layer are TCP and UDP.

1. TCP (Transmission Control Protocol)

TCP is a connection-oriented protocol, meaning a connection must be reliably established between two endpoints before data transfer begins.

Feature Detail
Reliability Ensures 100% of data is delivered. Used when data loss is unacceptable (e.g., sending secret documents or important files).
Ordering Guarantees data arrives in the correct order and rearranges data segments if necessary.
Connection Type Connection-Oriented. A TCP connection can only exist between two endpoints.
Communication Full Duplex (Bidirectional): Both computers can send and receive files simultaneously.
Mechanism Uses sequence numbers, acknowledgement numbers, timers, and checksums. The receiver must send an acknowledgement (ACK) back to the sender upon receiving data.
Header Segments include the source port, destination port, sequence number, acknowledgement number, and flags (like SYN, ACK, FIN).
Use Cases File transfers (FTP), Email (SMTP, POP, IMAP), and Web Browsing (HTTP).

TCP Three-Way Handshake: This is the process used to establish a connection before data transmission:

  1. Client $\rightarrow$ Server: Sends a SYN (Synchronization) flag and a random sequence number (e.g., 32).
  2. Server $\rightarrow$ Client: Responds with a SYN flag, an ACK (Acknowledgement) flag, its own sequence number, and an acknowledgement number (e.g., the client’s sequence number + 1, or 33).
  3. Client $\rightarrow$ Server: Sends a final ACK flag to confirm the connection is established, along with an updated sequence number and acknowledgement number.

2. UDP (User Datagram Protocol)

UDP is a connectionless protocol.

Feature Detail
Reliability Unreliable. Data may be lost, corrupted, or arrive out of order. UDP does not perform error recovery.
Connection Type Connectionless. No connection is established before data is sent.
Speed Faster than TCP because it does not spend time establishing connections or checking if data was received.
Mechanism Uses checksums to detect corruption, but does not act on the corruption (no error recovery).
Data Unit Data is transferred in datagrams.
Header Contains Source Port, Destination Port, Length of Datagram, and Check Sum (total header size is 8 bytes).
Use Cases Used when speed is more important than 100% data integrity, such as video conferencing, gaming, and DNS lookups.

III. Network Layer (Layer 3)

The Network Layer is fundamentally responsible for the transmission of data packets from one computer to another across different networks.

Component Detail
Device Routers operate at this layer.
Data Unit Data transferred in the form of packets. The header of an IPv4 packet is 20 bytes.
Protocol Internet Protocol (IP).

Core Functions of the Network Layer:

  1. Logical Addressing: The Network Layer assigns the sender's and receiver's IP addresses to every segment (received from the Transport Layer) to form an IP packet.
  2. Routing (Hop-by-Hop Forwarding): This is the process of moving the packet from the source to the destination.
    • Routers check their Forwarding Tables (part of the Routing Table) to determine the best path (next hop) for the packet based on its destination IP address.
  3. Routing Table Creation (Control Plane): The Control Plane is responsible for building and updating these routing tables.
    • Dynamic Routing uses algorithms like Dijkstra’s or Bellman-Ford to find the most efficient path and adapt to changes in the network.
  4. Time To Live (TTL): This is a value in the packet header that specifies the maximum number of hops a packet can take. If the TTL reaches zero, the packet is dropped, which prevents packets from looping infinitely within the network.

Internet Protocol (IP) Details:

The IP address uniquely identifies every device (computer, server, router) on the internet.

  • IPv4 (Version 4): Uses 32-bit numbers (four 8-bit parts, e.g., 5.6.9.4). This allows for approximately 4.3 billion unique IP addresses.
    • Subnetting: An IP address is divided into a Network Address (identifying the network block) and a Device Address (identifying the host within that block).
    • Reserved Addresses: Specific addresses are reserved, such as 127.0.0.0/8 for Local Host or loopback addresses, used for testing purposes.
  • IPv6 (Version 6): Uses 128-bit addresses, designed to replace IPv4 due to address depletion. It is four times larger than IPv4. IPv6 addresses are represented by hexadecimal digits.

Middle Boxes

These are devices that interact with IP packets but are neither end systems nor typical routers. They operate at the Network Layer or Transport Layer.

  1. Firewall: Filters incoming IP packets based on criteria like address, port number, protocol, or flags (like the SYN flag).
  2. NAT (Network Address Translator): A method used to map a private IP address space to a public IP address space by modifying the IP information in the packet header. This is often used to slow down the consumption of IPv4 addresses and allows multiple internal devices to share a single public IP address.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages