3.1 OSI model layer numbers, names, and examples.
OSI layer number | OSI layer name | Example entity or protocol |
---|---|---|
1 | Physical | Copper cabling |
2 | Data link | Ethernet |
3 | Network | IPv4 |
4 | Transport | TCP |
5 | Session | NFS |
6 | Presentation | PNG |
7 | Application | HTTP |
3.3.1 Layer 1
From a physical perspective, the first layer of the OSI model is at the bottom, layer 1. This layer is known as the physical layer and is responsible for encapsulating the functions of the network which are concerned with the physical transmission medium that is being used to send and receive data, whether that be radio frequency (RF), in the case of many wireless networks, copper cabling, fibre optic cabling, or another medium of choice. Although these three options are the most commonly used today, other options such as infrared (IR) light exist and are used in some specific use cases.
As well as the physical transmission medium itself, layer 1 includes the functions that are needed to encode and decode all data transmissions using that medium. For example, to send and receive data across copper cabling, an encoding scheme must be used to convert some digital application data into a sequence of physical electrical energy, which is then applied to the copper transmission medium, which carries those electrical signals to the remote end of the transmission medium where a corresponding decoding scheme reverses the process, turning these electrical signals back into the digital application data which they represented and passing this data up to layer 2 of the stack.
3.3.2 Layer 2
Layer 2 is known as the data link layer and is responsible for a few key functions of the network stack. One of these is medium access control (MAC), which is the process of determining the means by which a network endpoint may access the transmission medium to send data. In many networks, this is not as simple as merely transmitting immediately whenever layer 3 communicates to layer 2 that it has data to send. Consider a wireless network as an example: The radio spectrum used by these networks is a shared medium, where transmissions from one network endpoint are able to be received by many other network endpoints. If one endpoint were to transmit without checking to see if the “coast is clear” and transmitted at the same time as another endpoint, it is likely that both transmissions would be garbled, resulting in data being lost or being retransmitted. This is to be avoided wherever possible as it reduces the efficiency of the network considerably.
Protocols operating at layer 2 are also responsible for providing link local addressing, a form of network endpoint identification where endpoint interfaces are given locally unique identifiers that enable intranetwork communication but which are not intended to be used as globally unique; this means that they are not suitable for use between networks but can uniquely identify endpoints on the same network. Through various means such as broadcast and multicast data transmission, these link local addresses are often used to allow an endpoint to discover the globally unique addresses of the endpoints it needs to communicate with, or at least that of the next hop in the path to get there.
3.3.3 Layer 3
Referred to as the network layer, layer 3 is the only layer of the OSI model which is responsible for internetwork addressing, where network endpoints can be assigned globally unique addresses. This is crucial as without this function, endpoints that are located in other networks would not be reachable and the internet (as a network of networks) would not be able to exist as it does today.
The globally unique addresses which layer 3 provides are mapped on to the link local addresses that are used by protocols operating at layer 2 by a process that is specific to each of those lower layer protocols. This ensures that when data sent from an endpoint on an external network targeted for an endpoint on the local network enters the local network, it can be correctly forwarded using its link local address (such as a MAC address in the case of Ethernet) as if that traffic had originated on the local network to begin with. The external network endpoint is unaware of this process entirely.
3.3.4 Layer 4
Layer 4 is named the transport layer. This label may seem odd, but it is for good reason: Above the means to transcode digital data into physical signals at layer 1, the MAC functions and link local addressing provided by layer 2, and the globally unique endpoint addressing capabilities enabled by layer 3, there is a need for a group of functions which determine how to send and receive data on the network at a layer of abstraction, which enables them to perform tasks such as flow control and integrity checking of any data received without reliance upon any specific set of layer 1, 2, or 3 technologies. This transport layer is the bridge between the application at higher layers of the stack and the underlying network technologies below, whatever they may be.
Two popular examples of layer 4 protocols are the Transmission Control Protocol (TCP) and the User Datagram Protocol (UDP). The primary difference between these two is that despite the fact that both protocols operate at the transport layer, TCP provides a guarantee that any traffic sent across the network will be delivered to its destination complete and in the order that it was sent. Comparably, UDP provides no such guarantee; data sent using UDP does not create any layer 4 acknowledgement from its destination that it was or was not received correctly. If a piece of data were lost in transit across the network and the application were using TCP, the receiver of the data would notify the sender and a retransmission would be arranged, whereas with UDP, it would just be lost. Although this may seem like a large drawback, whether it is or not depends on the use case; for real‐time applications such as video conferencing or Voice over Internet Protocol (VoIP) calls, it is beneficial to the user experience to allow a certain amount of lost data compared to incurring the delay of the sender having to retransmit any lost data, which can result in odd sound or video to an end user.
Although still very commonly used, the TCP and UDP protocols are not always the optimal choice. These protocols emerged in 1974 and 1980, respectively, and as such predate the applications that today generate the vast majority of traffic on the internet and its constituent networks, sometimes by several decades. Modern alternatives (such as the Stream Control Transmission Protocol [SCTP], which is designed to incorporate many of the desirable features of both TCP and UDP) are emerging and will see increasing use in the near future for use cases that require their additional capabilities such as native support for multihoming in the case of SCTP, where two endpoints may each have multiple globally unique addresses, allowing for the use of redundant network paths for added resiliency.
3.3.5 Layers 5, 6, and 7
These three layers are referred to as the session, presentation, and application layers, respectively. In practice their details are not encountered as much from the network perspective as they are by the inner workings of a specific application, which is why they are not going to be described in the same level of detail as the lower levels of the stack are in this chapter. As the functions at these layers are often handled within a single application at a single endpoint, the protocols at each of these upper layers as well as the interfaces between them tend to be less distinct than those at