Foundations Of Networking
The OSI and TCP/IP Models
OSI a 7-layer reference model, designed by
JrCodex·6 min read
Jr Codex Computer Networks Notes
Level: Beginner Prerequisites: Chapter 1: What a Network Is and Why Layers Time to complete: ~20 minutes
Table of Contents
- Two Models, One Reality
- The Seven OSI Layers
- The TCP/IP Model
- Mapping Them Together
- Which One to Use
- Talking About Layers in Practice
- Summary & Next Steps
1. Two Models, One Reality
The Situation
─────────────────────────────────────────
OSI a 7-layer reference model, designed by
committee in the 1980s as the intended
standard.
Excellent for TEACHING and for precise
vocabulary.
Almost nothing implements it directly.
TCP/IP a 4-layer model that describes what the
internet ACTUALLY does.
Built from working code, then documented.
This is what runs.
You need both: OSI for the vocabulary everyone
uses, TCP/IP for what is actually happening.
─────────────────────────────────────────
2. The Seven OSI Layers
Top to Bottom
─────────────────────────────────────────
7 APPLICATION what the user's software does
HTTP, DNS, SMTP, SSH
Module 5
6 PRESENTATION data format: encoding,
compression, encryption
TLS sits roughly here
Module 6
5 SESSION establishing, managing and
ending conversations
The layer with the least
independent existence today
4 TRANSPORT process-to-process delivery,
reliability, ordering
TCP, UDP — Module 4
3 NETWORK host-to-host across networks;
addressing and routing
IP, ICMP — Module 3
2 DATA LINK node-to-node on one link;
framing, MAC addressing
Ethernet, wifi — Module 2
1 PHYSICAL bits as signals on a medium
cables, radio, voltages
Module 2
─────────────────────────────────────────
A Mnemonic Worth Having
─────────────────────────────────────────
Bottom-up:
Please Do Not Throw Sausage Pizza Away
Physical Data-link Network Transport Session
Presentation Application
Trivial, and it survives interviews.
─────────────────────────────────────────
Where the Numbers Get Used
─────────────────────────────────────────
Layer numbers are everyday vocabulary in
networking and operations:
"a layer 2 switch" forwards by MAC address
"a layer 3 device" routes by IP
"a layer 4 load
balancer" balances by IP and port
"a layer 7 load
balancer" balances by URL, header
or cookie
"a layer 7 attack" targets the application,
not the link
This is the main practical reason to know OSI.
─────────────────────────────────────────
3. The TCP/IP Model
Four Layers
─────────────────────────────────────────
APPLICATION OSI layers 5, 6 and 7 combined
HTTP, DNS, SMTP, TLS
TRANSPORT = OSI layer 4
TCP, UDP, QUIC
INTERNET = OSI layer 3
IP, ICMP, ARP
(sometimes called the network
layer)
LINK OSI layers 1 and 2 combined
Ethernet, wifi, PPP
(also called network access)
─────────────────────────────────────────
Why It Collapsed the Layers
─────────────────────────────────────────
OSI's session and presentation layers never
developed independent implementations. In
practice, applications handle their own sessions,
and encoding and encryption live in libraries the
application calls.
Similarly, physical and data link are inseparable
in real hardware: an Ethernet card implements
both, and you cannot buy one without the other.
TCP/IP merged them because the split described
nothing real.
─────────────────────────────────────────
THE HOURGLASS
─────────────────────────────────────────
Many applications ────► HTTP SMTP DNS SSH ...
│
Two transports ──────► TCP UDP
│
ONE network layer ────► IP ◄── the
│ waist
Many links ───────────► Ethernet wifi 5G fibre
This is the most important structural fact about
the internet.
ANY application over ANY link, because everything
agrees on IP in the middle. Add a new physical
medium and every existing application works over
it, unchanged, immediately.
It is why the internet absorbed wifi, then
mobile, then fibre, with no application rewrites.
─────────────────────────────────────────
4. Mapping Them Together
Side by Side
─────────────────────────────────────────
OSI TCP/IP Examples
─────────────────────────────────────────
7 Application ┐
6 Presentation ├──► Application HTTP, DNS,
5 Session ┘ TLS, SMTP
─────────────────────────────────────────
4 Transport ───► Transport TCP, UDP,
QUIC
─────────────────────────────────────────
3 Network ───► Internet IP, ICMP,
ARP
─────────────────────────────────────────
2 Data Link ┐──► Link Ethernet,
1 Physical ┘ wifi, fibre
─────────────────────────────────────────
Layer Devices and Addresses
─────────────────────────────────────────
LAYER ADDRESS UNIT DEVICE
─────────────────────────────────────────
7 URL data proxy, gateway
4 port number segment L4 load balancer
3 IP address packet ROUTER
2 MAC address frame SWITCH
1 none bit hub, repeater,
cable
Learn this table. It answers a large share of
networking questions on its own, and the
address/unit/device columns recur throughout the
curriculum.
─────────────────────────────────────────
5. Which One to Use
The Honest Guidance
─────────────────────────────────────────
USE TCP/IP to understand what actually happens.
Four layers, real protocols, real code.
USE OSI NUMBERS to talk to other people. "Layer
7 routing" and "layer 2 loop" are the industry's
shared vocabulary and will not be replaced.
KNOW OSI'S SEVEN for exams and interviews, which
ask about it far more than production ever does.
─────────────────────────────────────────
The Trap to Avoid
─────────────────────────────────────────
Do not try to place every protocol in exactly one
OSI layer. Many genuinely do not fit:
TLS between transport and application;
called layer 6 by convention, but it
is a transport-layer protocol by
function
ARP maps IP to MAC — layer 2? 3? Both.
QUIC transport features implemented over
UDP inside the application process
MPLS explicitly called "layer 2.5"
The model is a teaching device. Reality is
messier, and protocols are designed to solve
problems rather than to fit diagrams.
─────────────────────────────────────────
6. Talking About Layers in Practice
Diagnosing by Layer — the Real Payoff
─────────────────────────────────────────
When something is broken, work UP the stack. The
first failure tells you where to look.
L1 Is the cable in? Is the interface up?
ip link show
L2 Can I reach the local gateway's MAC?
arp -a
L3 Can I reach an IP address?
ping 8.8.8.8
L4 Can I open a connection to that port?
nc -zv host 443
L7 Does the application respond correctly?
curl -v https://host
Each step assumes the ones below it worked, which
is exactly Chapter 1's layering. Module 8 turns
this into a full diagnostic method.
─────────────────────────────────────────
Why This Ordering Saves Time
─────────────────────────────────────────
"The website is down" has causes at every layer.
Testing top-down means guessing. Testing
bottom-up means the FIRST failure localises the
problem, and everything above it is irrelevant
until that is fixed.
ping works but curl fails ──► the network is
fine; the problem is layer 4 or above.
ping fails ──► stop looking at the application
entirely.
─────────────────────────────────────────
7. Summary & Next Steps
Key Takeaways
- OSI is a seven-layer teaching model that supplies the industry's vocabulary; TCP/IP is a four-layer description of what actually runs.
- TCP/IP merged OSI's session and presentation layers because they never had independent implementations, and merged physical and data link because real hardware does too.
- The hourglass — many applications, two transports, one IP, many links — is why any application works over any new medium without modification.
- Diagnose bottom-up: the first layer that fails localises the problem, and everything above it is irrelevant until that layer works.
Concept Check
- Why did TCP/IP collapse OSI's seven layers into four?
- Explain the hourglass shape and what property of the internet it produces.
- Why is
pingsucceeding whilecurlfails a useful diagnostic result rather than a confusing one?
Next Chapter
Jr Codex — 1-on-1 Personalized Coaching | Back to Module Index | Back to Computer Networks Index