Monday 1 April 2013


The Packet Creation Process 

The OSI model is all-to-often described without any perspective of why this stuff is actually important. The answer is simple if you just take the time to put it all together in a reasonable scenario; it truly explains what happens when 2 systems actually communicate. The key to understanding the model is to look at it with respect to how a packet is built on the source system and then stripped apart at the receiving end. This process is referred to as data encapsulation.

Data encapsulation is the process by which a packet is built. It all begins which a chunk of data from the application layer. Maybe you want to view a web page or send a file over the network to another system. In order to get to that other system, information will need to be added to the data to account for reliability, how its going to get to where it needs to go, and the network technology in use.

When looking at the OSI model, the 7 Layers are often grouped into 2 main sections. The top section, comprised of the Application, Presentation and Session Layers, are often referred to as the Application layers, while the bottom four are often generically referred to as the Transport layers. For the purpose of looking at the data encapsulation process, the Applications layers are generally considered to simply pass data, while the Transport layers actually ‘add' to the data to help prepare it to make its way across the network.

Remember that the chunk of data is passed down the layers for formatting. Once it reaches the transport layer, it makes its first big change, usually in the form of header and trailer data being added. At each subsequent layer (except the physical layer, which doesn't change the packet) more header and trailer data is added again. This process is referred to as encapsulation, which each layer literally adding to the packet building process.

A key thing to understand is that as each layer receives the packet and adds to it, it considers everything passes down to it as simple data. That is, whatever the transport layer adds is not of concern to the network layer, and so forth. In that way, each lower layer simply considers what is being passed down to it as data. Consider the diagram below, which outlines how each of these layers changes the data




What happens above is easily explained, even though the diagram is highly simplified. Once data is passed to the transport layer, it adds header (and trailer, not shown) information to the data. If this were a TCP/IP packet, that would include TCP or UDP source and destination port information. The network layer would see this all as data, not concerned with what was added. Instead, it would encapsulate the data with another header, which would involve adding the source and destination IP addresses. When passed down to the Data Link layer, still another header would be added - in the case of an Ethernet network, this would include the source and destination MAC addresses. This would then be passed to the Physical layer, in the form of binary data being transmitted across the network.

At the receiving end, the data would subsequently by de-encapsulated, layer by layer in the opposite direction. For example, the receiving station would receive the data stream and pass it up to the data link layer.

1. If this station noticed that its MAC address were the destination MAC address, it would know that it has to pay attention and process the packet, striping off the data link header and passing it up to the network layer. If not, it would simply discard the packet at this point.

2. Next, it will pass the packet up to the Network Layer. At this point, it will determine whether the destination IP address is its IP address. If so, it will strip off the network header and pass it up to the transport layer. You should note that just because the MAC address belongs to the system, it doesn't necessarily mean that the IP address does as well. For example, a router will receive many packets with its MAC address and different IP destination addresses, a subject we'll broach once we get into routing.

3. Once the packet has been passed up to the Transport layer, it is definitely destined for this system. This layer will take a look at the destination port listed in the header, strip the header, and then pass the data to the appropriate application that is waiting for the data, assuming that application exists (it may not - imaging a request for a web page from a system not running as a web server)

Note:  At each point in the process, a layer only looks at the information added by its equivalent layer at the sending machine. To that end, the only layers that a given layer ever interacts with are the equivalent layers on other systems, as well as the layers directly above and below it on the same system. The fact that layers are independent of each other is another design goal of the OSI model - changing a given layer should not effect other layers in the model.

One last note with respect to the encapsulation process described above. As each layer changes the data, the reference name for that data unit is changed. ‘Packet' is a generic name often used to describe the unit at any stage of the process. However, the following terms are commonly used to describe data at different network layers:


  • Data units above the Transport layer = Messages
  • Transport layer data units = Segments
  • Network layer data units = Datagrams or Packets
  • Data Link layer data units = Frames


1 comment:

  1. It defines the type of physical medium used for data transmission, such as copper wires, fiber optics, or wireless channels.lk21

    ReplyDelete