Saturday, 27 April 2013

OSI Model: Understanding the Seven Layers of Computer Networks


Introduction

The Open Systems Interconnection (OSI) model is a reference tool for understanding data communications between any two networked systems. It divides the communications processes into seven layers. Each layer both performs specific functions to support the layers above it and offers services to the layers below it. The three lowest layers focus on passing traffic through the network to an end system. The top four layers come into play in the end system to complete the process.


Seven Layers/Standards of the OSI Model :-













Layer 1 - Physical Layer :


Application
Presentation
Session
Transport
Network
Data Link
Physical 
The physical layer, the lowest layer of the OSI model, is concerned with the transmission and reception of the unstructured raw bit stream over a physical medium. The physical layer of the OSI model defines connector and interface specifications, as well as the medium (cable) requirements. Electrical, mechanical, functional, and procedural specifications are provided for sending a bit stream on a computer network. 

The Physical Layer receives data from the data link Layer, and transmits it to the wire. The physical layer controls the electrical and mechanical functions related to the transmission and receipt of a communications signal. It also manages the encoding and decoding of data contained within the modulated signal. 







Note that for two devices to communicate, they must beconnected to the same       type of physical medium (wiring). 802.3 Ethernet to 802.3 Ethernet, FDDI to FDDI, serial to serial etc. Two end stations using different protocols can only communicate through a multi-protocol bridge or a router.
The physical layer is responsible for:
  1. Communication with the data link layer above it.
  2. Fragmentation of data into frames.
  3. Reassembly of frames into data link Protocol Data Units.
  4. Transmission to the physical media.
  5. Receiving from the physical media.
Protocols :-
IEEE 802
IEEE 802.2
ISO 2110
ISDN


Layer 2 - Data Link Layer :


Application
Presentation
Session
Transport
Network
Data Link
Physical



The data link Layer is the second layer of the OSI model. Data link layers handle data transfer between network layer and physical layer. It receive data from network layer, adds header and trailer to the data and passes data to physical layer . At the receiver, it receiver data from the physical layer removes the header and trailer and passes the data to the network layer.



