Introduction To The Open Systems Interconnect Model (OSI

)
Introduction OSI is a standard description or "reference model" for how messages should be transmitted between any two points in a telecommunication network. Its purpose is to guide product implementors so that their products will consistently work with other products. The Model The OSI model was created by the IEEE committee so different vendors products would work with each other. You see the problem was that when HP decided to create a network product, it would be incompatible with similar products of a different vendor e.g IBM. So when you bought 40 network cards for your company, you would make sure that the rest of the equipment would be from the same vendor, to ensure compatibility. As you would understand things were quite messy, until the OSI model came into the picture.

As most would know, the OSI model consists of 7 layers. Each layer has been designed to do a specific task. Starting from the top layer (7) we will see how the data which you type gets converted into segments, the segments into datagrams and the datagrams into packets, the packets into frames and then the frames are sent down the wire, usually twisted pair, to the receiving computer. Please select one of the 7 layers by clicking on it, or simply use the menu :)

The picture below is another quick summary of the OSI model:

When you're finished reading through the OSI model, to understand how data travels through the layers and clearly see the header which each layer add\removes, visit the Data Encapsulation - Decapsulation page.

OSI Layer 1 - Physical Layer
The first four layers define how data is transmitted end-to-end. There are no protocols which work at the Physical layer. As mentioned, Ethernet, Token Ring and other topologies are specified here.

Layer 1 - The Physical Layer The Physical layer has two responsibilities: it sends bits and receives bits. Bits come only in values of 1 or 0. The Physical layer communicates directly with the various types of actual communication media. Different kinds of media represent these bit values in different ways. Specific protocols are needed for each type of media to describe the proper bit patterns to be used, how data is encoded into media signals and the various qualities of the physical media's attachment interface. The Physical layer specifications specify the electrical, mechanical and functional requirements for activating, maintaining and deactivating a physical link between end systems. At the physical layer, the interface between the Data Terminal Equipment (DTE) and the Data Circuit-Terminating Equipment (DCE) is identified. The Physical layer's connectors (RJ-45, BNC e.c.t) and different physical topologies (Bus, Star, Hybrid networks) are defined by the OSI as standards, allowing different systems to communicate. We talk more about the Physical topologies in the Topologies section. Please refer to it if you want to read more. You can also find out more about Ethernet at the Ethernet section.

OSI Layer 2 - Datalink Layer
The first four layers define how data is transmitted end-to-end. Some common protocols which work at the Datalink layer are: ARP, RARP, DCAP.

Layer 2 - The Datalink Layer The Datalink ensures that messages are delivered to the proper device and translates messages from the Network layer into bits for the Physical layer to transmit. It formats the message into data frames (notice how we are not using the term segments) and adds a customized header containing the hardware destination and source address. This added information forms a sort of capsule that surrounds the original message (or data), think of it like grabbing a letter which has information and putting it into an envelope. The envelope is only used to get the letter to its destination, right? So when it arrives at the addressee, the envelope is opened and discarded, but the letter isn't because it has the information the addressee needs. Data traveling through a network works in a similair manner. Once it gets to the destination, it will be opened and read (processed). This is illustrated in the Data Encapsulation Decapsulation section. The Datalink layer is subdivided into two other sublayers, the Media Access Control (MAC) and the Logical Link Control (LLC). The figure below illustrates this:

Media Access Control (MAC) 802.3 This defines how packets are placed on the media (cable). Contention media (Ethernet) access is first come first served access where everyone shares the same bandwidth. Physical addressing is defined here. What's Physical addressing? It's simple. You will come across 2 addressing terms, 1)Logical addressing 2)Physical addressing. Logical addressing is basically the address which is given by software e.g IP address.When you get an IP address, this is considered a "logical address" which is provided to you after your TCP/IP stack is loaded. Physical addressing is an address which is given not by the software, but the hardware. Every network card has a "MAC" address which is burnt into the card's eprom (a special memory chip) and this special address is used to uniquely identify your computer's network card from all the others on the network. There is a whole page dedicated to MAC Addressing if you would like to read more about it. Logical Link Control (LLC) 802.2 This sublayer is responsible for identifying Network layer protocols and then encapsulating them when they are about to be transmitted onto the network or decapsulate them when it receives a packet from the network and pass it onto the layer above it, which is the Network layer. An LLC header tells the Datalink layer what to do with a packet once a frame is received. For example, a host (computer) will receive a frame and then look in the LLC header to understand that the packet is destined for the IP protocol at the Network layer. The LLC can also provide flow control and sequencing of control bits. If you are finding all this a bit too difficult to understand, I suggest that you read more on the OSI model and check the Data Encapsulation - Decapsulation page which explains how the data travels up and down the OSI model and shows how each layer adds or removes its header information depending on the direction of the data.

OSI Layer 3 - Network Layer
The first four layers define how data is transmitted end-to-end. Some common protocols which work at the Network layer are: IP, DHCP, ICMP, IGRP, EIGRP, RIP, RIP2, MARS.

