Basic Needs for TCP/IP Communication
Some of the applications we use require us to move data across a network from point A to point B. The Transmission Control Protocol/Internet Protocol (TCP/IP) network provides a framework for transmitting this data, and it requires some basic information from us to move this data.
We need to specify if we want the most reliable or fastest transmissions and we need to specify where we want the data delivered. Sometimes our data is routed based on its IP addresses and sometimes its routed based on its MAC address. The data we send needs both addressing capabilities. This information needs to be sent along with all transmitted data. We also need to physically transmit the data from one location to another.
TCP/IP Five Layer Software Model Overview
We need to provide this basic information needed by TCP/IP in a standard format the network can understand. This format is provided by its five-layer software model.
Each layer provides TCP/IP with the basic information it needs to move our data across the network. These layers group functions according to the task that needs to be performed. Every function in this model is targeted to help a specific layer perform its job.
Each layer only communicates with adjacent layers. Software running in a higher layer does not have to know about or perform tasks delegated to lower layer functions and vice versa. For example, the software you write for your application only needs to know how to request a connection with a remote host using the Transport layer. It doesn’t need to know how bits are encoded before transmission. That’s the Physical layer’s job.
You are probably familiar with the seven-layer OSI model. TCP/IP simplifies this model to five layers. OSI stands for Open Systems Interconnect which is a standard communication systems model. The top four layers of the seven layer OSI model have been condensed into the top two TCP/IP layers.
TCP/IP Five
Layer Model Summary
Before we discuss each layer, let’s briefly summarize what each layer does.
Application Layer
As you might have guessed, the Application layer is where applications requiring network communications live. Examples of these applications include email clients and web browsers. These applications use the Transport Layer to send requests to connect to remote hosts.
Transport Layer
The Transport layer establishes the connection between applications running on different hosts. It uses TCP for reliable connections and UDP for fast connections. It keeps track of the processes running in the applications above it by assigning port numbers to them and uses the Network layer to access the TCP/IP network.
Network Layer
The Network layer is responsible for creating the packets that move across the network. It uses IP addresses to identify the packet’s source and destination.
Data Link Layer
The Data Link layer is responsible for creating the frames that move across the network. These frames encapsulate the packets and use MAC addresses to identify the source and destination.
Physical Layer
The Physical layer encodes and decodes the bits found in a frame and includes the transceiver that drives and receives the signals on the network.
Transmit Data Using Network Layers
Now that we know the primary job of each layer, let’s see how they work together to send and receive data across a TCP/IP network.
This is a simplified view of how the network layers work together to generate frames. Higher layers pass information to lower layers. Each layer adds information called a header to the data being passed to it. This header contains information the layer needs to perform its job. We will start at the Application layer.
Application Layer
The Application layer generates a message. In this case, the specific application is a web browser requesting a webpage download. This message is then sent to the Transport layer.
Transport Layer
The Transport layer adds the TCP or UDP header which includes the source and destination port addresses. Additional information like the packet sequence number used for TCP will also be added to the header. The data generated by the transport layer is referred to as a Segment if TCP is used, and is referred to as a Datagram if UDP is used. This segment is then sent to the Network layer.
Network Layer
The Network layer adds a header including the source and destination IP address to generate a packet. This packet is then sent to the Data Link layer.
Data Link Layer
The Data Link layer adds a header containing the MAC address information to create a frame. The frame is then sent it to the Physical layer to transmit the bits.