Tuesday, September 29, 2009

Understanding the OSI Model

International Organization for Standardization (ISO) began developing the Open Systems Interconnection (OSI) reference model in 1977. OSI has since become the most widely accepted model for understanding network communication; once you understand how the OSI model works, you can use it to compare network implementations on different systems.

When you want to communicate with another person, you need to have two things in common: a communication language and a communication medium. Computer networks are no different; for communication to take place on a network composed of a variety of different network devices, both the language and the medium must be clearly defined. The OSI model (and networking models developed by other organizations) attempts to define rules that cover both the generalities and the specifics of networks:
  • How network devices contact each other and, if they have different languages, how they communicate with each other
  • Methods by which a device on a network knows when to transmit data and when not to transmit it
  • Methods to ensure that network transmissions are received correctly and by the right recipient
  • How the physical transmission media is arranged and connected
  • How to ensure that network devices maintain a proper rate of data flow
  • How bits are represented on the network media
The OSI model isn’t a product. It’s just a conceptual framework you can use to better understand the complex interactions taking place among the various devices on a network. It doesn’t do anything in the communication process; appropriate software and hardware do the actual work. The OSI model simply defines which tasks need to be done and which protocols will handle those tasks at each of the seven layers of the model. The seven layers are as follows:
  • Application (layer 7)
  • Presentation (layer 6)
  • Session (layer 5)
  • Transport (layer 4)
  • Network (layer 3)
  • Data-Link (layer 2)
  • Physical (layer 1)

Protocol Stacks

The OSI model splits communication tasks into smaller pieces called subtasks. Protocol implementations are computer processes that handle these subtasks. Specific protocols fulfill subtasks at specific layers of the OSI model. When these protocols are grouped together to complete a whole task, the assemblage of code is called a protocol stack. The stack is just a group of protocols, arranged in layers, that implements an entire communication process. Each layer of the OSI model has a different protocol associated with it. When more than one protocol is needed to complete a communication process, the protocols are grouped together in a stack. An example of a protocol stack is TCP/IP, which is widely used by Unix and the Internet—the TCP and IP protocols are implemented at different OSI layers.


Each layer in the protocol stack receives services from the layer below it and provides services to the layer above it. It can be better explained like this: layer N uses the services of the layer below it (layer N – 1) and provides services to the layer above it (layer N + 1). For two computers to communicate, the same protocol stacks must be running on each computer. Each layer on both computers’ stacks must use compatible protocols in order for the machines to communicate with each other. The computers can have different operating systems and still be able to communicate if they are running the same protocol stacks. For example, a DOS machine running IP can communicate with a Macintosh machine running IP (see Figure 1.1).


When sending data, each layer in the OSI model places its own information onto the data as it passes down the stack in a process called encapsulation. Encapsulation takes place when each layer adds its own header and sometimes trailer information onto the data. When the data is received, it works its way back up the protocol stack, and the corresponding layer of the protocol stack reads this information.


The Physical Layer

The Physical layer is responsible for using electric (or sometimes other types of) signaling to get bits from one computer to another. Physical layer components don’t care what the bits mean ; their job is to get the bits from point A to point B, using whatever kind of optical, electrical, or wireless connection that connects the points. This level defines physical and electrical details, such as what will represent a 1 or a 0, how many pins a network connector will have, and when the network adapter can or cannot transmit the data (see Figure 1.2).


The Physical layer addresses all the small details of the actual physical connection between the computer and the network medium, including the following:
  • Network connection types, including multipoint and point-to-point connections.
  • Physical topologies, or how the network is physically laid out (for example, bus, star, or ring).
  • Which analog and digital signaling methods are used to encode data in the analog and digital signals.
  • Bit synchronization, which deals with keeping the sender and receiver in sync as they read and write data.
  • Multiplexing, or the process of combining several data channels into one.
  • Termination, which prevents signals from reflecting back through the cable and causing signal and packet errors. It also indicates the last node in a network segment.

The Data-Link Layer

The Data-Link layer provides for the flow of data over a single physical link from one device to another. It accepts packets from the Network layer and packages the information into data units called frames; these frames are presented to the Physical layer for transmission. The Data-Link layer adds control information, such as the frame type, to the data being sent.

This layer also provides for the error-free transfer of frames from one computer to another. A cyclic redundancy check (CRC) added to the data frame can detect damaged frames, and the
Data-Link layer in the receiving computer can request that the CRC information be present so
that it can check incoming frames for errors. The Data-Link layer can also detect when frames are lost and request that those frames be sent again.

In broadcast networks such as Ethernet, all devices on the LAN receive the data that any device transmits. (Whether a network is broadcast or point-to-point is determined by the network protocols used to transmit data over it.) The Data-Link layer on a particular device is responsible for recognizing frames addressed to that device and throwing the rest away, much as you might sort through your daily mail to separate good stuff from junk. Figure 1.3 shows how the Data-Link layer establishes an error-free connection between two devices.