Layer 3 - The Network Layer The Network layer is responsible for routing through an internetwork and for networking addressing. This means that the Network layer is responsible for transporting traffic between devices that are not locally attached. Routers, or other layer-3 devices, are specified at the Network layer and provide routing services in an internetwork. In the Open Systems Interconnection (OSI) communications model, the Network layer knows the address of the neighboring nodes in the network, packages output with the correct network address information, selects routes and quality of service and recognizes and forwards to the Transport layer incoming messages for local host domains. Among existing protocol that generally map to the OSI network layer are the Internet Protocol (IP) part of TCP/IP and NetWare IPX/SPX. Both IP Version 4 and IP Version 6 (IPv6) map to the OSI network layer. As mentioned above, the Internet Protocol works on this layer. This means that when you see an IP address, for example 192.168.0.1, this IP address maps to the Network layer in the OSI model, in other words only the Network layer deals with or cares about IP addresses in the OSI model. To keep things simple, IP is analysed under the "Protocols" section.

OSI Layer 4 - Transport Layer
The first four layers define how data is transmitted end-to-end. Some common protocols which work at the Transport layer are: TCP, UDP.

Layer 4- The Transport Layer The Transport layer is responsible for providing mechanisms for multiplexing upper-layer application, session establishment, data transfer and tear down of virtual circuits. It also hides details of any network-dependent information from the higher layers by providing transparent data transfer. Services located in the Transport layer both segment and reassemble data from upper-layer applications and unite it onto the same data stream. Some of you might already be familiar with TCP and UDP and know that TCP is a reliable service and UDP is not. Application developers have their choice of the two protocols when working with TCP/IP protocols. As mentioned above, the Transport layer provides different mechanisms for the transfer of data from one computer to another. Below is a brief diagram which tells you a bit about the protocols.

These protocols are also analysed in the Protocols area.

OSI Layer 5 - Session Layer
The last 3 layers of the OSI model are reffered to the "Upper" layers. These layers are responsible for applications communicating between hosts. None of the upper layers know anything about networking or network addresses. Some common protocols which work at the Session layer are: DNS, LDAP, NetBIOS.

Layer 5 - The Session Layer The Session layer is responsible for setting up, managing and then tearing down sessions between Presentation layer entities. The Session layer also provides dialog control between devices, or nodes. It coordinates communication between systems and serves to organise their communication by offering three different modes: simplex, half-duplex and full-duplex. The session layer basically keeps one application's data separate from other application's data. Some examples of Session-layer protocols are: Network File Systrem (NFS) : Was developed by Sun Microsystems and used with TCP/IP and Unix workstations to allow transparent access to remote resources. Structured Query Language (SQL): Was developed by IBM to provide users with a simpler way to define their information requirements on both local and remote systems. Remote Procedure Call (RPC): Is a broad client/server redirection tool used for disparate service environments. Its procedures are created on clients and performed on servers. X Window: Is widely used by intelligent terminals for communicating with remote Unix computers, allowing them to operate as though they were locally attached monitors.

OSI Layer 6 - Presentation Layer
The last 3 layers of the OSI model are reffered to the "Upper" layers. These layers are responsible for applications communicating between hosts. None of the upper layers know anything about networking or network addresses. There are no protocols which work specificly at the Presentation layer, but the protocols which work at the Application layer are said to work on all 3 upper layers.

Layer 6- The Presentation Layer The Presentation Layer gets its name from its purpose: It presents data to the Application layer. It's basically a translator and provides coding and conversion functions. A successful data transfer technique is to adapt the data into a standard format before transmission. Computers are configured to receive this generically formatted data and then convert the data back into its native format for reading. By providing translation services, the Presentation layer ensures that data transferred from the Application layer of one system can be read by the Application layer of another host. The OSI has protocol standards that define how standard data should be formatted. Tasks like data compression, decompression, encryption and decryption are associated with this layer. Some Presentation layer standards are involved in multimedia operations. The following serve to direct graphic and visual image presentation : JPEG: The Joint Photographic Experts Group brings these photo standards to us. MIDI: The Musical Intrument Digital Interface is used for digitized music. MPEG: The Moving Pictures Experts Group's standard for the compression and coding of motion video for CD's is very popular. QuickTime: This is for use with Machintosh or Power PC programs, it manages audio and video applications.

OSI Layer 7 - Application Layer
The last 3 layers of the OSI model are reffered to the "Upper" layers. These layers are responsible for applications communicating between hosts. None of the upper layers know anything about networking or network addresses. FTP, TFTP, Telnet, SMTP and other protocols work on the first three layers of the OSI model, which obviously includes the Application layer. Layer 7- The Application Layer The Application layer of the OSI model is where users communicate with the computer. The Application layer is responsible for identifying and establishing the availability of the intended communication partner and determining if sufficient resources for the intended communication exist. The user interfaces with the computer at the application layer. Although computer applications sometimes require only desktop resources, applications may unite communicating components from more than one network application, for example, file transfers, e-mail, remote access, network management activities, client/server processes. There are various protocols which are used at this layer. Definition of a"Protocol" is a set of rules by which two computers communicate. In plain English, you can say that a protocol is a language, for example, English. For me to speak to you and make sense, I need to structure my sentence in a "standard" way which you will understand. Computer communication works pretty much the same way. This is why we have so many different protocols, each one for a specific task.

