Module 2 · Networking Fundamentals · Lesson 4 of 75
How data travels: layers, packets, switches and routers
The OSI and TCP/IP models, encapsulation, MAC versus IP addresses, and what switches and routers actually do.
In this lesson · about 35 minutes
- Name the seven OSI layers and the four TCP/IP layers
- Explain encapsulation using headers at each layer
- Tell a MAC address from an IP address, and a switch from a router
The OSI model: seven layers
The OSI model splits networking into seven layers, so each problem can be discussed on its own. Security people use it constantly: "that's a layer 7 attack" means it targets the application, not the cables.
| # | Layer | What lives here | Example attacks or controls |
|---|---|---|---|
| 7 | Application | HTTP, DNS, SMTP, SSH | SQL injection, phishing, web application firewall |
| 6 | Presentation | Encoding, compression, encryption (TLS is often placed here) | Weak TLS versions |
| 5 | Session | Opening and keeping conversations | Session hijacking |
| 4 | Transport | TCP and UDP, ports | SYN flood, port scanning |
| 3 | Network | IP addresses, routers | IP spoofing, firewall rules by address |
| 2 | Data link | MAC addresses, switches, Wi-Fi frames | ARP spoofing, MAC flooding, VLANs |
| 1 | Physical | Cables, radio, light | Wire-tapping, jamming, locked network cupboards |
Memory aid, from layer 1 up: Please Do Not Throw Sausage Pizza Away.
The TCP/IP model is the one the internet really uses. It squeezes the seven into four: Link (1–2), Internet (3), Transport (4) and Application (5–7).
Encapsulation
Going down the layers, each one wraps the data in its own header: the application data gets a TCP header (ports) to become a segment, then an IP header (addresses) to become a packet, then an Ethernet header and trailer (MAC addresses) to become a frame, then bits on the wire. The receiver unwraps in reverse.
MAC versus IP addresses
- MAC address (layer 2): burned into the network card, 48 bits written in hex, such as
3C:22:FB:91:0A:4E. Only used on the local network. Easy to fake ("MAC spoofing"), so never rely on it alone for security. - IP address (layer 3): given by the network, such as
192.168.1.20. Used to route data between networks, all the way across the internet.
Switches and routers
- A switch connects devices on the same network. It learns which MAC address is on which port and sends each frame only where it needs to go.
- A router connects different networks, choosing the next hop by IP address. Your home "router" is really a router, a switch, a Wi-Fi access point and a firewall in one box.
Try it · watch it move
Wrap a message like a parcel
Watch a message get wrapped layer by layer on the way down and unwrapped on the way up. Pause on each header and say what it adds.
The letter itself · Application
Please send me the menu page
Try it · watch it move
Follow a packet's trip
Follow one packet from a laptop to its destination. Notice which devices it passes through, and remember: the IP address stays the same end to end, while the MAC label is rewritten for every leg.
Sorting drill
Which layer?
Place each item on its OSI layer group.
- A MAC address
- A router choosing the next hop
- TCP port 443
- An HTTP GET request
- A switch learning which device is on port 7
- A SYN flood
- A phishing email
- An IP address of 10.0.0.5
0 of 8 sorted
Check your understanding0 of 4 correct
Quiz score: 0 of 4
Written by Noviq Academy in its own words. All labs are simulations: no real systems are touched, and every name, address, password and hash is made up. The offensive techniques taught here are for defending systems and for authorised testing only; never scan, access or test a system without the owner's written permission. Tool and product names belong to their owners, and command output may differ slightly from yours. Read-aloud uses your device's built-in voices.