Reference model is a standard system for interconnection between computer or communication systems developed by the International Organization for Standardization (ISO), commonly known as OSI reference model or seven-layer model.

The seven-layer model is mainly divided into:

  • The application layer
  • The presentation layer
  • The session layer
  • The transport layer
  • The network layer
  • Data link layer
  • The physical layer

Each layer provides services to the upper layer and receives services from the lower layer, down to the lower layer and up to the user.

The physical layer

Provide mechanical, electronic, functional, and normative features for the creation, maintenance, and removal of physical links needed to transmit data. It is also possible to screen out differences in physical devices, transmission media, and communication means so that the data link layer does not feel these differences and only considers the implementation of the protocol and service of this layer. Its transmission unit is bitstream, which solves the problem of establishing, maintaining and releasing physical transmission media when users use it.

Physical layer characteristics

  • Mechanical properties

Specify the shape and size of the connector used for the interface, number and arrangement of leads, fixing and locking devices, etc. This is very much like the usual common various specifications of the size of the power plug have strict rules. (for example, twisted pair standard)

  • Electrical characteristics

The electrical characteristics of the physical layer specify the limits of signal voltage, impedance matching, transmission rate and distance when transmitting binary bit streams over physical connections.

  • features

Defines the source and function of interface signals and the relationship among other signals. This describes the function allocation and definition of each signal cable on a physical interface. Physical interface signal cables are classified into data cables, control cables, timing cables, and ground cables.

  • Discipline characteristic

A set of operations for transmitting binary bitstream on signal line is defined, including the working sequence and timing of each signal line, so that the bitstream transmission can be completed.

The unit of data transmission: bit flow, also known as current

Data link layer

The data link layer defines how to transmit data on a single link. The data link layer must have a series of corresponding functions, mainly including: how to combine data into data blocks, which is called frame in the data link layer. Frame is the transmission unit of the data link layer. How to control the transmission of frames on the physical channel, including how to deal with transmission errors, how to adjust the transmission rate to match the receiver; And management that provides the establishment, maintenance, and release of data link paths between two network entities.

Data link layer protocols are divided into two sub-layers: logical Link Control (LLC) protocol and media Access Control (MAC) protocol.

The data link layer has two main functions: frame coding and error correction control.

Frame coding

In order to retransmit only the limited data with errors in transmission, the data link layer combines bitstreams into frames for transmission. In addition to the data to be transmitted, each frame contains a check code so that the receiver can detect errors in transmission. Frames must be organized in such a way that the receiver can clearly recognize them from the stream of bits received at the physical layer, that is, the start and end of frames can be distinguished from the stream of bits. This is the problem that frame synchronization addresses.

  • Byte counting method
  • Beginning and end delimiters using character padding
  • Beginning and end notation using bit padding
  • Illegal coding laws

Error correction control

A practical communication system must have the ability to detect (that is, detect) such errors, and take some measures to correct them, so that the errors are controlled in the allowable as small a range, this is the error control process, is also one of the main functions of the data link layer.

The main protocols of the data link layer are:

  • Point-to-point Protocol;
  • Ethernet;
  • High-level Data Link Protocol;
  • Frame Relay;
  • Asynchronous Transfer Mode;

The network layer

The purpose of the network layer is to realize the transparent transmission of data between two end systems. The specific functions include addressing and routing, connection establishment, maintenance and termination, etc. It provides services that eliminate the need for the transport layer to understand data transfer and switching technologies in the network. If you want to remember the network layer in as few words as possible, it’s “routing, routing, and logical addressing.”

routing

  • Static routing

    A static routing strategy does not measure or use network information. It selects routes according to certain fixed rules. It can also be divided into three algorithms: ubiquitous route selection, fixed route selection and random route selection.

    1. Flood routing selection

    This is the simplest routing algorithm. After a network node receives a packet from a line, it repeatedly sends the received packet to all lines except that line.

    2. Fixed route selection

    This is a simple algorithm that is used a lot. Each network node stores a table in which each record corresponds to a destination node or link.

    3. Random routing

    In this method, the node receiving the packet randomly selects an outlet node for the packet among all its neighbors. Although the method is simple and reliable, the actual route is not the best route, which increases the unnecessary burden, and the packet transmission delay is unpredictable, so this method is not widely used.

  • Dynamic routing node routing depends on the current status information of the network to determine the policy is called dynamic routing policy, this policy can better adapt to the changes of network traffic, topology structure, to improve network performance. However, due to the complexity of the algorithm, it will increase the burden of the network, and sometimes it will cause oscillation due to too fast reaction or too slow reaction. Independent route selection, centralized route selection and distributed route selection are the specific algorithms of three dynamic routing strategies.

    1. Independent routing: In this kind of routing algorithm, nodes only make routing decisions based on the relevant information found by themselves, and do not exchange routing information with other nodes. Although they cannot correctly determine the routing choice far from the node, they can still better adapt to the changes of network traffic and topology structure.

    2. Centralized routing: Like fixed routing, centralized routing stores a routing table on each node.

    3. Distributed routing: in a network with distributed routing algorithm, all nodes exchange routing information with each of their neighbors periodically.

