Thanks to:
for the contents of these slides.
Each layer assumes that the layer below it will do its job.
Old OSI Model | TCP/IP Hierarchy | Protocols |
---|---|---|
7: Application Layer | Application Layer |
domain (DNS, hostname→IP address) |
6: Presentation Layer | ||
5: Session Layer | ||
4: Transport Layer | Transport Layer |
TCP (connection-oriented reliable packets) |
3: Network Layer | Network Layer |
IP (it all boils down to this) |
2: Link Layer | Link Layer (alias Data Link Layer) |
ARP (Mac address→IP address) |
1: Physical Layer |
┌──────────────────┐ Layer N+1 protocol ┌──────────────────┐ │ Layer N+1 entity │<–––––––––––––––––––––>│ Layer N+1 entity │ └──────────────────┘ └──────────────────┘ │ ∧ │ ∧ ∨ │ ∨ │ ┌──────────────────┐ Layer N protocol ┌──────────────────┐ │ Layer N entity │<–––––––––––––––––––––>│ Layer N entity │ └──────────────────┘ └──────────────────┘ │ ∧ │ ∧ ∨ │ ∨ │ ┌──────────────────┐ Layer N-1 protocol ┌──────────────────┐ │ Layer N-1 entity │<–––––––––––––––––––––>│ Layer N-1 entity │ └──────────────────┘ └──────────────────┘
A layer N+1 entity sees the lower layers only as a service provider:
┌──────────────────┐ Layer N+1 protocol ┌──────────────────┐ │ Layer N+1 entity │<–––––––––––––––––––––>│ Layer N+1 entity │ └──────────────────┘ └──────────────────┘ │ ∧ │ │ │request indicate│ │delivery delivery│ │ │ ∨ │ ┌─────────────────────────────────────────────────────────────┐ │ Service provider │ └─────────────────────────────────────────────────────────────┘
Application job: write the web browser (client) or web server (server)
┌─────────┐ ┌──────────┐ ┌──────┐ │ laptop │ │ │ │ │ │ running │···········│ Internet │···········│ eBay │ │ browser │ │ │ │ │ └─────────┘ └──────────┘ └──────┘
Assume network provides way to send a messages between hosts.
Transport job: implement the connection-(oriented/less) service
┌─────────┐ ┌──────────┐ ┌──────┐ │ laptop │ │ │ │ │ │ running │···········│ Internet │···········│ eBay │ │ browser │ │ │ │ │ └─────────┘ └──────────┘ └──────┘
Network layer job: get a message from a source to a destination
┌─────────┐ │ laptop │ ┌───────┐ ┌───────┐ ┌───────┐ │ running │·····│ ISP A │····│ ISP B │····│ ISP C │ │ browser │ └───────┘ └───────┘ └───────┘ └─────────┘ : : : : : : ┌───────┐ ┌───────┐ ┌───────┐ ┌──────┐ │ ISP D │····│ ISP E │····│ ISP F │······│ eBay │ └───────┘ └───────┘ └───────┘ └──────┘
Link Layer job: get a message sent across some medium
┌────────┐ ┌────────┐ │ host A │·····························│ host B │ └────────┘ direct connection └────────┘
┌─────────┐ ┌───────────┐ ┌─────────┐ A │ Layer N │ │ PDU │ B │ Layer N │ │ entity │···········│ (layer N) │···········│ entity │ └─────────┘ └───────────┘ └─────────┘
My wife is visiting her family in France, and I miss her terribly, so I write a passionate love letter:
Warmest regards. Lonely Husband
Say that a web browser wants to see eBay’s home page. It might construct this 34-byte HTTP request:
However, to send this over a TCP connection, the Transport level adds a 20-byte header, so now we have this:
The Transport level hands this off to the Network level, which will create an IP packet with its own 20-byte header:
The Network level hands this off to the Data Link layer, which will add its own overhead, depending on the medium:
Packet | Protocol Level | ||||
---|---|---|---|---|---|
Data | Application | ||||
TCP header | Data | Transport | |||
IP header | TCP header | Data | Network | ||
Frame header | IP header | TCP header | Data | Frame footer | Data Link |
When sending, each level treats the data from the previous level as a black box, an unintelligible blob of stuff, and adds its own header or footer.
Similarly, when receiving, each level removes its overhead.
┌──────────┐ ┌──────────┐ │ HTTP │ │ HTTP │ └──────────┘ └──────────┘ │ │ ┌──────────┐ ┌──────────┐ │ TCP │ │ TCP │ └──────────┘ └──────────┘ │ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ IP │ │ IP │ │ IP │ └──────────┘ └──────────┘ └──────────┘ │ │ │ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ Link │······│ Link │ │ Link │······│ Link │ └──────────┘ └──────────┘ └──────────┘ └──────────┘ ct320-1 router acushla salem 192.168.110.101 192.168.110.1 129.82.45.35 129.82.44.169
0 | 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 | 26 | 27 | 28 | 29 | 30 | 31 |
Version | IHL | Type of service | Total length | ||||||||||||||||||||||||||||
Identification | Flags | Fragment offset | |||||||||||||||||||||||||||||
Time to live | Protocol | Header checksum | |||||||||||||||||||||||||||||
Source IP address | |||||||||||||||||||||||||||||||
Destination IP address | |||||||||||||||||||||||||||||||
Options (optional) | |||||||||||||||||||||||||||||||
IP data payload (many bytes) |
Protocol: 1=ICMP, 6=TCP, 17=UDP
┌─────────────┐ ┌─────────────┐ │ Application │ │ Application │ ├─────────────┤ ├─────────────┤ │ Transport │ │ Transport │ ├─────────────┤ ┌─────────────┐ ├─────────────┤ │ Network │ │ Network │ │ Network │ ├─────────────┤ ├─────────────┤ ├─────────────┤ │ Link │··········│ Link │··········│ Link │ └─────────────┘ └─────────────┘ └─────────────┘
20 bytes | 1 byte | 1 byte | 2 bytes | more bytes |
IP header | Type | Code | Checksum | ICMP data |
0 | 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 | 26 | 27 | 28 | 29 | 30 | 31 |
Source port | Destination port | ||||||||||||||||||||||||||||||
Sequence number | |||||||||||||||||||||||||||||||
Acknowledgement number | |||||||||||||||||||||||||||||||
Data offset | - | - | - | - | CWR | ECNE | URG | ACK | PSH | RST | SYN | FIN | Window | ||||||||||||||||||
Checksum | Urgent pointer | ||||||||||||||||||||||||||||||
Options (0–10 32-bit words) | |||||||||||||||||||||||||||||||
TCP payload (many bytes) |
┌─────────────────┐ ┌───────────────┐ ┌───────────────┐ │ ct320-1 │ lan1 │ router │ │ boise │ │ 192.168.110.101 │·······│ 192.168.110.1 │ ····│ 129.82.44.133 │ └─────────────────┘ : ├ ─ ─ ─ ─ ─ ─ ─ ┤ : └───────────────┘ ┌─────────────────┐ : │ acushla │ : ┌───────────────┐ │ ct320-2 │ : │ 129.82.45.35 │·······│ salem │ │ 192.168.110.102 │···· └───────────────┘ lan2 │ 129.82.44.169 │ └─────────────────┘ └───────────────┘
┌─────────────────┐ ┌───────────────┐ ┌───────────────┐ │ ct320-1 │ lan1 │ router │ │ boise │ │ 192.168.110.101 │·······│ 192.168.110.1 │ ····│ 129.82.44.133 │ └─────────────────┘ : ├ ─ ─ ─ ─ ─ ─ ─ ┤ : └───────────────┘ ┌─────────────────┐ : │ acushla │ : ┌───────────────┐ │ ct320-2 │ : │ 129.82.45.35 │·······│ salem │ │ 192.168.110.102 │···· └───────────────┘ lan2 │ 129.82.44.169 │ └─────────────────┘ └───────────────┘
┌─────────────────┐ ┌───────────────┐ ┌───────────────┐ │ ct320-1 │ lan1 │ router │ │ boise │ │ 192.168.110.101 │·······│ 192.168.110.1 │ ····│ 129.82.44.133 │ └─────────────────┘ : ├ ─ ─ ─ ─ ─ ─ ─ ┤ : └───────────────┘ ┌─────────────────┐ : │ acushla │ : ┌───────────────┐ │ ct320-2 │ : │ 129.82.45.35 │·······│ salem │ │ 192.168.110.102 │···· └───────────────┘ lan2 │ 129.82.44.169 │ └─────────────────┘ └───────────────┘
Why bother with routers or subnets? Just put all of your computers on one giant LAN, and be done with it!
Consider this unusual network. In the center is a router, with several LAN ports, connecting three LANs. Note that 203.0.113.12 and 203.0.113.66 are also connected by a dedicated super-high-speed LAN, because they exchange tons of data.
┌───────────────┐ ┌───────────┐ ┌─────────────┐ :···│ 203.0.113.252 │ │ 10.12.1.3 │·······│ 10.12.1.1 │ · └───────────────┘ └───────────┘ : ├ ─ ─ ─ ─ ─ ─ ┤ : ┌───────────────┐ ┌───────────┐ : │ 203.0.113.1 │···:···│ 203.0.113.12 │ │ 10.12.1.5 │···: ├ ─ ─ ─ ─ ─ ─ ┤ : └───────────────┘ └───────────┘ : │ 192.0.2.7 │ : : ┌───────────┐ : └─────────────┘ : : │ 10.12.1.6 │···· : : ┌───────────────┐ └───────────┘ : ····│ 203.0.113.66 │ to Comcast └───────────────┘
┌───────────────┐ ┌───────────┐ ┌─────────────┐ :···│ 203.0.113.252 │ │ 10.12.1.3 │·······│ 10.12.1.1 │ · └───────────────┘ └───────────┘ : ├ ─ ─ ─ ─ ─ ─ ┤ : ┌───────────────┐ ┌───────────┐ : │ 203.0.113.1 │···:···│ 203.0.113.12 │ │ 10.12.1.5 │···: ├ ─ ─ ─ ─ ─ ─ ┤ : └───────────────┘ └───────────┘ : │ 192.0.2.7 │ : : ┌───────────┐ : └─────────────┘ : : │ 10.12.1.6 │···· : : ┌───────────────┐ └───────────┘ : ····│ 203.0.113.66 │ to Comcast └───────────────┘
How would 203.0.113.66 send data to:
How’s it supposed to know all that‽
┌───────────────┐ ┌───────────┐ ┌─────────────┐ :···│ 203.0.113.252 │ │ 10.12.1.3 │·······│ 10.12.1.1 │ · └───────────────┘ └───────────┘ : ├ ─ ─ ─ ─ ─ ─ ┤ : ┌───────────────┐ ┌───────────┐ : │ 203.0.113.1 │···:···│ 203.0.113.12 │ │ 10.12.1.5 │···: ├ ─ ─ ─ ─ ─ ─ ┤ : └───────────────┘ └───────────┘ : │ 192.0.2.7 │ : : ┌───────────┐ : └─────────────┘ : : │ 10.12.1.6 │···· : : ┌───────────────┐ └───────────┘ : ····│ 203.0.113.66 │ to Comcast └───────────────┘
Destination | Cost | Interface |
---|---|---|
203.0.113.12/32 | 1 | top |
203.0.113/24 | 2 | left |
gateway | 3 | left |
Each host (both end-user computers and routers) has a routing table.
Is the second entry really needed? Note the the table does not try to get a packet all the way to 10.12.1.5; it only specifies the next hop.
┌───────────────┐ ┌───────────┐ ┌─────────────┐ :···│ 203.0.113.252 │ │ 10.12.1.3 │·······│ 10.12.1.1 │ · └───────────────┘ └───────────┘ : ├ ─ ─ ─ ─ ─ ─ ┤ : ┌───────────────┐ ┌───────────┐ : │ 203.0.113.1 │···:···│ 203.0.113.12 │ │ 10.12.1.5 │···: ├ ─ ─ ─ ─ ─ ─ ┤ : └───────────────┘ └───────────┘ : │ 192.0.2.7 │ : : ┌───────────┐ : └─────────────┘ : : │ 10.12.1.6 │···· : : ┌───────────────┐ └───────────┘ : ····│ 203.0.113.66 │ to Comcast └───────────────┘
Destination | Cost | Interface |
---|---|---|
203.0.113/24 | 1 | right |
10/8 | 1 | left |
gateway | 2 | bottom |
There is not one giant routing table for everything. No single host has the big picture. Nobody has the big picture.
Instead, each host minds its own business, and has its own routing table, which tells that host where packets should go.
┌───────────────┐ ┌───────────┐ ┌─────────────┐ :···│ 203.0.113.252 │ │ 10.12.1.3 │·······│ 10.12.1.1 │ · └───────────────┘ └───────────┘ : ├ ─ ─ ─ ─ ─ ─ ┤ : ┌───────────────┐ ┌───────────┐ : │ 203.0.113.1 │···:···│ 203.0.113.12 │ │ 10.12.1.5 │···: ├ ─ ─ ─ ─ ─ ─ ┤ : └───────────────┘ └───────────┘ : │ 192.0.2.7 │ : : ┌───────────┐ : └─────────────┘ : : │ 10.12.1.6 │···· : : ┌───────────────┐ └───────────┘ : ····│ 203.0.113.66 │ to Comcast └───────────────┘
Destination | Cost | Interface |
---|---|---|
gateway | 1 | right |
It only has one LAN interface. Everything’s got to go through that! Once a (non-local) packet gets to the router, then it’s the router’s task to figure out where it should go next.
$ ssh acushla ip route Host key verification failed.
google.com
requests would go there; they match no other rules.
Modified: 2017-10-26T08:59 User: Guest Check: HTML CSSEdit History Source |
Apply to CSU |
Contact CSU |
Disclaimer |
Equal Opportunity Colorado State University, Fort Collins, CO 80523 USA © 2015 Colorado State University |