Data Encapsulation & Decapsulation in the OSI Model
Introduction Here we are going to explain in detail how data travels through the OSI model. You must keep in mind that the OSI model is a guideline. It tells the computer what it's supposed to do when data needs to be sent or when data is received.
In order to make it easier for most, there is a movie file available which will show your exactly what we are about to analyse.

Click here to to obtain the encap-decap movie (1MB). You will need Windows media player to view it.

Our Study Case We are going to analyse an example in order to try and understand how data encapsulation and decapsulation works. This should make it easier for most people. Try to see it this way : When a car is built in a factory, one person doesn't do all the jobs, rather it's put into a production line and as the car moves through, each person will add different parts to it so when it comes to the end of the production line, it's complete and ready to be sent out to the dealer. The same story applies for any data which needs to be sent from one computer to another. The OSI model which was created by the IEEE committee is to ensure that everyone follows these guidelines (just like the production line above) and therefore each computer will be able to communicate with every other computer, regardless of whether one computer is a Macintosh and the other is a PC. One important piece of information to keep in mind is that data flows 2 ways in the OSI model, DOWN (data encapsulation) and UP (data decapsulation). The picture below is an example of a simple data transfer between 2 computers and shows how the data is encapsulated and decapsulated:

Explanation : The computer in the above picture needs to send some data to another computer. The Application layer is where the user interface exists, here the user interacts with the application he or she is using, then this data is passed to the Presentation layer and then to the Session layer. These three layer add some extra information to the original data that came from the user and then passes it to the Transport layer. Here the data is broken into smaller pieces (one piece at a time transmitted) and the TCP header is a added. At this point, the data at the Transport layer is called a segment. Each segment is sequenced so the data stream can be put back together on the receiving side exactly as transmitted. Each segment is then handed to the Network layer for network addressing (logical addressing) and routing through the internet network. At the Network layer, we call the data (which includes at this point the transport header and the upper layer information) a packet. The Network layer add its IP header and then sends it off to the Datalink layer. Here we call the data (which includes the Network layer header, Transport layer header and upper layer information) a frame. The Datalink layer is responsible for taking packets from the Network layer and placing them on the network medium (cable). The Datalink layer encapsulates each packet in a frame which contains the hardware address (MAC) of the source and destination computer (host) and the LLC information which identifies to which protocol in the prevoius layer (Network layer) the packet should be passed when it arrives to its destination. Also, at the end, you will notice the FCS field which is the Frame Check Sequence. This is used for error checking and is also added at the end by the Datalink layer. If the destination computer is on a remote network, then the frame is sent to the router or gateway to be routed to the desination. To put this frame on the network, it must be put into a digital signal. Since a frame is really a logical group of 1's and 0's, the Physical layer is responsible for encapsulating these digits into a digital signal which is read by devices on the same local network. There are also a few 1's and 0's put at the begining of the frame, only so the receiving end can synchronize with the digital signal it will be receiving. Below is a picture of what happens when the data is received at the destination computer.

Explanation : The receiving computer will firstly synchronize with the digital signal by reading the few extra 1's and 0's as mentioned above. Once the synchonization is complete and it receives the whole frame and passes it to the layer above it which is the Datalink layer. The Datalink layer will do a Cyclic Redundancy Check (CRC) on the frame. This is a computation which the comupter does and if the result it gets matches the value in the FCS field, then it assumes that the frame has been received without any errors. Once that's out of the way, the Datalink layer will strip off any information or header which was put on by the remote system's Datalink layer and pass the rest (now we are moving from the Datalink layer to the Network layer, so we call the data a packet) to the above layer which is the Network layer. At the Network layer the IP address is checked and if it matches (with the machine's own IP address) then the Network layer header, or IP header if you like, is stripped off from the packet and the rest is passed to the above layer which is the Transport layer. Here the rest of the data is now called a segment. The segment is processed at the Transport layer, which rebuilds the data stream (at this level on the sender's computer it was actually split into pieces so they can be transferred) and acknowledges to the transmitting computer that it received each piece. It is obvious that since we are sending an ACK back to the sender from this layer that we are using TCP and not UDP. Please refer to the Protocols section for more clarification. After all that, it then happily hands the data stream to the upper-layer application. You will find that when analysing the way data travels from one computer to another most people never analyse in detail any layers above the Transport layer. This is because the whole process of getting data from one computer to another involves usually layers 1 to 4 (Physical to Transport) or layer 5 (Session) at the most, depending on the type of data.