Computer Networks (Personal)
Port numbers :
HTTPS : 443
DNS : 53
Cables under the ocean for internet
to reach at particular, you have to pass through many
if central system fails, everything will be failed
scalability issues
MIMP for interviews - OSI model
2 types of architecture:
1. client-server
2. peer-to-peer
lets say we have opened 5 tabs in google chrome, we are sending some req to the server, now, how will we kknow where to show response, in which tab? so, our client system automatically creates random ports and they get destroyed after the request is fullfilled or process is no longer needed.
DNS - works like a db for domain name and ip addresses
Think of it this way: the network layer delivers the letter to the right house (host IP address), and the transport layer ensures it gets to the correct person (application port) inside that house.
we need to ensure that all the data has been delivered correctly and in the same order, for that, we use checksum
how do I know if the msg is delivered?
1 tcp connection only between 2 computers
nowadays, lots of people are using internet, so we need more ip addresses, so ipv6 was invented
Data Link layer
converts all bits 0/1 to a high level language that can be understood by us.
🔍 Layer-by-Layer Deep Dive
🟣 Layer 7 – Application Layer
-
Purpose: Closest to the user; interacts with software applications
-
Functions: Email, web browsing, file transfers
-
Protocols:
-
HTTP/HTTPS – Web traffic
-
FTP – File transfers
-
SMTP/POP3/IMAP – Email
-
DNS – Domain name resolution
-
-
Examples:
-
You type
www.google.com
in your browser → browser uses HTTP -
Outlook sends an email → uses SMTP/IMAP
-
🟣 Layer 6 – Presentation Layer
-
Purpose: Data formatting and translation between app and network
-
Functions:
-
Data encryption/decryption
-
Data compression/decompression
-
Translate between different data formats (e.g., EBCDIC to ASCII)
-
-
Protocols/Technologies:
-
SSL/TLS – Encrypt data for HTTPS
-
MIME – Email content formatting
-
JPEG, MP4, PNG – Media format standards
-
-
Examples:
-
You visit
https://
site → SSL/TLS encrypts data -
Watching a compressed YouTube video → data is decoded here
-
🟣 Layer 5 – Session Layer
-
Purpose: Establishes, maintains, and terminates sessions
-
Functions:
-
Session creation and teardown
-
Authentication, session restoration
-
-
Protocols:
-
NetBIOS – Windows file sharing
-
RPC (Remote Procedure Call) – Used in distributed systems
-
PPTP (Point-to-Point Tunneling Protocol) – VPNs
-
-
Examples:
-
Logging into remote desktop (RDP session)
-
VOIP call establishing session handshake
-
🔵 Layer 4 – Transport Layer
-
Purpose: Reliable or fast delivery of data, end-to-end
-
Functions:
-
Ensures complete and correct data transfer
-
Splits data into segments
-
Flow control, error handling
-
-
Protocols:
-
TCP (Transmission Control Protocol) – Reliable, ordered
-
UDP (User Datagram Protocol) – Fast, unreliable
-
-
Examples:
-
File download via TCP (e.g., HTTP file)
-
Video call via UDP (Zoom, Meet)
-
-
Ports (identified at this layer):
-
Port 80 → HTTP
-
Port 443 → HTTPS
-
Port 53 → DNS
-
🔵 Layer 3 – Network Layer
-
Purpose: Routing packets across different networks
-
Functions:
-
Logical addressing (IP addresses)
-
Path determination and packet forwarding
-
-
Protocols:
-
IP (IPv4/IPv6) – Core of internet routing
-
ICMP – Ping, error reporting
-
OSPF, BGP – Routing protocols
-
IPSec – Network-level encryption
-
-
Examples:
-
IP packets routed across internet
-
Ping to check if host is alive
-
-
Devices: Routers
🔵 Layer 2 – Data Link Layer
-
Purpose: Node-to-node data transfer within the same network
-
Functions:
-
MAC addressing
-
Frame formatting and error detection (not correction)
-
-
Protocols:
-
Ethernet
-
ARP (Address Resolution Protocol) – IP ↔ MAC
-
PPP (Point-to-Point Protocol) – DSL links
-
802.11 (Wi-Fi)
-
-
Examples:
-
Sending a frame over a LAN
-
MAC address filtering
-
-
Devices: Switches, NIC (Network Interface Cards)
🔵 Layer 1 – Physical Layer
-
Purpose: Transmit raw bits (0s and 1s) over physical medium
-
Functions:
-
Electrical/optical signaling
-
Defines cables, voltage levels, pinouts
-
-
Protocols/Technologies:
-
Ethernet (cable specs)
-
Wi-Fi (radio waves)
-
Bluetooth, DSL, USB, Fiber
-
-
Examples:
-
Electrical signals over Cat6 cable
-
Light pulses through fiber optic
-
-
Devices: Hubs, cables, repeaters, modems
🧠 Easy Mnemonic to Remember the Layers:
"All People Seem To Need Data Processing" (Top to Bottom)
A – Application
P – Presentation
S – Session
T – Transport
N – Network
D – Data Link
P – Physical
Or:
"Please Do Not Throw Sausage Pizza Away" (Bottom to Top)
🔁 Real-World Example: Visiting a Website (e.g., https://openai.com
)
-
Application (Layer 7) – You enter the URL in Chrome
-
Presentation (Layer 6) – SSL/TLS encrypts the request
-
Session (Layer 5) – Session is established
-
Transport (Layer 4) – TCP port 443 is used
-
Network (Layer 3) – IP packet routed to OpenAI's server
-
Data Link (Layer 2) – Frame sent over Ethernet or Wi-Fi
-
Physical (Layer 1) – Bits go out as electrical signals
- Visualization: Depicted at the top of the stack, often with icons representing user-facing applications. The layer is shown connecting directly to the user.
- Purpose: This layer is the window for users and applications to access the network. It identifies communication partners, synchronizes communication, and establishes whether sufficient network resources are available.
- Where it's used: Web browsers (like Chrome or Firefox), email clients, file transfer applications, and instant messaging services.
- Examples: HTTP, FTP, SMTP, DNS.
- Visualization: Located just below the Application layer, often represented as a translation or encryption/compression machine.
- Purpose: To translate, encrypt, and compress data to ensure that data sent from the application layer of one system is readable by the application layer of another. It acts as a data format and code translator.
- Where it's used: When you send an encrypted message or view a JPEG image, this layer handles the formatting and encryption/decryption.
- Examples: JPEG, MPEG, TLS/SSL.
- Visualization: In the middle of the stack, sometimes shown with two computers initiating and maintaining a conversation.
- Purpose: Manages and controls the connections between devices. It establishes, maintains, and terminates communication sessions, and uses checkpoints for data synchronization to prevent data loss.
- Where it's used: When you browse a secure website, this layer manages the connection. In a video conference, it ensures that audio and video streams are synchronized.
- Examples: Remote Procedure Call (RPC) and Point-to-Point Tunneling Protocol (PPTP).
- Visualization: The "heart of the OSI," it is often shown dividing a larger message into smaller "segments" on the sender's side and reassembling them on the receiver's side.
- Purpose: Provides end-to-end communication between the two devices. It ensures reliable and complete data delivery through segmentation, reassembly, flow control, and error correction.
- Where it's used: When you download a file, TCP ensures every segment arrives in the correct order. For live video streaming, UDP is used for faster, though less reliable, transmission.
- Examples: TCP (Transmission Control Protocol) and UDP (User Datagram Protocol).
- Visualization: Depicted with routers directing data packets across a map or globe, showing how data finds its way across different networks.
- Purpose: Routes data packets between different networks. It handles logical addressing (IP addresses) and determines the best physical path for the data to travel.
- Where it's used: All internet traffic passes through this layer as routers decide which path data should take.
- Examples: IP (Internet Protocol) and ICMP (Internet Control Message Protocol).
- Visualization: Often shown with switches and network cards, managing communication between devices on the same local network segment.
- Purpose: Transfers data between nodes on the same network. It packages network layer packets into "frames," provides physical addressing (MAC addresses), and handles flow and error control.
- Where it's used: A switch operates at this layer, using MAC addresses to forward frames to the correct device within a local area network (LAN).
- Examples: Ethernet and PPP.
- Visualization: At the bottom of the stack, often includes images of cables, hubs, and the literal 1s and 0s of binary data being sent as signals.
- Purpose: The actual physical connection between devices. It is responsible for transmitting unstructured raw bitstreams over a physical medium like cables or radio waves.
- Where it's used: Cables, network interface cards (NICs), hubs, and repeaters are all part of this layer, converting frames into electrical, optical, or radio signals.
- Examples: Ethernet cable, Wi-Fi radio frequencies.
Comments
Post a Comment