7-layer model
The original Open Sytems Interconnection (OSI) model had seven layers:
- Physical layer: the physical hardware that connects nodes
- Link layer: the low-level protocols that use the hardware (Ethernet, Wifi)
- Network layer: protocols for getting packets to their destinations (Internet protocol (IP))
- Transport layer: responsible for resolving packets into data, optionally with guarantees of reliability and ordering (Transport control protocol (TCP), Universal datagram protocol (UDP))
- (Session layer): “Delimiting and synchronization of data exchange” (?)
- (Presentation layer): compression, encryption, format management
- Application layer: Resolution of raw data into requests and other discrete messages (Domain name system (DNS), Hypertext transfer protocol (HTTP), Simple mail transport protocol (SMTP), etc.)
5-layer model
The “5-layer model” reflects the Internet as it actually evolved: it lacks any standardized session layer or presentation layer.
I’m not really sure what the “session layer” ever was supposed to do, but it seems like most of its job is adequately handled by TCP (which synchronizes data exchange through ordering) and HTTP (which delimits the content of a TCP stream into discrete messages).
The lack of a presentation layer is a genuine problem. Applications are responsible for handling their own encryption (via Transport layer security (TLS)) and, as needed, compression. Browsers have introduced some APIs around this, but basically we’re stuck with a lot of boilerplate on every project. *Shakes fist*
Anyway, the five-layer model has:
- Physical
- Link
- Network
- Transport
- Application
4-layer model
A lot of people treat the link layer and the physical layer as the same thing, since the appropriate link protocol is generally built right into the hardware. So then we have:
- Link
- Network
- Transport
- Application