The data link layer performs various functions depending upon the hardware protocol used, but has four primary functions:

  1. COMMUNICATION with the Network layer above.
  2. SEGMENTATION of upper layer datagrams (also called packets) into frames in sizes that can be handled by the communications hardware.
  3. BIT ORDERING. The data link layer organizes the pattern of data bits into framesbefore transmission. The frame formatting issues such as stop and start bits, bit order, parity and other functions are handled here. Management of big-endian / little-endian issues are also managed at this layer.
  4. COMMUNICATION with the Physical layer below
  5. Handles data frames between the Network and Physical layers.
  6. Frame traffic control: tells the transmitting node to "back-off" when no frame buffers are available.
  7. Frame sequencing: transmits/receives frames sequentially.
  8. Frame acknowledgment: provides/expects frame acknowledgments. Detects and recovers from errors that occur in the physical layer by retransmitting non-acknowledged frames and handling duplicate frame receipt. 


        This layer provides reliable transit of data across a physical link. The data link layer is concerned with physical addressing, network topology, physical link management, error notification, ordered delivery of frames, and flow control.

        Protocols :
        a) Logical Link Control (LLC)
        i. Error correction and flow control
        ii. Manages link control 


        b) Media Access Control (MAC)
        i. Communicates with the adapter card.
        ii. Controls the type of media being used.




        NOTE: The data link layer is responsible for moving frames from one hop (node) to the next.



        Layer 3 - Network Layer :


        Application
        Presentation
        Session
        Transport
        Network
        Data Link
        Physical
        Network layer is the 3rd layer of the OSI model. The data unit at this layer is known as packet. The network layer is not needed if the two communicating lie in same network. However, when the two devices are on the different network,  network layer  is essential for the source to destination delivery of packets.


        This layer provides switching and routing technologies, creating logical paths, known as virtual circuits, for transmitting data from node to node. Routing and forwarding are functions of this layer, as well as addressing, inter-networking,  error handling, congestion control and packet sequencing.



        IP (Internet Protocol) is responsible for routing, directing datagrams from one network to another. The network layer may have to break large datagrams, larger than MTU, into smaller packets and host receiving the packet will have to reassemble the fragmented datagram. The Internetwork Protocol identifies each host with a 32-bit IP address. IP addresses are written as four dot-separated decimal numbers between 0 and 255, e.g., 129.79.16.40. The leading 1-3 bytes of the IP identify the network and the remaining bytes identifies the host on that network. The network portion of the IP is assigned by InterNIC Registration Services, under the contract to the National Science Foundation, and the host portion of the IP is assigned by the local network administrators. For large sites, the first two bytes represents the network portion of the IP, and the third and fourth bytes identify the subnet and host respectively. Even though IP packets are addressed using IP addresses, hardware addresses must be used to actually transport data from one host to another. The Address Resolution Protocol (ARP) is used to map the IP address to it hardware address.

        Functions :

        1. Translates logical network address and names to their physical address (e.g. computername ==> MAC address).
        2. Responsible for addressing, determining routes for sending and managing network problems such as packet switching, data congestion and routing.
        3. If router can’t send data frame as large as the source computer sends, the network layer compensates by breaking the data into smaller units. At the receiving end, the network layer reassembles the data.
        Protocols :-
        IP
        ARP
        RARP
        ICMP
        RIP
        OSFP
        IGMP
        IPX
        NWLink
        NetBEUI
        OSI
        DDP
        DECnet



        Note : The network layer is responsible for the delivery of individual packets from the source host to the destination host.


        Layer 4 - Transport Layer :



        Application
        Presentation
        Session
        Transport 
        Network
        Data Link
        Physical



        Transport layer is the 4th layer of the OSI model. The data unit at this layer is known as Segment. Transport layer offers end-to-end communication between devices through a network. depending on the application, the transport layer either offers reliable, connection-oriented or connectionless, best-effort communications.

        Two transport layer protocols:
        1. Transmission Control Protocol (TCP),
        2. User Datagram Protocol (UDP)

        At the transport layer. Reliability and speed are the primary difference between these two protocols.
         TCP establishes connections between two hosts on the network through 'sockets' which are determined by the IP address and port number. TCP keeps track of the packet delivery order and the packets that must be resent. Maintaining this information for each connection makes TCP a stateful protocol. 
        UDP on the other hand provides a low overhead transmission service, but with less error checking. NFS is built on top of UDP because of its speed.




        Functions :

        1. Communicate with the Session layer above.
        2. Reassemble transport Protocol Data Units into data streams
        3. Reliable protocols operating at this layer will
          • Detect errors and lost data
          • Recover lost data
          • Manage retransmission of data.
        4. Segmentation of data streams into transport Protocol Data Units.
        5. Communicate with the Network layer below.
        Protocols :
        TCP
        ARP
        RARP
        SPX
        NWLink
        NetBIOS / NetBEUI
        ATP
        UDP
        DCCP

        NoteThe transport layer is responsible for the delivery of a message from one process to another.


         Layer 5 - Session Layer :


        Application
        Presentation
        Session
        Transport
        Network
        Data Link
        Physical

        Session layer is the 5th layer of the OSI model. The session layer allows session establishment between processes running on different stations. This layer establishes, manages and terminates connections between applications. The session layer sets up, coordinates, and terminates conversations, exchanges, and dialogues between the applications at each end.


        The session layer tracks connections, also called sessions. The session layer should keep track of multiple file downloads requested by a particiular FTP application, or multiple telnet connections from a single terminal client, or web page retrievals from a web server.
        With TCP/IP this functionality is handled by application software addressing a connection to a remote machine and using a different local port number for each connection.



        Functions :

        1. Session establishment, maintenance and termination: allows two application processes on different machines to establish, use and terminate a connection, called a session.
        2. Session support: performs the functions that allow these processes to communicate over the network, performing security, name recognition, logging, and so on. 
        Protocols :
        NetBIOS
        Names Pipes
        Mail Slots
        RPC
        SAP
        L2TP
        PPTP
        SPDY


        Layer 6 - Presentation Layer :

        Application
        Presentation
        Session
        Transport
        Network
        Data Link
        Physical


        Presentation layer is the 6th layer of the OSI model. The presentation layer handles the conversion of data between a Standards-based or platform independant formats to a format understood by the local machine. This allows for data to be transported between devices and still be understood.




        The presentation layer provides:
        1. Character code translation: for example, ASCII to EBCDIC.
        2. Data conversion: bit order, CR-CR/LF, integer-floating point, and so on.
        3. Data compression: reduces the number of bits that need to be transmitted on the network.
        4. Data encryption: encrypt data for security purposes. For example, password encryption. 

        Protocols :
        MIME
        XDR
        TLS
        SSL


        Layer 7 - Application Layer :


        Application
        Presentation
        Session
        Transport
        Network
        Data Link
        Physical


        The OSI model defines the application layer as being the user interface. The OSI application layer is responsible for displaying data and images to the user in a human-recognizable format and to interface with the presentation layer below it.






        Examples of applications that utilize the network are:

        1. Telnet
        2. FTP
        3. Instant Message software (AIM, MSN, ICQ, Yahoo)
        4. Microsoft Windows File Shares
        5. Web Browsers (Internet Explorer, Firefox, Google Chrome, Safari)




        Protocols :
        FTAM
        DNS
        FTP
        TFTP
        BOOTP
        SNMP
        RLOGIN
        SMTP
        MIME
        NFS
        FINGER
        TELNET
        NCP
        APPC
        AFP
        SMB




        Quick View at the Functions of the layers 








        OSI Model and Protocol


        Network Communications through the OSI Model :


        Network Communications through the OSI Model. Some info. is added at every layer into the data known as "HEADERS"



        The figure represents two networked computers. They are running identical operating systems and applications and are using identical protocols (or rules) at all OSI layers. Working in conjunction, the applications, the OS, and the hardware implement the seven functions described in the OSI model.

        Each computer is also running an e-mail program that is independent of the OSI layers. The e-mail program enables the users of the two computers to exchange messages. Our figure represents the transmission of one brief message from Sam to Charlie.

        The transmission starts when Sam types in a message to Charlie and presses the "send" key. Sam's operating system appends to the message (or "encapsulates") a set of application-layer instructions (OSI Layer 7) that will be read and executed by the application layer on Charlie's computer. The message with its Layer 7 header is then transferred to the part of the operating system that deals with presentation issues (OSI Layer 6) where a Layer 6 header is appended to the message. The process repeats through all the layers until each layer has appended a header. The headers function as an escort for the message so that it can successfully negotiate the software and hardware in the network and arrive intact at its destination.

        When the data-link-layer header is added at Layer 2, the data unit is known as a "frame." The final header, the physical-layer header (OSI Layer 1) tells the hardware in Sam's computer the electrical specifics of how the message will be sent (which medium, at which voltage, at which speed, etc.). Although it is the final header to be added, the Layer 1 header is the first in line when the message travels through the medium to the receiving computer.

        When the message with its seven headers arrives at Charlie's computer, the hardware in his computer is the first to handle the message. It reads the instructions in the Layer 1 header, executes them, and strips off the header before passing the message to the Layer 2 components. These Layer 2 components execute those instructions, strip off the header, and pass the message to Layer 3, and so on. Each layer's header is successively stripped off after its instructions have been read so that by the time the message arrives at Charlie's e-mail application, the message has been properly received, authenticated, decoded, and presented.

        Keep on reading!

        2 comments: