The International Organization for Standardization (ISO) started developing the seven-layer OSI model back in the late 1970s, and it became a working model in the 1980s. This OSI model was intended to be a fully operational network model with all the essential networking protocols packed into a unified stack, enabling network-connected devices to communicate and share resources.
Each layer of the OSI model has a unique role and function and enables network professionals to better understand what is happening during the exchange of data from one system to another and identify network-related issues while performing troubleshooting.
Table 1.1 shows the seven layers of the OSI model:
|
Layer
|
Name
|
Protocol Data Unit (PDU)
|
|
7
|
Application
|
Data
|
|
6
|
Presentation
|
|
5
|
Session
|
|
4
|
Transport
|
Segment
|
|
3
|
Network
|
Packet
|
|
2
|
Data Link
|
Frame
|
|
1
|
Physical
|
Bits
|
Table 1.1: OSI model
As shown in Table 1.1, the Application layer is where data is created by an application (software) that is running on the host device, such as the web browser on a computer that creates a web request message. Once the web request message is created, it is sent down the network model to the lower layers. The lower layers are responsible for inserting additional information, such as the logical and physical addressing parameters for the delivery of the message to the destination. This principle is similar to writing a traditional letter and adding addressing details to ensure the postal service is able to locate and deliver the letter to the intended recipient.
Note
An easy method to remember the layers of the OSI model is using the mnemonic All People Seem To Need Data Processing, where the first letter of each word in the sentence corresponds with the first letter of each layer in the model, from top to bottom. While this mnemonic has been used for quite a long time, you can develop your own technique of remembering the order of the layers.
Whenever an application, whether it is a web browser or an email application, creates a message, it is commonly referred to as application data. This data is the raw message, like the body of a traditional letter, without any addressing information such as the destination address or the sender’s address. The Application layer passes this raw data down to the lower layers, where each layer has a unique role and responsibility to ensure the appropriate addressing details, such as that the sender’s and destination addresses are correctly appended to the data to ensure it is transported and delivered to the intended recipient using the most efficient route (path).
As you will have noticed, in Table 1.1, there is a column with the name Protocol Data Unit (PDU). A PDU is used at various layers of the OSI model to refer to the form of data as it passes through each layer. As the application data is created at the Application layer, the PDU is referred to as data. As data travels downward to the Transport layer, it is appended with a Layer 4 header, which controls specific details to ensure the delivery of the message between the sender and destination hosts. At this point, the PDU will be referred to as a segment. The process of appending headers onto the PDU at the Transport, Network, and Data Link layers is referred to as encapsulation.
Note
As the PDU moves down to the lower layers and is encapsulated with a Layer 3 header, it is referred to as a packet. A PDU with a Layer 2 header and trailer is referred to as a frame. Lastly, when the PDU is converted into an electrical, light, or radio frequency signal for the network media on the Physical layer, it is called bits.
To put it simply, whenever a host device such as a computer is sending data, the data is created at the Application layer. It travels down the OSI model stack until it arrives at the Data Link layer. Then, it is placed on the Physical layer, that is, the network media, which is wired (copper or fiber) or wireless (radio frequency).
When a host receives a message on a network, it is received on the Physical layer and travels upward to the Application layer. While moving up the OSI model, each layer, such as the Data Link, Network, and Transport layers, will remove the headers until the raw datagram is delivered to the Application layer at the top. This process is commonly referred to as de-encapsulation.
Figure 1.2 shows a high-level visual representation of a computer sending application data to a server over a network. Here, the OSI network model is used as a reference:
Figure 1.2: Sending and receiving messages
Within the OSI model, the upper layers, such as the Application, Presentation, and Session layers, are used to provide support for application functions such as enabling a web browser on your computer to create and process web requests from a web server. The lower layers, such as the Transport, Network, and Data Link layers, are responsible for inserting the appropriate header with addressing and control information to ensure that the data is delivered to the intended destination over a network.
Application Layer
The Application layer is found closest to the end user within the OSI model. This layer provides an interface for enabling communication between applications that are running on the host operating system of your computer and the underlying network protocols that are responsible for delivering your message (data) to the intended destination.
For instance, you may be interested in learning about the 200-301 CCNA v1.1 exam objectives. Typically, you would open the web browser application and go to https://learningnetwork.cisco.com/s/ccna-v1-1-exam-topics, as shown in Figure 1.3:
Figure 1.3: Cisco learning network website
As shown in Figure 1.3, the web browser uses Hypertext Transfer Protocol Secure (HTTPS), an Application-layer protocol that enables the web browser to communicate with the web application that is running on Cisco’s web server. In this scenario, it is important to remember that the end user, such as yourself, will not directly interface with an Application layer such as HTTPS, but would rather use an application that is installed on your host device such as the web browser.
Figure 1.4 shows an example of an HTTP header that is created by a sender device such as a Windows computer using Mozilla Firefox as the web browser application:
Figure 1.4: HTTP header
The following are some common Application-layer protocols:
- Domain Name System (DNS): Used to resolve hostnames to IP addresses over a network.
- Dynamic Host Configuration Protocol (DHCP): Used to distribute IP addresses to connected hosts on a network.
- Hypertext Transfer Protocol (HTTP): Enables web browsers to retrieve web pages and interact with a web application over a network.
- Simple Mail Transfer Protocol (SMTP): SMTP is used to send emails from an email application to an email server, and to send emails from one email server to another over a network.
- Post Office Protocol (POP): POP is used to download a copy of emails from an email server onto an email application on the host, then deletes the emails from the email server.
- Internet Message Access Protocol (IMAP): IMAP synchronizes the email messages between an email server and an email application.
- File Transfer Protocol (FTP): This Application-layer protocol allows the transferring of files between an FTP client on a host and an FTP server.
As shown in Figure 1.5, these are just some of the many Application-layer protocols:
Figure 1.5: Application-layer protocols
Keep in mind that when data is created by an Application-layer protocol, it can only be interpreted by the same Application-layer protocol on another system. For instance, if you are using the web browser application on your smartphone to view websites, your smartphone uses HTTPS to communicate with the web server, which also uses HTTPS to interpret the data.
Figure 1.6 shows a visual representation of this analogy:
Figure 1.6: Process-to-process mapping
Since the Application-layer protocols generate the raw datagram without any addressing or formatting that is recognized by the lower layers of the OSI model, the data created in the Application layer is sent down to the Presentation layer.
Presentation Layer
For hosts that are sending data, such as a computer to a web server, the Application-layer protocols in the sender device are responsible for creating system-dependent data such as ASCII and other unique data types. The Presentation layer is responsible for transforming this system-dependent data into an independent format that is recognizable by the lower layers of the OSI model and systems on a network. On the destination device (the web server), the Presentation layer will be responsible for reversing the transformation of the independent format back to the system-dependent data before sending it upward to the appropriate Application-layer protocol, as shown in Figure 1.7:
Figure 1.7: Presentation layer
The following are the main functions of the Presentation layer:
- Data formatting: Ensuring the data that is created by a sender device is encoded in a compatible format for receipt by the intended destination device over the network
- Data compression and decompression: Responsible for compressing data before transmission and decompression upon receipt
- Data encryption and decryption: Encrypts data before transmission to ensure confidentiality over network communication, and decrypts the encrypted message on the recipient device
During this time, the PDU will still be referred to as data, and once the Presentation layer completes its tasks, the PDU will be sent down to the next layer.
Session Layer
The Session layer helps the Application-layer protocols between the sender and receiver devices to set up and maintain their communication efficiently. The following are the main functions of the Session layer:
- Create or establish a session
- Maintain the session
- Terminate the session
The Session layer is responsible for creating/establishing and maintaining the logical dialogs between the Application-layer protocols of both the sender and receiver devices over the network. In addition, the Session layer is responsible for exchanging the details that are needed to establish a dialog, maintain or keep those established dialogs active, and even restart the sessions if there is any unexpected disruption or idle timeout of the session.
After the Session layer establishes and maintains the session for data communication, the PDU is sent down to the Transport layer, where data encapsulation begins.
Transport Layer
The Transport layer is responsible for ensuring that data sent from an Application-layer protocol is delivered to the same Application-layer protocol on the destination host. Imagine if your computer was sending HTTPS messages to a destination server on the internet, and the destination server is hosting multiple server roles, such as web and email services. How will the OSI model and its layers then know which Application-layer protocol created the datagram on the sender device, and which Application-layer protocol should the datagram be delivered to on the recipient’s system?
Figure 1.8 shows a visual representation of this scenario:
Figure 1.8: Transport layer
As shown in Figure 1.8, there is a problem that needs to be solved. How can the Transport layer ensure that HTTPS messages from the sender are delivered to the same Application-layer protocol or services on the server side?
To better understand the solution to this issue, you will need to take a dive into understanding service port numbers on a system. On a sender device such as a computer or a smartphone, when the Transport layer receives data from the Application layer, it identifies the Application-layer protocol, such as HTTPS, and encapsulates a Layer 4 header onto the PDU.
Figure 1.9 shows a visual representation of encapsulating a Layer 4 header onto the datagram:
Figure 1.9: Layer 4 header encapsulation
Within the Layer 4 header, the Transport layer inserts the source and destination service port numbers. Within a network model such as the OSI and TCP/IP network models, there are 65,535 service port numbers, and each is associated with an Application-layer protocol or service.
These service ports are grouped into the following categories:
- Well-known port: 0–1,023
- Registered ports: 1,024–49,151
- Dynamic or private ports: 49,152–65,535
Since many Application-layer protocols operate in a client-server model, whereby a computer has a client application that requests services or resources from another device on a network, such as a server that provides the services and resources, the sender (client) device is usually assigned an ephemeral, random source port number and a destination port that is associated with the Application-layer protocol.
Figure 1.10 shows the role the source and destination port numbers play at the Transport layer:
Figure 1.10: Service port numbers
As shown in Figure 1.10, the Transport layer on the sender (computer) inserted the destination service port number 443, which is associated with HTTPS, and a randomly generated (ephemeral) source service port number. The destination port number helps the Transport layer on the recipient (server) to determine which Application-layer protocol the message should be sent to.
The source port number plays an important role when a recipient is responding to the sender. For instance, the sender device creates and sends an HTTP request message to the web server. This message contains the instructions to retrieve the web page from the web server. However, before the server responds to the computer (sender), it switches the source and destination port numbers on the Layer 4 header, using the original source port number as the new destination port.
Figure 1.11 shows a visual representation of the flipping of the service port numbers on the Layer 4 header by the server to ensure the message is delivered to the appropriate Application-layer protocol or process on the computer:
Figure 1.11: Reverse port numbers
As previously mentioned, there are 65,535 service port numbers. These service port numbers are categorized as shown in Figure 1.12:
Figure 1.12: Port number categories
The well-known service ports are commonly associated with the essential and most frequently used application and network services. Some of these are HTTP, HTTPS, SMTP, FTP, and IMAP. Registered port numbers are usually used by organizations that have officially registered their applications to operate on a specific number. The private/dynamic port numbers are used for temporary communication between systems on a network.
These service ports are not physical ports that are seen on networking devices; rather, they are logical ports opened by the operating system of a device for sending and receiving data on a network. Think of them as the logical doorways of your operating system. If a port is open, it means the operating system is either sending data to a destination or expecting incoming communication from a remote device.
Table 1.2 shows a list of common Application-layer protocols and their associated service port numbers:
|
Application-Layer Protocol
|
Service Port Number
|
|
File Transfer Protocol (FTP)
|
20 (Data), 21 (Control)
|
|
Secure Shell (SSH)
|
22
|
|
Telnet
|
23
|
|
Simple Mail Transfer Protocol (SMTP)
|
25
|
|
Domain Name System (DNS)
|
53
|
|
Hypertext Transfer Protocol (HTTP)
|
80
|
|
HTTP Secure (HTTPS)
|
443
|
|
Post Office Protocol (POP)
|
110
|
|
Internet Message Access Protocol (IMAP)
|
143
|
Table 1.2: Common Application-layer protocols
Note
For a list of protocols and their associated port numbers, please see https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml.
So far, you have read about the importance of service port numbers and how they are leveraged by the Transport layer to ensure process-to-process mapping between Application-layer protocols. The Transport layer is also responsible for ensuring the delivery of the Application-layer datagrams to the intended recipients over a network.
The following are the Transport-layer protocols that assist with the delivery of a datagram:
- Transmission Control Protocol (TCP)
- User Datagram Protocol (UDP)
As mentioned earlier, Application-layer protocols and processes are not responsible for ensuring that datagrams are delivered to the intended destination. They are only concerned with the creation of data. Both TCP and UDP have their advantages, disadvantages, and use cases. In the next sub-section, you will learn more about TCP.
Transmission Control Protocol
TCP is a connection-oriented protocol that establishes a logical connection between a sender and receiver over a network, before allowing the transmission of data from the Application-layer protocols or processes.
If an Application-layer protocol uses TCP as the Transport-layer protocol, a TCP Layer 4 header is encapsulated onto the data. Table 1.3 shows the various fields of a TCP header:
|
Source Port
|
Destination Port
|
|
Sequence Number
|
|
Acknowledgment Number (if ACK is set)
|
|
Data Offset
|
Reserved
|
Flags
|
Window Size
|
|
Checksum
|
Urgent Pointer (if URG is set)
|
|
Options
|
Table 1.3: TCP header
The following is a description of each field shown in Table 1.3:
Source Port: This is a 16-bit field that identifies the source service port number.
Destination Port: This is a 16-bit field that identifies the destination service port number.
Sequence Number: This is a 32-bit field that is used during the reassembly process on the recipient’s device.
Acknowledgment Number: This is a 32-bit field used to indicate the message has been received by the recipient and contains the acknowledgment number (sender’s sequence number + 1).
Data Offset: This is a 4-bit field, sometimes referred to as the header length. It is commonly used to specify the length of the TCP header.
Reserved: This is a 6-bit field that’s reserved for future use.
Flags: This field contains eight sub-fields, each being 1 bit in size and used to specify various TCP flags, such as the following:CWR: Congestion flag, used by the sender to indicate it has received a message with a TCP Explicit Congestion Notification (ECN) flag set and responded to the congestion controlECE: ECN echo flag, used to indicate whether a device is ECN capable or the congestion experienced flag is set to identify network congestionURG: Urgent flag, indicates the significance of the Urgent Pointer fieldACK: Acknowledgment flag, indicates the significance of the Acknowledgment Number fieldPSH: Push flag, indicates the push function is significantRST: Reset flag, indicates to reset the logical network connectionSYN: Synchronization flag, used to synchronize the sequence numbersFIN: Finish flag, indicates the last message from the sender device
Window Size: This is a 16-bit field that specifies the number of bits or bytes that can be received.
Checksum: This is a 16-bit field that’s used for error checking.
Urgent Pointer: Used if the TCP URG flag is set. This 16-bit field is used to indicate the last urgent data byte.
Options: This is an optional field and ranges between 0 and 320 bits.
Figure 1.13 shows a TCP header using Wireshark, a network protocol analyzer application used by network and cybersecurity professionals:
Figure 1.13: TCP header in Wireshark
Before data is sent, the sender device, such as a computer, initiates the TCP three-way handshake between itself and the intended destination, as shown in Figure 1.14:
Figure 1.14: TCP three-way handshake
The following is a technical breakdown of this process:
- The computer wants to communicate with the destination server using HTTPS as the Application-layer protocol. Since HTTPS is designed to use TCP as the preferred Transport-layer protocol, the Transport layer of the computer sends a TCP Synchronization (SYN) message to the server with the following details in the Layer 4 header:
- Source port number: This is a dynamic service port number used by the computer.
- Destination port: The destination service port number for the Application-layer protocol or process on the server.
- Randomly generated sequence number: The sequence number is used to initialize the starting sequence number for data that belongs to the same data stream.
- Window size: The window size helps both the sender and recipient to mutually agree upon the amount of data to transmit.
Figure 1.15 shows the TCP SYN message, including a sequence number:
Figure 1.15: TCP SYN
- Next, the server receives the TCP SYN message and responds with a TCP Synchronization/Acknowledgment (SYN/ACK). In this response, an acknowledgment sequence number is set. This is the sender’s sequence number + 1. In addition, the response message contains a randomly generated sequence number that informs the sender it also wants to establish a logical connection for communication, as shown in Figure 1.16:
Figure 1.16: TCP SYN/ACK
- Lastly, when the computer receives the TCP SYN/ACK message from the server to complete the TCP three-way handshake, it responds with a TCP ACK message, which contains an incremented value based on the server’s SYN sequence number, as shown in Figure 1.17:
Figure 1.17: TCP ACK
After the TCP three-way handshake is established between the sender and the destination host, data transmission occurs between the Application-layer protocols of the computer and server.
Figure 1.18 shows the TCP three-way handshake of a packet capture within Wireshark:
Figure 1.18: Packet capture
As shown in Figure 1.18, packets 1, 2, and 3 show the TCP three-way handshake. Once the handshake has been established, the Application-layer protocol HTTP sends data to the destination web server over the network. TCP is a Transport-layer protocol that provides a guarantee of the delivery of data between the sender and destination. When the destination host receives a message, it will respond with a TCP ACK packet to inform the sender it has received the message. If the sender does not receive the TCP ACK response, it will attempt to re-transmit the message until the Application-layer protocol or process experiences a timeout.
What if the Application-layer protocol on either the computer or server no longer wants to exchange data? What happens then? If the Application-layer protocol is using TCP as the preferred Transport-layer protocol, TCP will perform a TCP FIN/ACK handshake to gracefully terminate the session, as shown in Figure 1.19:
Figure 1.19: TCP FIN/ACK handshake
As shown in Figure 1.19, the computer initiates the graceful termination by sending a TCP finish (FIN) message to the server. Then, the server responds with TCP ACK and TCP FIN messages back to the computer. Lastly, the computer sends a TCP ACK to the server to confirm the termination from the server.
Figure 1.20 shows the TCP FIN/ACK messages being exchanged between a sender and receiver host to gracefully terminate their sessions:
Figure 1.20: TCP graceful termination
The following are the advantages of using TCP as the preferred Transport-layer protocol:
- It is a connection-oriented protocol that establishes a TCP three-way handshake before exchanging data.
- It provides a guarantee of delivery of data between Application-layer protocols and processes that use TCP.
- TCP delivers the data using the same order in which it was placed on the physical network and reassembled on the receiver’s device.
- It uses the window size to manage flow control between a sender and receiver device over a network.
The following are the disadvantages of using TCP over a network:
- The receiver device responds with a TCP ACK message to acknowledge receipt of the data. This introduces additional overhead on the network.
- If a host is sending multiple messages to another device, all the messages from the sender are not placed on the network for transmission. TCP will send some of the messages and wait for an acknowledgment from the recipient before proceeding to send another batch. This process is repeated, and therefore, TCP is not suitable for time-sensitive communication.
Up next, you will learn about the fundamentals of UDP.
User Datagram Protocol
Not all Application-layer protocols use TCP. Some use UDP. UDP is a connectionless Transport-layer protocol that does not guarantee the delivery of messages from a sender to a receiver over a network but is preferred for transporting time-sensitive data between hosts over a network. Unlike TCP, UDP uses best-effort techniques when sending messages and does not provide any reassurance to the sender.
Therefore, no acknowledgment is returned to the sender on whether a message is received by the intended destination host or not. If a message were to be lost or dropped along the way, the sender would not be aware of it, and as a result, they would not retransmit any lost or dropped messages to the intended destination host.
If an Application-layer protocol uses UDP as the preferred Transport-layer protocol, a UDP Layer 4 header is encapsulated onto the data. Table 1.4 shows the various fields of a UDP header:
|
Source Port
|
Destination Port
|
|
Length
|
Checksum
|
Table 1.4: UDP header fields
The following is a description of each field shown in Table 1.4:
Source Port: This is a 16-bit field that indicates the source service port number.
Destination Port: This is a 16-bit field that indicates the destination port number.
Length: This is a 16-bit field that indicates the length of the header.
Checksum: This is a 16-bit field used for error detection.
Figure 1.21 shows the UDP header using Wireshark:
Figure 1.21: UDP header in Wireshark
While many Application-layer protocols and processes use TCP, the following are the advantages of using UDP as the preferred Transport-layer protocol:
- UDP does not need to wait for an acknowledgment from the recipient before sending more data on the network to the destination host. As the data is ready, UDP sends it. This is a benefit of using UDP for time-sensitive and real-time data such as Voice over IP (VoIP) and Video over IP technologies.
- Since the recipient does not send any acknowledgment messages when using UDP, there is less overhead on the network.
The following are the disadvantages of using UDP on a network:
- It does not provide a guarantee of the delivery of data between a sender and receiver.
- If data is lost during transmission, the sender does not retransmit lost messages.
- UDP does not assist in reassembling incoming messages if they are received in an out-of-order sequence.
Once either a TCP or UDP Layer 4 header is encapsulated onto the datagram from the upper layers, it is referred to as a segment. The segment is sent down to the Network layer of the OSI model for logical addressing.
Network Layer
The Network layer of the OSI model is responsible for assigning the logical addresses, which are the IP addresses, and inserts the source and destination IP addresses in the packet header. At the Network layer, either an IPv4 or an IPv6 header is encapsulated onto the datagram. This Layer 3 header, whether it is IPv4 or IPv6, enables the message (data) to travel across different networks until it reaches the intended destination host. To put it simply, when the segment is received from the upper Transport layer, the source and destination IP addresses are appended to the message to ensure devices such as routers and firewalls are able to route the messages to a remote device or the internet if needed.
Figure 1.22 shows a visual representation of encapsulating the Layer 3 header:
Figure 1.22: Layer 3 header encapsulation
On a network, each device is assigned or configured with an IPv4 or IPv6 address, which enables them to communicate outside their local network. For instance, if a destination host is located on the internet, the source and destination IP addresses play an important role as the destination address helps the router determine how to forward the message, while the source IP address helps the recipient to identify and reply to the sender.
Figure 1.23 shows the computer (sender) inserting the source and destination IPv4 addresses to ensure the server (recipient) receives the message and verifying that the destination IPv4 address matches the IPv4 address of the server. Once the Network layer of the server verifies the destination IPv4 address, it de-encapsulates the Layer 3 header of the packet before sending it upward to the Transport layer:
Figure 1.23: Importance of the IP header
Note
When an IPv4 or IPv6 header is encapsulated at the Network layer, the PDU is referred to as a packet. Additionally, IP is a connectionless Network-layer protocol that uses best effort to deliver packets to their destination. Therefore, it relies on the Transport-layer protocols for delivery.
Table 1.5 shows the various fields within an IPv4 header:
|
Version
|
Internet Header Length
|
Differentiated Services (DS)
|
Total Length
|
|
DSCP
|
ECN
|
|
Identification
|
Flag
|
Fragment Offset
|
|
Time to Live (TTL)
|
Protocol
|
Header Checksum
|
|
Source IP Address
|
|
Destination IP Address
|
|
Options
|
Table 1.5: IPv4 header
The following are the roles and functions of each field within an IPv4 header:
Version: A 4-bit field used to identify it as an IPv4 packet.
Internet Header Length: A 4-bit field that indicates the end of the header and the beginning of the data section.
Differentiated Services (DS): An 8-bit field used to identify the priority of the packet on the network. This was originally known as the Type of Service (TOS) field and contains the following sub-fields:DSCP: This field, which stands for Differentiated Services Code Point, identifies the classification and management of the packet on networks that use Quality of Service (QoS).ECN: This field indicates network congestion without discarding packets.
Total Length: A 16-bit field that’s used to indicate the total size of the packet.
Identification: A 16-bit field that is used for identifying a group of fragments that belong to a single IP datagram.
Flag: A 3-bit field used to control or identify whether the packet is part of a fragment group.
Fragment Offset: A 13-bit field used to identify the sequencing position of a fragmented packet.
Time to Live (TTL): An 8-bit field that contains a TTL value that determines the lifespan of the packet on a network and prevents routing loops. The TTL value decreases by 1 when it arrives at a router along the path from the sender to the receiver. When TTL = 0, the packet is discarded.
Protocol: An 8-bit field used to identify the payload type that’s within the packet.
Header Checksum: A 16-bit field used for error checking of the packet.
Source IP Address: A 32-bit field indicating the sender’s IPv4 address.
Destination IP Address: A 32-bit field indicating the intended recipient’s IPv4 address.
Options: This 32-bit field is not always used by the Network layer.
A network protocol analyzer such as Wireshark enables you to inspect the fields and values of an IPv4 packet, as shown in Figure 1.24:
Figure 1.24: IPv4 header using Wireshark
Some networks use IPv6 and the Network layer is responsible for encapsulating the right version of the IP header onto the datagram to ensure it is delivered to the intended destination host. Unlike IPv4, IPv6 has a lot fewer fields within its header, as shown in Table 1.6:
|
Version
|
Traffic Class
|
Flow Control
|
|
Payload Length
|
Next Header
|
Hop Limit
|
|
Source IP Address
|
|
Destination IP Address
|
Table 1.6: IPv6 header
The following are the roles and functions of each field within an IPv6 header:
Version: A 4-bit field that identifies it’s an IPv6 packet
Traffic Class: An 8-bit field that has the same function as the DS field of an IPv4 packet, used to identify the priority of the packet on the network
Flow Control: A 2-bit field, also referred to as the Flow Label, used to inform the routers on the network to apply the same handling for IPv6 packets that have the same flow control label
Payload Length: A 16-bit field used to identify the length of the payload (data)
Next Header: An 8-bit field used to indicate the payload type
Hop Limit: An 8-bit field used to specify the TTL value
Source IP Address: A 128-bit field indicating the sender’s IPv6 address
Destination IP Address: A 128-bit field indicating the destination host’s IPv6 address
Figure 1.25 shows an IPv6 header and its field using Wireshark:
Figure 1.25: IPv6 header using Wireshark
Once the Network layer encapsulates the Layer 3 header on the data, it is sent down to the Data Link layer.
Data Link Layer
The Data Link layer is responsible for placing the datagram it receives from the upper layers onto the physical network. This layer of the OSI model takes care of managing how much data is placed on the wired or wireless network media for transmission and performing error detection for incoming messages from the physical network.
When the datagram is received from the upper Network layer, the Data Link layer encapsulates a Layer 2 header and trailer onto the datagram, as shown in Figure 1.26:
Figure 1.26: Layer 2 header and trailer
Figure 1.27 shows the various fields found within a Layer 2 header:
Figure 1.27: Layer 2 header fields
Now, take a look at the description of each field within the Layer 2 header:
Preamble and Start Frame Delimiter (SFD): The preamble is a 56-bit (7-byte) field used to indicate the start of the frame to the receiver and the SFD is an 8-bit (1-byte) field that’s used for synchronizing messages during transmission from a sender to a receiver.
Destination MAC Address: A 48-bit (6-byte) field that contains the Ethernet (MAC) address of the destination device on the local network.
Source MAC Address: A 48-bit (6-byte) field that contains the Ethernet (MAC) address of the sender on the local network.
Type/Length: This is a 16-bit (2-byte) field used for identifying the upper-layer protocol such as IPv4 or IPv6.
Data: This is a 46–1,500-byte field that contains the data from the Application-layer protocol.
Frame Check Sequence (FCS): This is a 32-bit (4-byte) field that’s used for error detection and integrity checking.
Within the Data Link layer, there are two sub-layers that are responsible for assigning Layer 2 addressing information and managing flow control. These are Logical Link Control (LLC) and MAC, as shown in Figure 1.28:
Figure 1.28: Layer 2 sub-layers
When the packet is received from the Network layer, LLC encapsulates it with a Layer 2 header that contains the Ethernet source and destination MAC addresses. In addition, LLC also appends a Layer 2 trailer to the end of the packet that contains the Frame Check Sequence (FCS). Once the packet is encapsulated with the Layer 2 header and trailer, it is referred to as a frame.
In addition, a mathematical representation of the contents of the frame, known as the Cyclic Redundancy Check (CRC), is stored within the FCS field of the Layer 2 trailer. The CRC enables the receiver device to perform integrity checks to determine whether the frame was altered or corrupted during transmission.
The MAC sub-layer of the Data Link layer is responsible for inserting the Ethernet addresses, known as the MAC addresses, into the Layer 2 header of the frame before placing the datagram onto the physical network.
Note
The Ethernet address is commonly referred to as the MAC address, burned-in address (BIA), and physical address. The Ethernet address of a host is commonly found on the network interface card (NIC) or network adapter.
A MAC address is uniquely assigned to each NIC on a device and it is unique globally. It is a 48-bit (6-byte) address that is embedded into the firmware of the NIC by the vendor who made the NIC or the device, such as a computer. This 48-bit MAC address is written in the form of hexadecimal, which ranges from 0 to 9, A to F. The first 24 bits of the MAC address are known as the organizational unique identifier (OUI), which helps network and cybersecurity professionals determine the vendor of a device once the MAC address is known. The other 24 bits are uniquely generated by the vendor of the network adapter.
Table 1.7 shows the various representations of a MAC address:
|
Organizational Unique Identifier (OUI)
|
Assigned by the Vendor
|
|
3 bytes
|
3 bytes
|
|
24 bits
|
24 bytes
|
|
00-E0-F7
|
58-1E-83
|
|
Cisco Systems
|
Device specific
|
Table 1.7: OUI portion of a MAC address
The following are common representations of MAC addresses from various vendors:
0060.5c3d.d901: Format used on Cisco devices
00-60-5c-3d-d9-01: Format used on Microsoft Windows operating systems
00:60:5c:3d:d9:01: Format used on Linux-based operating systems
To easily identify the vendor of a MAC address, you can perform a lookup using any of the following online MAC address databases:
Figure 1.29 shows an example of performing a MAC address lookup using the OUI lookup tool on the Wireshark website:
Figure 1.29: OUI lookup
Figure 1.30 shows the Ethernet header (Layer 2 header) of a frame using Wireshark:
Figure 1.30: Ethernet header
Once the Data Link layer completes its task, it sends the frame to the Physical layer of the OSI model.
Physical Layer
Before the frame is sent to the Physical layer, the Data Link layer hands over the frame to the network adapter or NIC of the sender’s device such as a computer. The sender’s network adapter is responsible for ensuring the frame is placed on the network media, whether the media is a copper cable, fiber optic cable, or radio frequency. Therefore, the entire frame is converted into bits that are represented as electrical signals on a wire or the radio frequency that is being transmitted on a wireless network. These bits are also represented as ones and zeroes when written in binary format.
Figure 1.31 shows the responsibility of the Physical layer:
Figure 1.31: Physical layer
To put it simply, the ensure frame is not placed on the physical media. It is broken down into ones and zeroes. However, these ones and zeroes are sent as high and low voltages over a copper cable from the sender device, such as a computer to a network device. On the sender’s device, the network adapter is responsible for encoding the frame into bits, creating a data stream that is recognizable by both the sender and receiver devices. Additionally, the network adapter is responsible for ensuring that the bits are converted into the appropriate signal to be transported over the network media.
For instance, if the network media is using a copper cable, then the signal is converted into electrical signals by the network adapter. If the network media is a fiber optic cable, then the network adapter converts the bits into light signals. Lastly, if the network media is using wireless communication, then the network adapter converts the signal into radio frequency for transmission.
The OSI network model did not gain enough traction to be widely adopted and eventually became a reference model. Hence, many network professionals commonly refer to the OSI network model as the OSI reference model.