There is a very famous model in the computer network: OSI (Open Systems Interconnection, open system interconnect) model, almost all computer network teaching and research should be done on the basis of OSI, want to discuss the problems in the computer network also rely on this model.
The OSI model is such a structure (from the bottom to the highest level):
1, physical (physical layer)
the physical layer is responsible for the final encoding of the information into current pulses or other signals for online transmission. It consists of the actual interface between the computer and the network media, which defines the electrical signals, symbols, the status of the line and the clock requirements, the data encoding, and the connectors used in the transmission. The wired network signal has two kinds of current pulse (cable transmission) and electromagnetic pulse (optical fiber transmission). The physical layer consists of a physically present transmission medium (such as a network cable) and a device (such as a network card, router).
2, Data link layer
The Data link layer provides reliable data transfer over a physical network link. Different data link layers define different network and protocol features, including physical addressing, network topology, error checking, frame sequences, and flow control. The data link layer is actually comprised of two separate parts, media access control (media access Control,mac) and the Logical Link Control layer (Logical link CONTROL,LLC). The data link layer is responsible for establishing a communication link on the physical layer (each time a browser is opened, a data link is established, and the corresponding data link does not exist after the browser is closed). PPP (Point-to-Point Protocol) is on the data link layer.
3, Network layer
The Network layer is responsible for establishing a connection between the source and endpoint, providing logical communication for different hosts. It typically includes network seek, and may include flow control, error checking, and so on. The network layer is only responsible for establishing the connection and does not guarantee the reliability of the connection. The famous IP (Internet Protocol) is on the network layer.
4, the Transport Layer (transport layer)
in the OSI model, the transport layer is the highest level responsible for data communication and is the only responsible overall number
transmission and control of the layer, to ensure the reliability of the connection, directly to run on a different host
provide communication services on the application. TCP (Transmission Control Protocol) and UDP (User datagram protocols), which are the same as IP, work on the transport layer, and SSL/TLS also works on the transport layer. By the way, encrypted connections are almost always dependent on the transport layer (whatever the encryption), and the encryption process is done on the transport layer.
5, Session layer
the session layer establishes, maintains, and releases a target-oriented, between two nodes
dialogue between the two machines that are in session, and the management session
which way to send, when to send, how long to take, etc., to ensure reliable transmission of session data. It also includes creating checkpoints that can be returned to a previous state when the communication is interrupted.
6, Presentation level (presentation layer)
The presentation layer is a layer that handles all related data representations and transmissions, and is a heterogeneous machine
Communication provides a common language that provides the upper-level user with a syntax representation of the data information
different computers in the information representation, that is, with a consistent
The standard way to encode data. The presentation layer protocol is generally not associated with a special protocol stack, such as QuickTime is the standard for applet computer video and audio, and MPEG is the ISO video compression and encoding standard. Common graphics image Formats PCX, GIF, jpeg are different static image compression and encoding standards.
7, the Application layer (application layer)
At the highest level of the OSI model, the functionality of the application layer typically includes identifying communication partners, defining the availability of resources, and synchronizing communications. Note that the application layer is not made up of actual applications running on the computer, but rather consists of APIs (application program Interface, application interfaces) that provide access to the network resources to the application. The application layer protocol has the famous HTTP (Hypertext Transfer Protocol, Web page transmission on him), FTP (File Transfer Protocol, very easy to download), SMTP (Simple Mail Transfer Protocol, mail he is responsible for) and so on.
Some people see here will probably think so: the original OSI model so clear Ah, like the company's subordinate or military officers and soldiers at all levels of the same level to listen to superiors, subordinates more than the superior, as long as the superior has been done, subordinates how hard work is useless.
wrong!
The OSI model is not only physically non-existent (hardware), logic does not exist (software), this is a simple communication to simplify the big problem with the hierarchy of big problems into a small problem and divide and conquer the concept of a model just!
that is, in fact there is no so-called upper and lower layers exist, but not the subordinate this said!
So what is actually a scene?
A group of people with different skills gather together and they are good friends with each other.
one day, they received a task: to spread the important data from a to a half of the Earth from the safe to the B.
"This problem is too big, how to solve ah?" "(i) do not worry, step by step thinking, there must be a way." "
Physical media (optical cables, repeaters, etc.): "I can connect the terminals of A and B to the physical level." "(i) This is the first step, but it is not enough!" By the way, you are a large number, a name is too troublesome, you collectively known as the physical layer it! "
Mac and LLC: "I can build a data link on the basis of the physical layer, realizing the communication between two devices directly connected" PPP: "I can implement point-to-point data link! "(i) very well, gentlemen, you work together, your studio name is called the Data link layer!" "
"(i) but A and B interval half of the Earth, ah, if the direct connection, the signal has long been attenuated by the fundamental can not be transferred to the destination, how to do?" "'" Don't forget me, I can realize the communication between any two points of the indirect connection, find the best path and deal with the possible traffic jam problem to me! "(i) It's you, ip!. "I am very strong, but I have no way to ensure that the data will be sent to the destination is, the data if there is lost in the middle of the damage, I can do nothing, and I can't directly to the application to provide communication services. "(me) that you are also very strong, dedicated to you a studio bar, network layer studio. "
"Then let me live the reliability of the transmission!" And let me deal with those apps! "(Me) you Are?" "" tcp! Guaranteed transmission reliability, I am the best! I will not let any one of the data packets (TCP data unit) be left behind! "I said TCP, you this is caused by a considerable number of video enthusiasts dissatisfaction, because you, they often want a mosaic multi-buffer for a few seconds, and even sometimes road conditions (network condition) is not good, there is a data message is not sent over, and then you quit, the back of a lot of messages you will not receive, It's ridiculous to wait for that one to come over! "I say UDP, that video and so on streaming media to you, you this unreliable fellow!" "(i) OK, two people do not quarrel, each has various fields. Your studio, it's called the Transport layer! "
"(i) there are two terminal between the session, who will be responsible ah?" "I come, I can also provide check point, if accidentally disconnected, do not have to re-transfer all the data, I work in the place called the session layer on the line!" "(i) ok! "
"(i) Start transmitting!" Wait a moment, a in speaking English, b in the text, there is no understanding of each other Ah! What do we do? "That means we need a uniform standard, let us come, we provide a common language that everyone can understand!" "(Me) Ah, there are several, the text of the unified code, the unified format of the video, the picture of the unified format, you together, the studio called the Presentation layer bar! "
"(me) almost enough, right?" No, there is no one responsible for the end of the API to pass the data to the application, as well as the final synchronization and communication partners (application) of the identity of the packet can not be sent wrong Ah! "We can help this!" (chorus) "I am responsible for the webpage!" "HTTP? "Download and file transfer I am the best!" "FTP?" "The mail will be given to me to deal with it!" "SMTP?" "(Me) Well, your studio is called the application layer!" "
"(me) so it can begin!" "Yes, everybody, get the job done!" We work on the packets together, and then we send them out! (chorus) "" (i) who can not leave who ah. It seems that there is no subordinate. "Where do you need a subordinate?" Everyone's responsibilities, together with the end of A and B communication, who can not be absent, everyone is equal, did not say what who leads who, who manages who, who can not control who's things! "
"(i) Yes (laughter), you guys are more than human beings like me to understand, there is no one should be riding on or riding on who's head." ”
The internet was designed with a focus on connectivity, with little regard for security, and now various cryptographic protocols and authentication mechanisms were added later.
"And so on, there is another problem: The data transfer is clear!" So the transmission process has long been the third party to see the light! Also, you have no way to determine the identity of each other! "'" (Look at me, I'll see you) neither can we. "I'll do it!" "" SSL? "I can resolve the issue of encryption and authentication at the same time." "Then which studio do you want to go to?" "It's hard to say that the cryptographic decryption and authentication process needs to be done with a specific application, but the cryptographic connection setup process requires TCP's help, and you can think of me as being under the application layer on the transport layer, which means I'm a composite protocol." "You want to work with TCP?" "That's right." What I'm dealing with is the TCP data packet, which I'm transmitting, which is the TCP data stream. I can assure you that no one else will be able to know the contents of the data except the two parties that pass the data, and no one can impersonate either of them. "
"Then why do you make such a guarantee?" "" is a long story, womb also said not clear, I will slowly explain later. "
in the next series I will detail how the HTTPS connection is going on, by the way, the actual use of TCP/IP architecture (the OSI model is too complex, and the division of labor between the layers is not very clear, the actual use of many times the layers are mixed, so tcp/ IP will be a combination of several layers). Advice some smattering half-small white one sentence: The computer network quite a lot of models or architectures or protocols can not casually go with the real life analogy, before the cranky still find some professional information read it!
The principle of SSL/TLS and how the Internet works (1)-"Every agreement is born equal"