OSI and TCP/IP Models

OSI Model

The OSI model was the first generally accepted reference model used to describe networking communication. While it’s still very much part of the lexicon, today’s networks run almost exclusively on TCP/IP. Let’s briefly touch on the layers of the OSI model and their functionality. We’ll continue to reference these layers when we cover the TCP/IP model later.

            OSI
     .--------------
  7  |  Application |
      --------------
  6  | Presentation |
      --------------
  5  |    Session   |
      --------------
  4  |   Transport  |
      --------------
  3  |    Network   |
      --------------
  2  |   Data Link  |
      --------------
  1  |   Physical   |
      --------------

Application

The top layer is where the software comes closest to the user. In the OSI model, layer 7 refers to protocols such as File Transfer and Access Management (FTAM) Protocol and X.400 Mail.

Presentation

As with all the layers, Layer 6 acts as the intermediary between the layer above it and the one below. The Presentation layer, often referred to as the syntax layer, formats the data from the Session layer and ‘Presents’ it in a format requires by the Application layer. This would include External Data Representation (XDR) Standard and Multipurpose Internet Mail Extensions (MIME).

Session

The Session layer creates, maintains and terminates the process conversations between two end points. For instance if a connection is inactive the protocol is designed to close it.

Transport

Layer 4 is responsible for ensuring that the data gets from one end point to the other. The Transport layer deals with segmentation as well as flow and error control.

Network

The Network layer controls how traffic gets from one end point to the other. This layer deals with addressing and routing.

Data Link

Layer 2 provides the link between two end points for transmission of data.

Physical

The Physical layer covers the transmission medium. This includes electrical signals, light and even the pins and connectors of the cables used.

TCP/IP Models

Now let’s take a look at the TCP/IP models and how they compare to OSI. The first TCP/IP model as defined by the RFC-1122 is the most commonly referenced TCP/IP model. Since the 4-layer model was developed a new 5-layer TCP/IP model has emerged which in effect bridges the divide between the 7-layer OSI model and the 4-layer TCP/IP model.

            OSI            TCP/IP (RFC-1122)      5-Layer TCP/IP
     .--------------       .--------------       .--------------
  7  |  Application |      |              |      |              |
      --------------       |              |      |              |
  6  | Presentation |      |  Application |      |  Application |
      --------------       |              |      |              |
  5  |    Session   |      |              |      |              |
      --------------        --------------        --------------
  4  |   Transport  |      |   Transport  |      |  Transport   |
      --------------        --------------        --------------
  3  |    Network   |      |   Internet   |      |   Network    |
      --------------        --------------        --------------
  2  |   Data Link  |      |              |      |  Data Link   |
      --------------       |     Link     |       --------------
  1  |   Physical   |      |              |      |  Physical    |
      --------------        --------------        --------------

Application

As with our OSI model above, the TCP/IP model also contains an Application layer. The difference here is that the TCP/IP Application layer covers the Application, Presentation and Session layers of the OSI model. Examples of this layer would be HTTP, FTP and SMTP.

Transport

The Transport layer is shared among all our models and likewise is represented most commonly by the TCP and UDP protocols.

Internet / Network

Depending on the TCP/IP model you reference the third layer has a few possible names, but the function is the same. The 4-layer model refers to layer 3 as Internet while the 5-layer TCP/IP model refers to it as the Network layer. With examples like IPv4, IPv6, ICMP and IGMP you may recognize this as the realm of routers.

Layer 2 & Layer 1

Here lies the greatest difference the two TCP/IP models. In the 4-layer TCP/IP model the Layer 1 is called the Link layer and encompasses both the first and second layer of the OSI model. In the 5-layer model these are two distinct layers, called the Data Link and Physical layers which more closely mirror the OSI model.

Link (4-layer model)

In the 4-layer model, the bottom layer is responsible for both adding the link layer headers and the transmission of the frame. Simply put, it creates the link between two end points and transfers the data across.

