The OSI (Open Systems Interconnection) model, is a conceptual model of computer-to-computer communications, over a network. It was defined was defined in ISO/IEC 7498-1, by the International Organization for Standardization (ISO) in 1984. The model is not meant to specify exactly what processes occur. Instead, it describes them.
The OSI model, has seven layers: (1) Physical, (2) Data Link, (3) Network, (4) Transport, (5) Session, (6) Presentation, and (7) Application. As data flows from the source to the destination, it flows from the application layer (layer 7) to the physical layer (layer 1), across to the other computer, and back up from the physical layer (layer 1) to the application layer (layer 7).
The application layer, despite what you might think, does not include applications. It is, instead, what applications interact with. For example, HTTP (Hypertext Transfer Protocol) is an application layer protocol. Other examples of application layer protocols are POP3 or SMTP. The application layer protocols are defined within RFC 1123.
The presentation layer accepts data from application layer and makes it so that it can be readily consumed by other systems. This includes encoding the data using things such as the Multipurpose Internet Mail Extensions (MIME). The goal of the presentation layer is to make sure that the application layer on the other side can read what it receives. Some sources also state that it handles serialization of complex data types. It also handles encrypting / decrypting data. SSL and TLS happen here.
One source refers to this as the “port layer”, which makes sense. The session layer is where we attach a port number to the communication. Port numbers range from 0 to 65535 (since it is an unsigned 16-bit integer).
|Examples of well known port numbers|
|25||Simple Mail Transfer Protocol (SMTP)|
|80||Hypertext Transfer Protocol (HTTP)|
|443||Secure Hypertext Transfer Protocol (HTTPS)|
So, on the way out, it is tacking on a port number, based upon the type of communication and on the way back, it is determining the type of communication, based upon the port number.
The transport layer is where the Transmission Control Protocol (TCP) and the User Datagram Protocol (UDP) sit. This layer handles ensuring reliable arrival of messages and provides error checking. Here, data is also broken up into segments. The size of the segments is potentially different from network to network but the maximum transmission unit (MTU) on many networks is 1500 bytes.
Layer 3 is where the Internet Protocol (IP) lives. At this point, our data becomes packets. We also figure out the IP address of our destination and whether or not it is on our network. The source IP address and the destination IP address are appended to the header of the packets. If the destination is outside of our network, the destination IP address is use for routing of the packet.
Data Link Layer
At layer 2, our data becomes a frame. Additionally, the destination Media Access Control (MAC) address is appended to the header. If the computer is on the same network as us, the MAC address (which uniquely identifies the destination hardware) is used to direct the traffic (instead of the IP address). The Logical Link Control (LLC) also resides at this layer. It handles frame synchronization, flow control, and very low level error checking.
At this level, the frame is turned into raw bits (ones and zeros). It is then place on the copper, fiber optic, or radio waves as electricity, light waves, or radio signals.
(Image Source: https://upload.wikimedia.org/wikipedia/commons/4/47/Osi-model-jb.svg)
Remember, as the bits from the physical layer reach the other end, they go back up the chain from layer 1 to layer 7 of the receiving computer.
Have any questions? See anything that I got wrong? Please drop a comment below.
Programming note: I am taking a network+ prep class right now at MATC, so you will probably start seeing a lot more posts like this.