Network layer protocol

The CORE of TCP/IP network layer is IP protocol, which is one of the most important protocols in THE TCP/IP protocol family. The IP protocol is very simple and provides only unreliable, connectionless transport services. The main functions of IP protocol are connectionless datagram transmission, datagram routing and error control. The function of IP is realized by ARP, RARP, ICMP and IGMP.

The IP address

The TCP/IP network uses a 32-bit address to identify a computer and its connected network. The format is IP address = network address + host address. IP addresses are classified by their format, which has four formats: CLASS A, class B, class C, and class D.

Address resolution

ARP protocol is the abbreviation of “AddressResolutionProtocol” (address resolution protocol). In lans, what is actually transmitted over the network are “frames” that contain the MAC address of the target host. On the Ethernet, to communicate directly with another host, a host must know the MAC address of the target host.

Reverse address resolution

Each system on the network has a unique hardware address configured by the network interface manufacturer. The RARP implementation of a diskless system is to read the unique hardware address from the interface card and then send an RARP request (a frame of data broadcast over the network) asking a host to respond with the IP address of the diskless system (in the RARP reply).

Internet message

ICMP function: Due to two defects of IP protocol: no error control and query mechanism, hence ICMP. To improve the chance of successful delivery of IP packets, ICMP reports and queries errors during the transmission of IP packets. For example, the destination host or network is unreachable, packets are discarded, routes are blocked, and the destination network is reachable.

The transport layer

Transport layer is the fourth layer in the Open Systems Interconnection (OSI) reference model proposed by the International Organization for Standardization.

Generally, the service of transport layer has to go through three stages: transmission connection establishment stage, data transmission stage and transmission connection release stage before completing a complete service process. In the data transmission stage, it can be divided into two forms: general data transmission and accelerated data transmission. The two most common protocols in the transport layer are Transmission Control Protocol (TCP) and User Datagram Protocol (UDP) [1]. The transport layer provides logical connection establishment, transport layer addressing, data transmission, transport connection release, flow control, congestion control, multiplexing and demultiplexing, crash recovery and other services.

At this level, the protocol data units through which information is transmitted are called segments or messages.

Data format of the packet:

The network layer only transmits the packets from the source node to the destination node according to the network address, while the transport layer is responsible for transmitting the data reliably to the corresponding port.

The transport layer provides end-to-end services between host application processes with the following basic functions:

(1) Segmentation and reorganization of data

(2) Address by port number

(3) Connection management

(4) Error control and flow control, error correction function

The transport layer provides the reliability of communication services to the session layer to avoid errors, loss, delay time disorder, repetition, and disorder of packets.

The transport layer is not only the highest layer in the OSI layer model responsible for data communication, but also the middle layer between the lower three layers for network communication and the third layer for information processing, and shields the details of the communication subnet from the higher users.

TCP and UDP

TCP

Connection-oriented Transport protocol (TCP) : A connection must be established before data transfer and released after data transfer. Unicast transmission only: Each transmission connection can have only two endpoints and can be connected point-to-point only. Multicast and broadcast transmission modes are not supported. UDP is supported.

The transmission unit is data segment: The transmitted data segment varies depending on the size of packets transmitted at the application layer and the MTU(Maximum transmission unit) value on the network. The minimum data segment may be only 21 bytes (20 bytes belong to the TCP header and the data portion is only 1 byte).

Full-duplex transmission: Both parties can send and receive data at the same time.

TCP connections are based on byte streams; UDP is based on packet streams.

TCP is a transport layer protocol that ensures reliable data transmission. It uses the following four mechanisms to ensure reliable data transmission.

Byte numbering mechanism: TCP data segments number the “data” part of data segments in bytes to ensure that each byte of data can be sent and received in an orderly manner.

Data segment confirmation mechanism: For each data segment received, the receiver must return a data segment confirmation to the sender, where the confirmation number indicates the correct number of the data segment received.

Timeout retransmission mechanism: TCP has a retransmission timer (RTT). When a data segment is sent, the timer is also started. If no confirmation is returned after the timer expires, the timer stops and the data is retransmitted.

