0001 - The OSI and TCP IP Models
What are they?
- They are conceptual models that standardize the functions of a telecommunication or computing system in terms of abstraction layers.
- They provide a common language for network engineers and software developers.
Key Difference:
- The OSI (Open Systems Interconnection) model is a more theoretical, 7-layer model.
- The TCP/IP model is a more practical, 4-layer model that is the foundation of the modern internet.
The OSI Model (7 Layers)
Think of it with the mnemonic: “All People Seem To Need Data Processing.”
Let’s break down the OSI model using a simple analogy: ordering a pizza for delivery.
Imagine you’re in your office (the Source Computer) and you want to order a pizza to be delivered to your home (the Destination Computer).
Layer 7: Application Layer
Simple Analogy: This is you deciding you’re hungry and what you want. You pick up the phone, use a website, or open a food delivery app. You know you want a large pepperoni pizza.
In Simple Terms: This is the layer that interacts directly with the user’s software. It’s the “app” part of the network process.
What it does: Provides the interface for an application (like your web browser or email client) to access the network.
Example: You opening Chrome and typing www.pizzahut.com.
Layer 6: Presentation Layer
Simple Analogy: You place your order in English, but the pizza shop’s internal system is in Italian. This layer is like a translator at the shop who converts your “large pepperoni pizza” order into “pizza grande ai peperoni” for the kitchen. It also ensures your credit card details are scrambled (encrypted) so no one can steal them.
In Simple Terms: This is the “translator” and “security guard” layer. It makes sure data is in a format the other computer can understand and that it’s secure.
What it does: Formats, encrypts, and compresses the data so it’s understandable and safe.
Example: When you enter your password on a website, this layer encrypts it so it looks like gibberish.
Layer 5: Session Layer
Simple Analogy: This is the person on the phone at the pizza shop who takes your order. They open a conversation with you (“Pizza Hut, how can I help you?"), keep the line open while you’re ordering, and end the call when you’re done (“Your pizza will be there in 30 minutes, goodbye!").
In Simple Terms: This layer is the “conversation manager.” It starts, manages, and ends the connection between two computers.
What it does: Establishes and maintains a communication session between applications.
Example: Keeping you logged into your bank account while you check your balance and make a transfer, then logging you out after a period of inactivity.
Layer 4: Transport Layer
Simple Analogy: This is the quality control manager at the pizza shop. They take your full order (the pizza, a side of garlic knots, and a soda) and chop it into manageable pieces for the delivery driver. They number each piece (“1 of 3,” “2 of 3,” etc.) and double-check that everything is there before it goes out. They also decide which delivery car to use: the reliable, but slower, car (TCP) that guarantees delivery, or the super-fast scooter (UDP) that might hit a pothole and drop the garlic knots, but will get the pizza there fast.
In Simple Terms: This layer ensures your data gets delivered reliably (or not, if speed is more important) and in the correct order.
What it does: Chops up data into smaller segments, adds sequencing information, and handles error checking and reliable delivery.
Example: Your browser using TCP to download a web page, ensuring every single piece of the page arrives correctly so it can be displayed.
Layer 3: Network Layer
Simple Analogy: This is the pizza delivery driver. They don’t know who you are (your name), but they know your home address. Their job is to look at a map (or use GPS) to find the best and fastest route from the pizza shop to your house, navigating through different streets and highways.
In Simple Terms: This is the “postal service” or “GPS” of the network. It handles the logical addressing and routing of your data.
What it does: Puts the destination and source “IP addresses” on the data packets and figures out the best path to send them across the network.
Example: A router looking at the destination IP address on a data packet and deciding which physical path to send it on to get it closer to its final destination.
Layer 2: Data Link Layer
Simple Analogy: Once the driver gets to your specific street, they still need to find your exact house. This layer is like the house number on your mailbox (the MAC address). It allows the driver to pinpoint the exact house on that specific street, separate from your neighbors. It also defines the “rules of the road” for that street, like the speed limit.
In Simple Terms: This layer handles the physical addressing to get data to the correct device on a local network.
What it does: Adds the physical hardware address (MAC address) to the data and ensures it can be sent over a specific physical medium (like an Ethernet cable).
Example: A network switch in your office directing a data packet to your specific laptop instead of your colleague’s, even though you are both on the same Wi-Fi network.
Layer 1: Physical Layer
Simple Analogy: This is the actual road, the air for the radio waves of the GPS, and the gasoline in the delivery car. It’s the physical stuff that makes the journey possible.
In Simple Terms: This is the hardware. It’s the wires, cables, and radio waves that carry the signals.
What it does: Transmits the raw digital data (the ones and zeros) as electrical, light, or radio signals.
Example: The Ethernet cable plugged into your computer, or the Wi-Fi signal traveling from the router to your phone.
The TCP/IP Model (4 Layers)
This is the model used in practice.
TCP/IP Layer | Corresponding OSI Layers | Key Protocols & Concepts |
---|---|---|
Application | 7, 6, 5 (Application, Presentation, Session) | HTTP, HTTPS, DNS, FTP, SMTP. This is where most of your code lives. |
Transport | 4 (Transport) | TCP (reliability, ordering), UDP (speed, low overhead). Manages host-to-host communication. |
Internet | 3 (Network) | IP (logical addressing, packet routing), ICMP (ping). Connects different networks. |
Link | 2, 1 (Data Link, Physical) | Ethernet, Wi-Fi. MAC addresses. Transmits data within a local network. |
Advanced Concepts & Interview Talking Points
- Encapsulation/Decapsulation: This is a critical concept. As data moves down the stack from Layer 7, each layer adds its own header (and sometimes a trailer). This is encapsulation.
- HTTP data becomes a TCP Segment.
- The TCP segment gets an IP header to become an IP Packet.
- The IP packet gets an Ethernet header to become an Ethernet Frame. The reverse process on the receiving end is decapsulation.