Sunday, 22 March 2020

Understanding network communication - Phase 1 - OSI model



OSI model
  • Open system interconnection model
  • Communication between two computers connected through a cable and RJ connectors.
  • Each layer is a package of protocols
    • The app layer is not the application itself, but the protocols packages.
  • 7 Layer model
  • Application Layer: Uses protocols to access net
  • Presentation Layer: Convert text/audio/video into binary
  • Session Layer: Establishes the connection
  • Transport  Layer: Converts into segments and adds port number and sequence number into each segment.
  • Network  Layer: Convert segments into packets by adding logical address
  • Data link  Layer: Converts packets into frame by adding physical address
  • Physical  Layer: Transmits the data by converting into signals
    • Application layer
      • Is used by applications that use the internet like Google chrome, skype.
      • Application layer provides services to network applications with the help of protocols to perform user activities.
      • Protocols: HTTP /HTTPS (Web surfing), FTP (File transfer), NFS, DHCP, SMTP (Emails), TELNET (Virtual terminal), POP3, IRC, NNTP 

    • Presentation layer:
      • ASCII => EBCDIC ( Extended Binary Coded Decimal Interchange Code) 
      • It does:
        • Translation:Receives Data from Application layer. In the form of characters and number and convert it into binary format. 
        • Compression
          • Compression can be lossy and lossless.
          • Reducing the amount to transfer, hence good choice for real time streaming.
        • Data encryption using SSL (Secure socket layer).

    • Session Layer:
      • Just like party planners and helpers, Session layers has its own helpers, Called APIs. NETBIOS (Network basic input output system) is an example of \API which helps application running on different computers to connect with each other.
      • Process:
        • Before establishing a connection with the server, the server does the authentication(to check who you are) by using the username and password provided.
        • Post authentication, user’s authorization(If you have the access to sess the desired resource) is checked.
        • Session management
YOUR WEB BROWSER DOES ALL THE OPERATION OF “SESSION, PRESENTATION AND APPLICATION LAYER”
    • Transport layer:
      • Duties:
        • Segmentation
        • Flow control
        • Error control
        • Connection and connection less transmission
      • Reliability of communication through 
        • Segmentation
          • Breaks the received from session layer into smaller segments.
            • Segments
              • Contains: Source port, destination port and a sequence number
        • Flow: Amount of data being transmitted
          • To prevent loss of any packet.
        • Error control
          • Retransmitted the lost/ corrupted data.
          • Checksum is added to each packet.
        • Protocols:
          • TCP | UDP
        • Types of services:
          • Connection - TCP
          • Connection less  - UDP 
        • UDP is faster, as it does not provide any feedback so that lost data can be retransmitted.
        • Udp is used weather we don’t care about delivery of old data like online movie streaming, songs, games, DNS, PFTP.
        • TCP is used where delivery of old data is must, eg. WWW, email, FTP.
TRANSPORT LAYER passes the data segments to NETWORK LAYER
    • Network layer 
      • Works for the transmission of data segments from one computer to another located in a diff network.
      • Data send is called as packets.
      • It’s the layer where the routes determines.
      • Duties
        • Routing
          • Method to move data packet from source to destination based on the logical IP and mask
        • Logical addressing - IP addressing.
          • Network layer assigns receiver’s and sender’s IP address to each segment to form a IP packet
        • Path determination
          • A computer can be connected to the internet server in a no of ways. Choosing the best path is called Path determination.
          • Procols:
            • OSPTF:  Open shortest path fast
            • BGP: Border gateway protocol
            • IS - IS: intermediate system to intermediate system
NETWORK LAYER passes the data packets to DATA LINK LAYER
    • Data link:
      • Two kind of addressing
        • Logical addressing: Done at Network layer. This is assigning of IP address of the sender and the receiver.
        • Physical addressing: Done at data link layer. Mac address(12 digits alphanumeric address embedded in Network interface card by the computer manufacturer) of receiver and sender assigned to data packet. 
      • Data you read in Data link layer is FRAME.
      • Data packet → [IP1  IP2 |Segment | TAIL]
      • Frame → [MAC1 MAC2 | Packet ]  which is
        [MAC1 MAC2 | IP1 IP2 | Segment | TAIL ]
      • Data link layer is embedded as a software in the Network interface card of a computer and provides means to transfer data from one comp to another via local media (copper wire, fiber or air for radio signals).
      • NIC (sender) -----------(MEDIA like copper wire, fiber or air) ------------------ NIC (receiver)
      • Two duties: (Fig 1)
        • 1.  Allows upper layer of OSI model to access media using techniques such as framing


        • 2. Controls how data is passed and received from the media using techniques:
          • Media Access Control
            • The technique use to get the frame on the media OR of the media
          • Error Detection 
    • Physical Layer:
      • Transmite the Frame passed by the Data link layer to signals. 
        • Type of signals:
          • Electrical: copper of lan
          • Light: in case of fiber
          • Radio: in case of air


But why we don't use OSI model? 

OSI is actually not an implementation but a concept model or references, TCP just implement the layer 4 (transport layer) of it. When we implement a communication protocol, we often make decision of which layer in OSI should be implemented, and you can merge some layer together.

Here is a example when we design a new communication system:

First, we will define which kind of physical media we need, e.g. differential signal, or TTL, and how long distance it can transmit, i.e. Physical Layer (OSI Layer 1).
Second, we need addressing linked devices, so a device knows what data should be received or just bypass, i.e. Data Link Layer (OSI Layer 2).
Third, if data don’t needs to be routed cross networks, we can just put Application Data on it (OSI Layer 6-7). Or if it should be routed across networks, we define a routable protocol e.g. IP or any else custom protocols you like (OSI Layer 3).
Forth, now, you may be concerned about data consistency, sequences, validate, traffic control, so you implement the TCP protocol to keep your data safe. i.e. Transport Layer (OSI Layer 4)
Fifth, your customer never want to make their communication be seen by others, so you would give them something (e.g. a token, certification..) to distinguish each customer, make sure you making a private conversation. i.e. Session Layer (OSI Layer 5)
Sixth, data format defined at Presentation Layer, so your system know how to decode/encode your data. (OSI Layer 6)
Last, your actual data here. Application Layer (OSI Layer 7).
So, OSI defined what things you need to concern in a communication system, but you can choose not to.

3.4k views · View Upvoters
Srcs:

No comments:

Post a Comment