Selective acknowledgement mechanism :(Selective ACK,SACK)/ retransmits only missing data, not correctly received data.

UDP

UDP is the User Datagram Protocol. It is a connectionless transport layer Protocol in the Open System Interconnection (OSI) reference model. Provides a transaction-oriented simple unreliable message delivery service.

UDP is a connectionless protocol used to process data packets like TCP on the network. In the OSI model, layer 4, the transport layer, is one layer above the IP protocol. UDP does not provide packet grouping, assembly, and sorting. That is, after a packet is sent, it is impossible to know whether the packet arrived safely and intact. UDP is used to support network applications that need to transfer data between computers. Many client/server network applications, including network video conference system, need to use UDP protocol. A UDP packet consists of a UDP header and a UDP data area. The header consists of the source port, destination port, packet length, and checksum. UDP is suitable for real-time data transmission, such as voice and video communications. Compared with TCP, UDP has higher transmission efficiency and lower cost, but cannot ensure data transmission reliability. The UDP header is identified as follows:

1) 16-bit source port number: the port number used by the applications of the source host.

2) 16-bit destination port number: the port number used by the application program of the destination host.

3) 16-bit UDP length: refers to the length of UDP header and UDP data in bytes. Because the UDP header length is 8 bytes, the minimum value for the field is 8.

4) 16-bit UDP checksum: this field provides the same functions as the TCP checksum field; This field is optional.

Transport layer is the core of the whole protocol hierarchy and is the only layer responsible for the overall data transmission and control. In the OSI seven-layer model, the transport layer is the highest layer responsible for data communication, and the middle layer between the lower three layers for network communication and the third layer for information processing. Because the network layer does not guarantee the reliability of the service, and the user can not directly control the communication subnet, so on top of the network layer, another layer, namely the transmission layer, is added to improve the transmission quality.

The session layer

The Session layer is built on the transport layer and uses the services provided by the transport layer to enable applications to establish and maintain sessions and synchronize sessions.

⑴ Establishes a connection between session entities

To establish a session connection between two peer session service users, you do the following.

(1) Map session address to transport address. (2) Select required transport QOS parameters. (3) negotiate session parameters. (4) identify individual session connections. (5) Transmit limited transparent user data.

(2) Data Transmission Stage

This phase is the implementation of an organized, synchronous data transfer between two session users. The user data unit is SSDU, and the protocol data unit is SPDU. Data transfer between session users is performed by converting SSDU into SPDU.

⑶ Connection release

Connection release is the release of session connections through “orderly release “,” discard “,” limited transparent user data transfer” and other functional units.

The presentation layer

The presentation layer is located at the sixth layer of the OSI hierarchy, and one of its main functions is to provide a common language for heterogeneous computer communication so that interoperability can occur. This type of service is needed because different computer architectures use different data representations. Unlike Layer 5, which provides transparent data transportation, the presentation layer handles all issues related to data presentation and transportation, including transformation, encryption, and compression.

At the presentation layer, the data is formatted in a way that the network understands; This formatting also varies depending on the type of network used. The presentation layer manages the decryption and encryption of data, such as system password processing. If you query your bank account on the Internet, you use a secure connection. Your account data is encrypted before being sent, and at the other end of the network, the presentation layer decrypts the received data. In addition, the presentation layer protocol decodes and encodes image and file format information.

Encryption includes link encryption and end-to-end encryption. For the presentation layer, the encryption involved is end-to-end encryption, in which information is automatically encrypted by the sender, encapsulated in TCP/IP packets, and then sent to the Internet as unreadable and unrecognizable data. When it arrives at its destination, it automatically decrypts enough data to become readable. E2e encryption is for the upper layer of the network, but does not encrypt the information of the lower layer protocol. The protocol information is transmitted in plain text, and user data does not need to be decrypted in the central node.

The application layer

The network application layer is the window between communication users, providing users with network management, file transfer, transaction processing and other services. It contains several independent and common service protocol modules. The network application layer is the highest layer of OSI and provides specialized programs for communication between network users. The content of the application layer mainly depends on the needs of users. The main problems of this layer design are distributed database, distributed computing technology, network operating system and distributed operating system, remote file transfer, E-mail, terminal telephone and remote operation login and control. As of 2011, there is no complete international standard for application layer, which is a very wide research field. Of the seven OSI layers, the application layer is the most complex and contains the most application-layer protocols, some of which are still under research and development.

The application layer provides the interface for the operating system or network applications to access network services.

Application layer protocols include Telnet, FTP, HTTP, SNMP, and DNS.