The transmission of the postman and the Post Office (network protocol overview) signals must always comply with certain protocols ). For example, the Great Wall is filled with Wolf smoke because the physical signal of the wolf smoke has been preset to represent the abstract signal of "enemy intrusion. Such a "Wolf smoke = enemy intrusion" is a simple protocol. The protocol can be more complex. For example, the Morse Code uses a combination of short signals and long message numbers to represent different English letters. For example, SOS (*** --- ***, * represents a short signal, and-represents a long message number ). In this way, "*** = S, --- = O" is the Protocol stipulated by the moles code. However, on the next layer, people will know that SOS is the help information because we have the "SOS = help" protocol in our minds. Therefore, "*** --- *** = SOS = distress" is a hierarchical communication system composed of two protocols. The communication between computers using the Morse Code also follows different protocols to implement computer communication. Physical layer refers to the physical media that actually exists, such as optical fibers, cables, and electromagnetic waves. These media can transmit physical signals, such as brightness, voltage, or amplitude. For digital applications, we only need two physical signals to represent 0 and 1 respectively. For example, high voltage represents 1 and low voltage represents 0, which constitutes a simple physical layer protocol. For a certain media, the computer can have corresponding interfaces to receive physical signals and interpret them as a sequence of 0/1. The link layer is in the connection layer. Information is transmitted in frames. The so-called frame is a finite 0/1 series. The connection layer protocol is used to recognize frames contained in the 0/1 sequence. For example, the start and end of a frame are identified based on a certain 0/1 combination. In frames, there are Source, SRC, Destination, DST, and Frame Check Sequence ). Of course, the most important and important thing in a frame is the data to be transmitted (payload ). The data is often in line with higher-level protocols for upper-Layer Networks. It is compatible with data, and data Type information is also available in frames. The connection layer protocol does not care about what is contained in the data. The frame is like an envelope that wraps the data. Ethernet and WiFi are currently the most common connection layer protocols. Through the connection layer protocol, we can establish a local Ethernet or Wi-Fi LAN, and let the two computers in the same local area network communicate. The connection layer is like a postman in a community. He knows every user in the community. Each person in the community can send a letter (FRAME) to him to another person in the same community. Connection layer: How do different communities at the network layer communicate? In other words, how can one computer on WiFi communicate with another computer on Ethernet? We need a man in the middle ". This "man-in-the-middle" must have the following features: 1. It can receive and send 0/1 sequences in two networks on the physical layer; 2. It can understand the frame formats of the two networks at the same time. A router is a translation generated for this purpose ". A vro has multiple NICs (NIC, Network Interface Controller). Each NIC can connect to multiple networks and understand the corresponding connection layer protocol. When a frame passes through a route to another network, the route reads the frame information and changes it to another network. The router is like a post office with branches in both communities. The postmaster of one community delivers the mail to the branch office of the Community, and the post office transfers the mail to the Postmaster of another community through its branch in another region, and the postman from another community is finally sent to the destination. The entire communication process between Wi-Fi and Ethernet connected through a route is as follows: Computer 1 on Wi-Fi> router WiFi interface> router Ethernet interface> Computer 2 on Ethernet (blue indicates WiFi network, in the connection layer, only the SRC and DST addresses can be recorded in one frame. The above process requires four addresses (Computer 1, Wi-Fi interface, Ethernet interface, and computer 2 ). Obviously, the connection Layer Protocol alone cannot meet our needs. Since the connection layer protocol is developed first, we cannot change the connection layer protocol. We can only work on the data (payload) in the connection layer, that is, the internal work of the letter. The IP Protocol came into being. Computer 1, router and computer 2 must understand the IP protocol. When computer 1 writes a letter, it will write the departure address and the final arrival address (not on the envelope) at the beginning of the letter, and write it on the envelope to send it to the post office. The WiFi Postmaster sends the email to the post office. In the post office, the mail was opened, and the Post Office staff saw the final address, so they packed the mail in a new envelope and wrote the Post Office as the post office, and the place of arrival was computer 2, and sent to the Ethernet postman, which is sent to the computer 2. (The IP Protocol also requires information such as verification and traffic conditions to protect the communication stability .) The mail is transferred to the post office at the connection layer, and the postmaster is only responsible for sending messages to the community, therefore, the address on the envelope is always "the third house in the first street" or "the small house at the corner of the central Crossroads". Some local talents know the address description, which makes the post office work inconvenient. Therefore, the post office requires that the address written on the letter must be an official "zip code", that is, an IP address. This address is the number of every house in the world (ZIP code ). When a letter is sent to the post office, the post office can find the corresponding address Description Based on the zip code, so that the information on the envelope can be smoothly rewritten. Each post office is generally connected to multiple communities, and one community can also have multiple post offices to access different communities. Sometimes a letter must be transferred through multiple post offices to reach the destination. This process is called route. The post office connects the separated Local Area Network to the internet and eventually forms the internet that covers the whole world. The layer-3 Protocol above the transport layer enables communication between different computers. However, there are actually many processes in the computer, and each process can have communication requirements (see Linux Process basics and Linux Process Communication ). This is like having several people (processes) in a house. How can we send emails to someone accurately? According to the same logic, we need to write new information on the letter, such as the recipient's name, to send the letter. Therefore, the transport layer writes the new "recipient" Information on the blank area of the email. Each house is equipped with an administrator (Transport Layer Protocol ). The postmaster receives the email from the postmaster and sends it to someone in the house based on the receiver. The Administrator uses port number to identify the receiver (a process) for transport layer protocols, such as TCP and UDP ). When writing a letter, we write the destination port. When the email arrives at the destination, the Administrator identifies the port number based on the transport layer protocol and sends the email to different users. TCP and UDP are two different transport layer protocols. UDP is similar to our communication process. TCP is like frequent communication between two lovers. A lover wants to express too much feelings, so that he has written several messages consecutively. The other party must sort these messages in order to understand all the meaning. TCP also provides functions such as network traffic control. The application layer can communicate with any two people (processes) through the above layer protocols. However, everyone is actually engaged in different industries. Some are lawyers and some are diplomats. For example, communications between lawyers use strict legal terms to avoid disputes. For example, communications between diplomats must comply with certain diplomatic formats to avoid diplomatic misunderstanding. For example, a spy transmits encrypted information through an encrypted number. The application layer protocol further regulates the letter content. The application layer protocol includes the HTTP protocol for Web browsing, the FTP protocol for file transmission, and the IMAP protocol for Email. The summary of diplomatic communication is always over the network hierarchy. we abstract the local address (Postman), zip code (Post Office), recipient (Administrator), and recipient industry (standard terms) from the original 0/1 series) these concepts. These concepts eventually allow two processes distributed on the Internet on two computers to communicate with each other. The writer must encapsulate the entire envelope (encapsulation) according to the protocol of each layer, and the receiver opens the envelope in reverse order. The entire process is readable information-> Binary-> readable information. Computers can only understand and transmit 0/1 sequences, while computer users always Input and Output readable information. The network protocol ensures the integrity of readable information throughout the conversion and transmission process.