As the importance of computers grows, vendors recognized the require for networking them. They produced a variety of protocols whose specifications were not made public. Hence each vendor had different ways of networking computers and these ways were not compatible with each other. This means that computers of one vendor could not be networked with another vendor’s computers. Slowly these specifications were made public and some inter-vendor compatibility was created but this still represented too many complications.
Open System Interconnection(OSI) Model
In 1977 the International Organization for Standardization (ISO) started working on an open standard networking model that all vendors would support to promote interoperability. This standard was published in 1984 and was known as the Open Systems Interconnection (OSI) Model.
The OSI reference model was created to support communication between devices of various vendors. It also promotes communication between disparate hosts such as hosts using different operating platforms. Keep in mind that you are very unlikely to ever work on a system that uses protocols conforming to the OSI reference model. But it is essential to know the model and its terminology because other models such as the TCP/IP model are often compared to the OSI reference model. Hence the discussion on this model will be limited compared to the discussion on the TCP/IP model.
The OSI reference model, like most other network models, divides the functions, protocols; and devices of a network into various layers. The OSI reference model has seven such layers that can be divided into two groups. The upper layers (Layers 7, 6 and 5) define how applications interact with the host interface, with each other, and the user. The lower four layers (Layers 4, 3, 2 and 1) define how data is transmitted between hosts in a network. Figure 1-6 shows the seven layers and a summary of their functions.
The layered approach provides many benefits, some of which are:
- Communication is divided into smaller and simpler components
- Since it is a layered approach, the vendors write to a common input and output specification per layer. The guts of their products function in between the input and output code of that layer.
- Changes in one layer do not affect other layers. Hence development in one layer is not bound by limitations of other layers. For example, wireless technologies are new but old applications run seamlessly over them without any changes.
- It is easier to normalize functions when they are divided into smaller parts like this.
It allows various types of hardware and software, both new and old to communicate with each other seamlessly
The following section describes the 7 layers in detail.
This Layer provides the interface between the software application on a system and the network. Remember that this layer does not include the application itself, but provides services that an application requires. One of the easiest ways to understand this layer’s function is to look at how a Web Browser such as Internet Explorer or Firefox works is the application. When it needs to fetch a web page, it uses the HTTP protocol to send the request and receive the page contents. This protocol resides at the application layer and can be used by an application such as IE or FF to get web pages from web servers across the network. On the other side, the web server application such as Apache or IIS interacts with the HTTP protocol on the Application layer to receive the HTTP request and send the response back.
This layer presents data to the Application layer. The Presentation Layer is also responsible for data translation and encoding. It will take the data from the Application layer and translate it into a generic format for transfer across the network. At the receiving end, the Presentation layer takes in generically formatted data and translates into the format recognized by the Application layer. An example of this is a JPEG to ASCII translation. The OSI model has protocol standards that define how data should be formatted. This layer is also involved in data compression, decompression, encryption, and decryption.
In a host, different applications or even different instances of the same application might request data from across the network. It is the Sessions layer’s responsibility to keep the data from each session separate. It is responsible for setting up, managing and tearing down sessions. its also provides dialog control and coordinates communication between the systems.
Where the upper layers are related to applications and data within the host, the transport layer is concerned with the actual end-to-end transfer of the data across the network. This layer establishes a logical connection between the two communicating hosts and provides reliable or unreliable data delivery and can provide flow control and error recovery. Although not developed under the OSI Reference Model and not strictly conforming to the OSI definition of the Transport Layer, typical examples of Layer 4 are the Transmission Control Protocol (TCP) and User Datagram Protocol (UDP). These protocols will be discussed in great detail later in this chapter.
To best understand what the Network layer does, consider what happens when you write a letter and use the postal service to send the letter. You put the letter in an envelope and write the destination address as well as your own address so that an undelivered letter can be returned back to you.
In network terms, this address is called a logical address and is unique in the network. Each host has a logical address. When the post office receives this letter. it has to ascertain the best path for this letter to reach the destination. Similarly, in a network, a router needs to determine the best path to a destination address. This is called path determination. Finally, the post office sends the letter out the best path and it moves from the post office to post office before finally being delivered to the destination address. Similarly, data is moved across network mainly by routers before being finally delivered to the destination.
All these three functions – logical addressing, path determination and forwarding – are done at the Network Layer. Two types of protocols are used for these functions – routed protocols are used for logical addressing and forwarding while routing protocols are used for path determinations. There are many routed protocols and routing protocols available. Some of the common ones are discussed in great detail later in the book. Routers function in this layer. Remember that routers only care about the destination network. They do not care about the destination host itself. The task of delivery to the destination host lies on the Data Link Layer.
Data Link Layer
The Network layer deals with data moving across networks using logical addresses. On the other hand, the Data Link layer deals with data moving within a local network using physical addresses. Each host has a logical address and a physical address. The physical address is only locally significant and is not used beyond the network boundaries (across a router). This layer also defines protocols that are used to send and receive data across the media. You will remember from earlier in the chapter that only a single host can send data at a time in a collision domain or else packets will collide and cause a host to back off for some time. The Data Link layer determines when the media is ready for the host to send the data and also detects collisions and other errors in received data. Switches function in this layer.
This layer deals with the physical transmission medium itself. It activates, maintains and deactivates the physical link between systems (host and switch for example). This is where the connectors, pinouts, cables, electrical currents etc. are defined. Essentially this layer puts the data on the physical media as bits and receives it in the same way. Hubs work at this layer.
In the previous sections, you learned about various layers of the OSI reference model. Each layer has its distinct function and it interacts with the corresponding layer at the remote end. For example, the transport layer at the source will interact with the transport layer of the destination. For this interaction, each layer adds a header in front of the data from the previous layer. This header contains control information related to the protocol being used at that layer. This process is called encapsulation. This header and the data being sent from one layer to the next lower layer is called a Protocol Data Unit (PDU). Figure 1-7 shows how data gets encapsulated as it travels from layer 7 down to layer 1.
Data Encapsulation Process
As shown in Figure 1-7, The Application layer adds its protocol dependent header to the data and creates the Layer 7 PDU. Which is then passed down to the Presentation Layer. This layer then adds its header to the Layer 7 PDU to create the Layer 6 PDU and sends it down to the Session layer. This goes on till Layer 2 receives the Layer 3 PDU. Layer 2 adds a header and a trailer to the Layer 3 PDU to create the Layer 2 PDU that is then sent to Layer 1 for transmission. Data transmission in electrical signals it’s just 0s and 1s
At the receiving end, Layer 1 takes the data off the wire and sends it to Layer 2. Here the Layer 2 header and trailer are examined and removed. The resulting Layer 3 PDU is sent to Layer 3. Layer 3, in turn, examines the header in the PDU and removes it. The resulting Layer 4 PDU is sent to Layer 4. Similarly, each layer removes the header added by the corresponding layer at the source before sending the data to the upper layer. Finally, the Application layer removes the Layer 7 header and sends the data to the application. This process of examining, processing and removing the header is known as decapsulation.
During the same time period (1973 to 1985) another effort by the Defense Advanced Research Projects Agency (DARPA) was underway to create an open standard network model. This network model came to be known as the TCP/IP Model. By 1985, the TCP/IP model started gaining more importance and support from vendors and ultimately replaced the OSI model.
The TCP/IP model was on the path of development when the OSI standard was published. The TCP/IP model is not same as OSI model. OSI is a seven-layered standard, but TCP/IP is a four-layered standard. The OSI model has been very important in the growth and development of TCP/IP standard, and that is why much OSI terminology is applied to TCP/IP. Both models are open standard networking models. However, the TCP/IP model has found more acceptance today and the TCP/IP protocol suite is more commonly used. Just like the OSI reference model, the TCP/IP model takes a layered approach. In this section, we will look at all the layers of the TCP/IP model and various protocols used in those layers.
The TCP/IP model is a reduced version of the OSI reference model consisting of the following 4 layers:
- Application Layer
- Transport Layer
- Internet Layer
- Network Access Layer
The functions of these four layers are comparable to the functions of the seven layers of the OSI model. Figure 1-7 shows the comparison between the layers of the two models.
The following sections discuss each of the four layers and protocols in those layers in detail.
Figure 1-7 Comparison of TCP/IP and OSI models
As we can see from the above figure, presentation and session layers are not there in TCP/IP model. Also, note that the Network Access Layer in TCP/IP model combines the functions of Datalink Layer and Physical Layer.
Application Layer of TCP/IP model
The application layer is the topmost layer of TCP/IP model. The application layer is present on the top of the Transport layer. Application layer defines TCP/IP application protocols and how host programs interface with Transport layer services to use the network.
The Application Layer of the TCP/IP Model consists of various protocols that perform all the functions of the OSI model’s Application, Presentation, and Session layers. This includes interaction with the application, data translation and encoding, dialogue control and communication coordination between systems.
Application layer includes all the higher-level protocols like DNS (Domain Naming System), HTTP (Hypertext Transfer Protocol), Telnet, SSH, FTP (File Transfer Protocol), TFTP (Trivial File Transfer Protocol), SNMP (Simple Network Management Protocol),SMTP (Simple Mail Transfer Protocol) , DHCP (Dynamic Host Configuration Protocol), X Windows, RDP (Remote Desktop Protocol) etc.
Transport Layer of TCP/IP model
Transport Layer is the third layer of the TCP/IP model. The position of the Transport layer is between the Application layer and Internet layer. The purpose of Transport layer is to permit devices on the source and destination hosts to carry on a conversation. Transport layer defines the level of service and status of the connection used when transporting data. The main protocols included at Transport layer are TCP (Transmission Control Protocol) and UDP (User Datagram Protocol).
TCP/IP transport layer’s function is same as the OSI layer’s transport layer. It is concerned with end-to-end transportation of data and setups up a logical connection between the hosts.
TCP is a connection-oriented and reliable protocol that uses windowing to control the flow and provides ordered delivery of the data in segments. On the other hand, UDP simply transfers the data without the bells and whistles. Though these two protocols are different in many ways, they perform the same function of transferring data and they use a concept called port numbers to do this. Port number will be discussed in next article.
Internet Layer of TCP/IP model
Once TCP and UDP have segmented the data and have added their headers, they send the segment down to the Network layer. The destination host may reside in a different network far from the host divided by multiple routers. It is the task of the Internet Layer to ensure that the segment is moved across the networks to the destination network
Internet layer pack data into data packets known as IP datagrams, which contain source and destination address (logical address or IP address) information that is used to forward the datagrams between hosts and across networks. The Internet layer is also responsible for the routing of IP datagrams.
Packet switching network depends on a connectionless internetwork layer. This layer is known as Internet layer. Its job is to allow hosts to insert packets into any network and have them to deliver independently to the destination. At the destination side data, packets may appear in a different order than they were sent. It is the job of the higher layers to rearrange them in order to deliver them to proper network applications operating at the Application layer.
The main protocols included at Internet layer are IP (Internet Protocol), ICMP (Internet Control Message Protocol), ARP (Address Resolution Protocol), RARP (Reverse Address Resolution Protocol) and IGMP (Internet Group Management Protocol).
The Internet layer of the TCP/IP model corresponds to the Network layer of the OSI reference model in function. It provides logical addressing, path determination, and forwarding.
Network Access Layer of TCP/IP model
The Network Access Layer is the first layer of the TCP/IP model. Network Access Layer defines details of how data is physically sent through the network. It is already including how bits are electrically or optically signaled by hardware devices that interface directly with a network medium, such as coaxial cable, optical fiber, or twisted pair copper wire. The protocols of Network Access Layer are Ethernet, Token Ring, FDDI, X.25, Frame Relay etc.
LAN architecture is the most popular among those listed above is Ethernet. Ethernet uses an Access Method called CSMA/CD (Carrier Sense Multiple Access/Collision Detection) to access the media when Ethernet operates in a shared media.
IN CSMA/CD Access Method, every host has equal access to the medium and can place data on the wire when the wire is free from traffic or in the idle position. When a host wants to place data on the wire. It will check the wire to find out whether another host is already using the medium. If there is traffic already in the medium, the host will wait and if there is no traffic, it will place the data in the medium. But, if two systems place data on the medium at the same instance; they will collide with each other, destroying the data. If the data is destroyed during transmission. This data will need to be retransmitted. After the collision, each host will wait for a small interval of time and again the data will be retransmitted.