OSI MODEL
EXPLAINED
OSI model explained.
LENA
9:41
Brother
Tokyo
how's the little monster?
see for yourself
LENA
This is Lena. She's
about to send a photo of her cat
to her brother in
Tokyo.
She taps send.
1 SECOND
BROTHER - TOKYO
Lena
Tokyo
how's the little monster?
see for yourself
One second later, he
sees it. The photo went on
a trip through seven
layers. Engineers call this the
OSI model.
OPEN
SYSTEMS
INTERCONNECTION
OSI model.
Open systems
interconnection.
LENA
FOLLOW THE PHOTO
TOKYO
Let's follow the photo.
LENA
LAYER 7 - APPLICATION
TOKYO
7
LAYER
APPLICATION
Layer 7. Application.
The trip starts inside
LENA'S CHAT APP
Lena's messaging app.
The app says, I
POST /v1/messages HTTP/1.1
Host: api.chat.example
Content-Type: image/jpeg
Content-Length: 312680
photo to her brother.
This is the layer
of the apps and
protocols you use every
day.
Like HTTP for websites
and DNS for finding
addresses.
HTTP - WEBSITES
https://example.com
DNS - FINDING ADDRESSES
$ dig example.com
example.com. 300 IN A
172.66.147.243
THE ADDRESS
LENA
LAYER 6 - PRESENTATION
TOKYO
6
LAYER
PRESENTATION
Layer 6. Presentation.
Before the photo leaves,
it gets prepared.
THE PHOTO - 1080 x 1080 PIXELS
RAW PIXELS
7,680,000 bytes
JPEG
1,163,911 bytes
COMPRESS
ENCRYPT
24.6x SMALLER
Compressed. So it's
smaller.
Encrypted so nobody can
read it on the way.
THE FIRST 12 BYTES
JPEG
df 8f ff e2 00 1a 4a 46 49 46 00 01
AES-256
f1 ef cf 08 31 02 e1 82 f1 ee 45 30 d8
Packed and locked.
LENA
LAYER 5 - SESSION
TOKYO
5
LAYER
SESSION
Layer 5. Session. Lena's
phone and the app server
open a conversation.
APP SERVER
SESSION OPEN
Like a phone call that stays
open while they talk.
LENA
LAYER 4 - TRANSPORT
TOKYO
4
LAYER
TRANSPORT
Layer 4. Transport. The
photo is too big to travel in one
piece.
THE LOCKED PHOTO: 312,680 BYTES
ONE PIECE CAN CARRY 1,460 BYTES
into small pieces,
and each one gets
215 PIECES.
#1 #2 #3 #4 #5
#6 #7 #8 #9 #10
#11 #12 #13 #14 #15
#16 #17 #18 #19 #20
#21 #22 #23 #24 #25
#1 #2 #3 #4 - #215
a number.
This is TCP.
#6
LENA
#7
LOST
#8
APP SERVER
#7
ACK - STILL NEED #7
If a piece gets lost, TCP asks for
it again.
WITHOUT #7
ALL 215 PIECES
For a photo, every
piece matters.
#5 #6 #7 #8
WAITS FOR #7
A VIDEO CALL - UDP
LIVE
#5 #6 #7 #8 #9
SKIPS #7
FASTER
Faster, but lost pieces
are just skipped.
LENA
LAYER 3 - NETWORK
TOKYO
3
LAYER
NETWORK
Layer 3. Network.
TCP #1
Each piece gets a
TO 203.0.113.7
FROM 192.168.1.23 (Lena's phone)
TIME TO LIVE 64 hops
CHECKSUM 0x1b0f
IPv4 HEADER - 20 BYTES
destination IP address.
DELIVER TO
203.0.113.7
FINAL
Like writing the final
address on a package.
LENA
LAYER 2 - DATA LINK
TOKYO
2
LAYER
DATA LINK
Layer 2, data link.
TO 203.0.113.7
TCP #1
But first the piece
has to reach Lena's
home router.
ROUTER - 02:1a:7c:4e:9a:10
So it gets a
MAC HEADER - 34 BYTES
TO 02:1a:7c:4e:9a:10 (router)
FROM 02:3a:9f:61:c4:2e (phone)
CARRIES IPv4 - 0x0800
second label with a
local address called a
MAC address.
PHONE
MAC
ROUTER
NEXT STOP
IP - THE FINAL ADDRESS
TOKYO
Like saying, first, take
this to the post
office down the street.
LENA
LAYER 1 - PHYSICAL
TOKYO
1
LAYER
PHYSICAL
Layer 1. Physical. Now
THE FIRST 12 BYTES, AS THE RADIO SENDS THEM
00000010 00011010 01111100 01001110
10011010 00010000 00000010 00111100
10011111 01100001 11000100 00101110
the photo stops being
a photo.
LAYER 1 - RADIO
5.18 GHz
WI-FI - RADIO
It becomes radio waves
in Lena's living room.
LAYER 1 - COPPER
Then electrical signals
COPPER
HIGH 1
LOW 0
01101000 00010110 10010001 11101010
THE SAME BITS, AS VOLTAGE ON COPPER
0
1
1
0
1
0
0
0
1
0
1
0
0
1
0
LAYER 1 - LIGHT
LIGHT - UNDER THE OCEAN
then flashes of light
in fiber optic cables
under the ocean.
CROSSING THE PLANET
~20,000 KM OF CABLE
LIGHT IN GLASS CROSSES IT IN ~0.1 SECONDS
ILLUSTRATIVE ROUTE - EUROPE TO TOKYO
Just ones and zeros
crossing the planet.
ROUTERS READ LAYER 3
MARSEILLE
TO 203.0.113.7
TO 203.0.113.7
SUEZ
TO 203.0.113.7
MUMBAI
EVERY ROUTER READS LAYER 3
Along the way, routers
read the IP label
on each piece.
SINGAPORE
ROUTING TABLE - SINGAPORE (ILLUSTRATIVE)
203.0.113.0/24
VIA HONG KONG
VIA JAKARTA
HONG KONG
MANILA
And each one decides,
send it this way.
HOP BY HOP
SINGAPORE
HONG KONG
TOKYO
Stop by stop, all
the way to Tokyo.
ENCAPSULATION
Notice what happened.
Every layer added its
own label.
A package inside a
package.
THE REAL FRAME - 1514 BYTES ON THE WIRE
92 1a 7c 4e 9a 10 02 3a 9f 61 c4 2e 08 00 45 00
00 3c 1b 0f 00 01 02 00 40 06 7a d4 c0 00 71 cb af 01 bb 9a 3c 1f 20 51 c2 a7 e4 5d 58
MAC
IP
TCP
LOCKED PHOTO
- these 1446 more bytes of the locked photo
Engineers call this
encapsulation.
TOKYO - IN REVERSE
TOKYO
THE SAME SEVEN LAYERS - IN REVERSE
MAC LABEL OFF
IP LABEL OFF
TCP LABEL OFF
In Tokyo, her brother's
phone does everything in
reverse.
LAYER 1 - PHYSICAL
Signals become data.
LAYER 3 - NETWORK
Labels come off one
LAYER 4 - TRANSPORT
Pieces are put back
in order.
LAYER 6 - PRESENTATION
AES-256 UNLOCKED
The photo is unlocked.
LAYER 7 - APPLICATION
And his app shows
a cat.
IF IT NEVER ARRIVES
TOKYO
PHOTO NOT DELIVERED
Now, if the photo
layers help you find
the problem.
CHECK LAYER 1
No signal at all?
Layer 1. Can't reach
CHECK LAYER 2
the router? Layer 2.
NO ROUTER
CHECK LAYER 3
Lost on the way?
LOST
Layer 3. Pieces missing?
CHECK LAYER 4
Layer 4.
CHECK HIGHER UP
App error? Much higher
up.
OSI - TCP/IP
OSI - 7 LAYERS
TCP/IP - 4 LAYERS
APPLICATION
TRANSPORT
INTERNET
LINK
To be honest, the real internet doesn't
follow all seven layers
perfectly.
Engineers often use a
simpler model called
TCP/IP,
THE MAP OF THE JOURNEY
but OSI is still
the best map of
the journey.
7 LAYERS - 1 SECOND
7 LAYERS - 7 JOBS
Seven layers. Seven
jobs, all in one
second. So Lena's brother can
So Lena's brother can
see her cat.