In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces the relevant knowledge of "what are the basic knowledge of TCP/IP". In the operation of actual cases, many people will encounter such a dilemma. Then let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
To say that we have the most contact with the computer network protocol, it is bound to be inseparable from the TCP/IP protocol, the TCP/IP protocol is also the most famous protocol in the Internet, let's talk about the TCP/IP protocol.
The Historical background of TCP/IP
When there was no TCP/IP agreement at first, that is, in the 1960s, many countries and regions realized the importance of communication technology. The U.S. Department of Defense hopes to develop a technology that can communicate over other routes even if communication lines are disrupted. In order to realize this technology, a packet network has emerged.
Even if several nodes are destroyed in the process of communication between the two nodes, it can still communicate between the two nodes by changing the line and so on.
This kind of packet network promotes the birth of ARPANET (Advanced Research Projects Agency Network). ARPANET is the first wide area packet switching network with distributed control, and it is also the predecessor of the earliest implementation of TCP/IP protocol.
ARPANET is actually established by the Advanced Research projects Agency of the U.S. Department of Defense.
Therefore, the emergence of computer networks at the very beginning is for the purpose of military research.
In the 1990s, IOS carried out the process of international standardization of OSI, but it did not make substantial progress, but it made the TCP/IP protocol widely used.
The reason for the rapid development of TCP/IP may be due to the standardization of TCP/IP. In other words, the TCP/IP protocol will involve standards that OSI does not have, and this standard will be the main content of our next discussion.
Let's first take a look at the TCP/IP protocol. TCP/IP protocol is not just about TCP and IP. In fact, TCP/IP refers to the protocol suite. What is the protocol suite? To put it simply, it is a synthesis of a series of protocols. The next time I ask you what the TCP/IP protocols are, you can throw the following picture to him.
Taken together, the above protocols are the TCP/IP protocol suite.
TCP/IP standard
Compared with the standards of other protocols, TCP/IP pays more attention to two points: openness and practicality, that is, whether standardization can be actually used.
Openness says that TCP/IP is formulated by IETF discussion, and IETF itself is an organization that allows anyone to join in the discussion.
What the practicality says is that the framework, for example, will never become the mainstream if it only floats in theory without landing practice.
The standard protocol of TCP/IP is what we know as RFC documents, which you can see on the Internet. RFC not only standardizes the protocol standard, but also contains the implementation and use information of the protocol.
For more information about RFC protocols, you can take a look at the official document https://www.rfc-editor.org/rfc-index.html
We will not introduce it in detail here, but our article will focus on the study of TCP/IP.
TCP/IP protocol suite
Let's start talking about the TCP/IP protocol suite.
TCP/IP protocol is the protocol that we programmers contact most. The OSI model has seven layers, which are physical layer, data link layer, network layer, transport layer, session layer, presentation layer and application layer from bottom to top. But this is obviously a little complicated, so in the TCP/IP protocol, they are reduced to four levels.
Let's start with the communication link layer and introduce these layers and the protocols between them.
Communication link layer
If it has to be subdivided, the communication link layer can also be divided into physical layer and data link layer.
Physical layer
The physical layer is the lowest layer of the TCP/IP is the hardware responsible for transmission, which is equivalent to physical layer devices such as Ethernet or telephone lines.
Data link layer
The other layer is the data link layer, which sits between the physical layer and the network layer, and defines how data is transmitted on a single link.
Network layer
The network layer mainly uses the IP protocol, and the IP protocol forwards the subpacket data based on the IP address.
The main function of IP protocol is to send packet packets to the target host.
The functions of the Internet layer and the transport layer in the TCP/IP layer are usually provided by the operating system.
IP also implies the function of the data link layer. Through the IP protocol, the hosts that communicate with each other can communicate with each other no matter what the underlying data link.
Although IP is also a packet switching protocol, IP does not have a retransmission mechanism. Even if the data does not reach the other end, it will not be retransmitted, so IP is an unreliable protocol.
Another protocol in the network layer is ICMP, because IP may have exceptions in the process of sending packets. When IP packets cannot reach the destination address because of exceptions, you need to send an exception notification to the sender. This is the main function of ICMP. In view of this situation, ICMP can also be used to diagnose network conditions.
Transport layer
After we have just introduced the most important IP protocol of TCP/IP protocol, let's introduce the transport layer protocol, TCP protocol is a kind of transport layer protocol.
The transport layer is like a highway, a road connecting two cities. Here is the logical channel of the Internet, which you can think of as a highway.
The main function of the transport layer is to complete the communication and data exchange between the applications in the application layer. There are many applications running inside the computer, and each application corresponds to a port number, and we usually use port numbers to distinguish these applications.
The transport layer protocol is mainly divided into connection-oriented protocol TCP and connectionless protocol UDP.
TCP
TCP is a reliable protocol, which can ensure the reliable delivery of data packets, and TCP can correctly deal with abnormal situations such as packet loss and disordered transmission sequence. In addition, TCP also provides congestion control to alleviate network congestion.
UDP
UDP is an unreliable protocol, which can not guarantee the reliable delivery of data. Compared with TCP, UDP does not check whether the packet arrives or the network is blocked, but UDP is more efficient.
UDP is often used in video communication and multimedia fields such as less packet data or broadcasting, multicast and so on.
Application layer
In the TCP/IP protocol suite, the session layer and presentation layer of the OSI standard model are classified as application layer. The architecture of the application layer mostly belongs to the client / server model, the program that provides the service is called the server, and the program that receives the service is called the server. In this architecture, the server is usually deployed to the server in advance, waiting for the client to connect, so as to provide services.
The sending process of the data packet
Let's describe how a packet sends one packet to another through the application layer, the transport layer, the network layer, and the communication link layer.
Packet structure
First of all, let's take a look at the structure of the packet. Cxuan is just a brief introduction to you here, which will be described in more detail in the following article.
In each of the above layers, a header is added to the data sent, which contains the necessary information for that layer. Each layer processes the data and attaches the necessary information to the packet. Next, let's talk about the process of sending data packets.
Packet sending process
Assuming that host An and host B communicate, what strange operations will host A go through if it wants to send a packet to host B?
Application layer processing
Host A means that the user clicks on an application or opens a chat window to enter cxuan, and then clicks to send, then the cxuan roams in the network as a data packet. Later, the application layer still needs to deal with the data packet, including character coding, formatting, etc., this layer is actually the work done by the presentation layer in OSI, but it is classified as the application layer in the TCP/IP protocol.
The packet establishes a TCP connection at the moment it is sent, which is equivalent to a channel, after which other packets also use the channel to transmit data.
Processing of transport layer
In order to describe the information accurately to the other party, we use the TCP protocol to describe it. TCP is responsible for establishing connections, sending data, and disconnecting according to the instructions of the application.
TCP appends a TCP header field to the front end of the application data layer. The TCP header contains the source port number and the destination port number, which are used to indicate where the packet is sent and to which application it needs to be sent. The TCP header also contains a sequence number to indicate that the data in the packet is the sequence number of the bytes of the whole data on the sending side. The TCP header also contains a checksum to determine whether the data is corrupted, and then appends the TCP header to the header of the packet and sends it to the IP.
Processing of network layer
The network layer is mainly responsible for processing data packets is the IP protocol. IP protocol combines the TCP header and data transmitted from TCP as its own data, and adds its own IP header to the front end of the TCP header. Therefore, the IP packet is followed by the TCP packet, followed by the data itself. The IP header contains the destination and source address, followed by information to determine whether the IP is followed by TCP or UDP.
After the IP packet is generated, the routing control table determines which host it should be sent to, and the IP modified packet continues to be sent to the driver of the router or network interface, so as to achieve real data transmission.
If you do not know the IP address of the target host, you can use the ARP (Address Resolution Protocol) address resolution protocol to look it up.
Processing of Communication Link layer
Ethernet will attach an Ethernet header to the data and send it to the data sent through the IP. The Ethernet header includes the MAC address of the receiver, the MAC address of the sender, and the Ethernet data protocol that marks the Ethernet type.
The following is the complete process and parsing process.
As shown in the figure above, on the left is the process of sending data. After layer-by-layer processing, the data in the application layer becomes a packet that can be sent to the designated host through the physical media.
The receiving process of the packet is the reverse process of the sending process, and the parsing of the packet also goes through the following steps.
Analysis of Communication Link
After receiving the packet, the destination host will first find the MAC address from the header of Ethernet to determine whether it is a packet sent to itself, and if it is not sent to itself, it will discard the packet.
If the packet received is sent to yourself, it will look up the Ethernet type to determine which protocol it is. If it is an IP protocol, it will be thrown to the IP protocol for processing. If it is an ARP protocol, it will be thrown to the ARP protocol for processing. If the protocol type is an unrecognized protocol, the packet is discarded directly.
Analysis of Network layer
After Ethernet processing, the packet is thrown to the network layer for processing. We assume that the protocol type is IP protocol. Then, after IP receives the packet, it will parse the IP header to determine whether the IP address in the IP header matches its own IP address. If so, it receives the data and determines whether the upper layer protocol is TCP or UDP;. If it does not match, it will be discarded directly.
Note: in the process of routing forwarding, sometimes the IP address is not your own, which needs to be handled with the help of the routing table.
Processing of transport layer
In the transport layer, we use TCP protocol by default. In the process of TCP processing, we will first calculate the checksum to determine whether the data is corrupted. Then check whether the data is received according to the sequence number, and finally check the port number to determine which application it is.
After the data is fully identified, it is passed to the application identified by the port number for processing.
Processing of the application
The application specified by the receiver will process the data transmitted by the sender, identify the contents of the data through decoding and other operations, then store the corresponding data on disk and return a successful message to the sender. If the save fails, an error message is returned.
The above is a complete packet sending and receiving process, in the above data sending and receiving process, involving the address, port number, protocol type and so on between different layers, so let's analyze it now.
After the packet passes through each layer, the layer protocol appends the packet header to the packet. A complete packet header is shown below.
In the process of sending a packet, each layer adds the header information to the packet in turn, and each header contains the addresses of the sender and receiver as well as the protocol type of the upper layer. Ethernet uses MAC addresses, IP uses IP addresses, and TCP/UDP uses port numbers as addresses that identify hosts on both sides.
In addition, the packet header in each layer also contains an identification bit, which is used to identify the type information of the upper layer protocol.
This is the end of the content of "what are the basics of TCP/IP". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.