Understand network protocols

What agreement

What is the protocol, the protocol is actually a rule, a standard, such as two strangers would want to chat, must have the same or similar language syntax rules, in order to understand each other. For networks, the need to follow certain norms and conventions protocol, the protocol called OSI (Open System Interconnect), namely the Open System Interconnection, a reference model, not a mandatory standard, also known as the OSI reference model.

 

OSI Reference Model

Seven layers of the OSI reference model into descending order: Application (application layer), Presentation (presentation layer), Session (session layer), Transport (transport layer), Network (network layer), DataLink (data link layer) and physical (PHY). Wherein the application layer, presentation layer, and session layer can be considered as an application layer, the remaining layer may be regarded as the flow of data layer. For most people, probably related to the application layer and the transport layer are provided. TCP / IP protocol is a transport layer protocol, HTTP protocol is an application layer protocol.

Hierarchy and function

Physical layer
The physical layer is the lowest layer reference model, the physical layer includes a networking media, such as wired cable connector. The main function of the physical layer is the transmission medium using a data link layer provides a physical connection, is responsible for the physical transmission of the data stream is work. The basic unit is the physical layer transmission bit stream, i.e., 0 and 1, which is the most basic electrical or optical signal, is the most basic physical transmission characteristics.

 
Data Link Layer
The data link layer entity is established between the data communications link coupled to the basic unit of transmission "frame", and provide error control and flow control services for the network layer. A data link layer MAC (Media Access Control sublayer) and LLC (Logical Link Control sublayer) composition. The main task of media access control sublayer is specified how a transmission frame on a physical line. LLC sublayer of the communication between devices on the same network link in a managed. Identification of different types of data link control protocol sublayer is responsible for logical, and subjected to encapsulation. That data link control sublayer of the network protocol to accept data packets and packet data control information to add more, thereby the packet to its destination device.  

Network Layer
The network layer logical link data transmission between the nodes created by routing algorithms to select the best path for the packet, to implement congestion control, networking and other functions mainly. The network layer is a key layer in the network router overlooking the highest node, which is responsible for the transmission of packets from the source network to the destination network routing work. The Internet is a collection of a plurality of networks composed together, it is by means of a network layer routing path selection function, in order to make the coupling between the flow to a plurality of networks, information can be shared. With a service network layer provides services for the two kinds of coupled and non-coupled oriented. Connection-oriented service is reliable connection service, data connection must be established before the exchange, and then transmit the data to establish the connection after termination of service before the end. As to the network layer service virtual circuit connection-oriented service implementation. No connection-oriented service is an unreliable service, it can not prevent the loss of packets, retransmission or disorder. No advantage for service in its service coupled flexible manner, and very quickly. Network layer datagram service as to achieve the coupling faces free service. 

Transport layer
transport layer is a network architecture of the interface between a high and low interfacial layer. Transporting layer is not only a single layer structure, but the core of the whole assay system protocol. The main transport layer to provide users with End-to-End (end) service, transmission problems datagram processing errors, packet ordering the like. Transport layer is a critical computer communication architecture layer, which shields the details of the underlying data communication to the high-level, so that users need not consider the physical layer, data link layer and the details of the work of the network layer. The transport layer using a network connection service provided by the network layer, using a service-oriented system according to the coupling requirements may be selected when the data transfer or connectionless oriented services.

Session Layer
The main function of the session layer is responsible for maintaining the transmission link between two nodes to ensure uninterrupted transmission point, data exchange and management functions. Session layer establish in the application process, manage and terminate sessions. Session layer may also be used to determine which communication, full duplex communication or half duplex communication by using session control. Coordination session layer request and responses through its own protocol.

Presentation layer
The presentation layer provides services for the representation of information transmitted between the application process. The presentation layer is mainly to complete the following layers from the source end to the destination end reliable data transmission, and the presentation layer is more concerned with the syntax and semantics of the data transmitted. The main function of the presentation layer representation of information exchange processing in the two communication systems, including changes in the data format, data encryption and decryption, data compression and decompression and the like. Under certain preconditions bandwidth data compression smaller the faster the transmission rate, the data indicating the compression and decompression layer is considered a key factor in control of transport rate. The presentation layer provides data encryption service is an important network security features, which ensure the secure transmission of data, but also the various security services of the most important key. The presentation layer to the application layer services offered include: syntax conversion, grammar and select Connection Manager.

The application layer
application layer is the highest layer in the OSI model is a direct user-oriented layer, the content of the user's communication to be solved by the application process, which requires the application layer using different application protocols to solve different types of application requirements, and to ensure these low-level communication protocols used by different types of applications is consistent. The application layer contains a number of generic service independent of user protocol module, a dedicated network for communication between the user program service. Note that the application layer is not the application, but to provide services for applications.
 

TCP / IP model and the OSI Model Comparison
Numbering TCP / IP five TCP / IP four OSI model Typical equipment Functions and connections
1 Application layer Application layer Application layer   A user interface to network services and applications
2 Presentation layer   Data representation, data security, data compression
3 Session Layer   Build, manage and terminate sessions
4 Transport Layer Transport Layer Transport Layer   With an addressing mechanism for identifying a particular application (port)
5 Network layer Network layer Network layer router Selecting a route between different network systems based on the network layer address (ip address)
6 data link layer Network Interface Layer data link layer Switches, network cards Based on the physical layer, revocation, a logical link identifier and link multiplexing and error checking functions.
7 Physical Layer Physical Layer optical fiber Establish, maintain and cancel physical connection

 

 

TCP three-way handshake

The first handshake: the client sends a SYN packet to the server and enter SYS_SEND state, waiting for the server to confirm
second handshake: server receives the client's SYN packet, send an ACK, while sending their own SYN packet, then enter the server state SYN_RECV
third handshake: the client receives the SYN + ACK sent by the server, enters the ESTABLISHED state, and the server sends an acknowledgment SYN ACK packet, the server receives the client's ACK, enters the ESTABLISHED state
when the client and server into the after ESTABLISHED state, between the client and server can start two-way data transfer.

 

 

TCP four wave

The first wave: Close active and sends a FIN state enters FIN_WAIT1
second wave: closing the passive to the active closing FIN receiving party side and transmitting the ACK, this time off the passive state party enters CLASE_WAIT; has received the active close passive ACK side after closing, the state enters FIN_WAIT2
third wave: closing passive sends a FIN LAST_ACK state and enters
the fourth wave: active close passive shutdown has received and sends the FIN ACK transmission, this time into the active close side TIME_WAIT state, 2MSL time after closing the connection, the passive side closed off after receiving the active side of the ACK, the connection is closed.

 

 

Published 60 original articles · won praise 20 · views 4584

Guess you like

Origin blog.csdn.net/zhaikaiyun/article/details/104865179