The Institute of Electrical and Electronics Engineers (IEEE) developed a protocol specification known as IEEE 802.X. (802.2 is the standard that divides this layer into two sublayers. The Media Access Control layer, more commonly called the MAC layer, varies depending on the network type and is described further in standards 802.3 through 802.5.) As part of that specification (which today we know as Ethernet), the Data-Link layer is split into two sublayers:
  • The Logical Link Control (LLC) layer establishes and maintains the logical communication links between the communicating devices.
  • The Media Access Control (MAC) layer acts like an airport control tower—it controls the way multiple devices share the same media channel in the same way that a control tower regulates the flow of air traffic into and out of an airport.
Figure 1.4 illustrates the division of the Data-Link layer into the LLC and MAC layers.


The Network Layer

The Network layer handles moving packets between devices. It makes routing decisions and forwards packets as necessary to help them travel to their intended destination. In larger networks, there may be intermediate devices and subnetworks between any two end systems. The network layer makes it possible for the Transport layer (and layers above it) to send packets without being concerned with whether the end system is on the same piece of network cable or on the other end of a large wide area network.

To do its job, the Network layer translates logical network addresses into physical machine addresses (MAC addresses, which operate at the Data-Link layer). The Network layer also determines the quality of service (such as the priority of the message) and the route a message will take if there are several ways a message can get to its destination.

The Network layer also may split large packets into smaller chunks if the packet is larger than the largest data frame the Data-Link layer will accept. The Network layer reassembles the chunks into packets at the receiving end.

Intermediate systems that perform only routing and relaying functions and do not provide an environment for executing user programs can implement just the first three OSI network layers. Figure 1.5 shows how the Network layer moves packets across multiple links in a network.


The Network layer performs several important functions that enable data to arrive at its destination. The protocols at this layer may choose a specific route through an internetwork to avoid the excess traffic caused by sending data over networks and segments that don’t need access to it. The Network layer serves to support communications between logically separate networks. This layer is concerned with the following:
  • Addressing, including logical network addresses and service addresses
  • Circuit, message, and packet switching
  • Route discovery and route selection
  • Connection services, including Network layer flow control, Network layer error control, and packet sequence control
  • Gateway services

The Transport Layer

The Transport layer ensures that data is delivered error-free, in sequence, and with no losses or duplications. This layer also can break large messages from the Session layer into smaller segments to be handed down to the Network layer and sent to the destination computer; it then reassembles segments into messages to be presented to the Session layer. The Transport layer can send an acknowledgment to the originator for messages received (as in Figure 1.6). Most of these services are optional and are not required in the implementation of all Transport layer protocols. The one feature common to all protocols at the Transport layer is upper-layer protocol multiplexing, allowing multiple higher-layer protocol flows to operate simultaneously.

In terms of TCP/IP, this means you could, for example, navigate to a website and download a file at the same time.

Transmission Control Protocol (TCP) and User Datagram Protocol (UDP) are examples of protocols that exist at the Transport layer.


The Session Layer

The Session layer allows applications on separate computers to share a connection called a session. This layer provides services that allow two programs to find each other and establish the communication link, such as name lookup and security. The Session layer also provides for data synchronization and check pointing so that in the event of a network failure, only the data sent after the point of failure would need to be re-sent. This layer also controls the dialogue between two processes and determines who can transmit and who can receive at what point during the communication (see Figure 1.7).


NetBIOS, RPC, Named Pipes, PPTP, and SQL are examples of protocols on the Session layer.


The Presentation Layer

The Presentation layer translates data between the formats the network requires and the formats the computer expects. The Presentation layer performs protocol conversion; data translation, compression, and encryption; character set conversion; and the interpretation of graphics commands.

The network redirector, long a part of Windows networking, operates at this level. The redirector is what makes the files on a file server visible to the client computer. The network redirector also makes remote printers act as though they were attached to the local computer. Figure 1.8 shows the Presentation layer’s role in the protocol stack.

Graphic formats such as PICT, TIFF, and JPEG are examples of Presentation layer protocols.


The Application Layer

The Application layer is the topmost layer of the OSI model, and it provides services that directly support user applications, such as database access, email, and file transfers. It also allows applications to communicate with applications on other computers as though they were on the same computer. When a programmer writes an application that uses network services, this is the layer the application will access. For example, Internet Explorer uses the Application layer to make its requests for files and web pages; the Application layer then passes those requests down the stack, with each succeeding layer doing its job (as in Figure 1.9).

File Transfer Protocol (FTP), Hypertext Transfer Protocol (HTTP), Simple Mail Transfer
Protocol (SMTP), and others are examples of protocols at the Application layer.

No comments:

Post a Comment