Data Link (5-layer model)

In the 5-layer model the Data Link layer is responsible for the link layer header and defines when the transfers can occur over a particular medium. The Data Link layer references the Ethernet standard and is where switches operate.

Physical (5-layer model)

Like the OSI model, Layer 1 is responsible for the actually transmission of the data across the medium. Hubs are layer 1 as they have no knowledge of frames and simply repeat electrical signals.

Encapsulation

Before moving onto a practical example let’s take a look at encapsulation. Encapsulation is when headers are added to data. When data is transferred between the Transport, Network and Data Link layers of the TCP/IP model each will add (or remove) headers to that data. Once encapsulated the new unit gets a name dependent on which layer added the header.

Data is created at the Application layer. This data is passed to the Transport layer which adds a TCP header (or UDP header). We now have a segment (or datagram). The segment is passed to the Network layer which adds the IP header to become a packet. This in turn is passed to the Data Link layer which adds an Ethernet header and trailer to become a frame.

    .--------------
    |              |
    |              |      .------
  5 |  Application |      | Data |  
    |              |       ------
    |              |
     --------------       .------    .------
  4 |  Transport   |      | TCP  | + | Data |                              Segment/Datagram
     --------------        ------     ------ ------
  3 |   Network    |      | IP   | + |  TCP | Data |                       Packet
     --------------        ------     ------ ------ ------    .-----
  2 |  Data Link   |      | DL   | + | IP   | TCP  | Data | + | DL  |      Frame
     --------------        ------     ------ ------ ------     -----
  1 |  Physical    |
     --------------

It’s worth noting that there can be confusion regarding the names of these encapsulated units. For example many people will call the Network layer units IP datagram (not to be confused to UDP datagram). Those more familiar with the OSI model may call these packets, or IP packets. To make matters worse, the term packet is often used when referring to any data crossing the network.

In Practice

To make sense of all this, let’s take a look at an example using the 5-layer TCP/IP model. In this example we’ll use a scenario where a client requests data from a server.

  .--------                    .--------
  | Client |                   | Server |
   --------                     --------
      ||                           ||
  .---------     .--------     .---------  
  | SwitchA | == | Router | == | SwitchB |
   ---------      --------      ---------
  1. Our client opens a web browser and requests a website. On the Application layer (Layer 5) we are creating a request using HTTP.
  2. At the Transport layer (Layer 4) the HTTP request is encapsulated into segments for transfer via TCP.
  3. The segments are then passed to the Network layer (Layer 3) and become packets with a source and destination IP.
  4. On the Data Link layer (Layer 2) the packets are encapsulated into frames for ethernet transmission.
  5. On the Physical layer (Layer 1) these frames are transferred as electrical signals from the client’s network interface to a port on the SwitchA.
  6. SwitchA receives the electrical signals on the Physical layer and rebuilds the frames on the Data Link layer. It then performs a MAC address look-up and uses electrical signals on the Physical layer to send the Data Link layer frames out the switch port where the router is connected.
  7. The router receives these Physical layer electrical signals which it builds back into Data Link layer frames. The frame encapsulation is stripped and the router compares the Network layer IP information against its routing table to find the destination. It then encapsulates the frame on the Data Link layer and sends it across to SwitchB as Physical layer electrical signals.
  8. SwitchB receives the electrical signals on the Physical layer which are passed up to the Network layer to build the frames. The frames are forwarded up to the server on the Physical layer.
  9. The server receives the Physical layer signals and builds the Data Link layer frames.
  10. At this point we move back up the TCP/IP model. The frames are stripped of their encapsulation and processed by the Network layer.
  11. The Network layer removes the packet encapsulation and hands off to the Transport layer.
  12. The Transport layer removes the segment encapsulation and finally provides the data to the Application layer.
  13. On the Application layer the HTTP request is processed.

Leave a Reply

Your email address will not be published. Required fields are marked *