A detection method, device, electronic device and storage medium
By constructing detection data packets corresponding to multiple transmission protocols, detecting the network line between the sending end and the receiving end, the problem that the prior art cannot comprehensively evaluate the transmission quality of network lines is solved, and detailed detection of multiple protocols and long-term connections is realized.
Patent Information
- Application Number
- CN202111249834.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-26
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2041-10-26
AI Technical Summary
The prior art is difficult to effectively detect the network status between sites, especially in the case of multiple transmission protocols and long-term connections, and it is impossible to comprehensively and meticulously evaluate the transmission quality of network lines.
By constructing multiple detection data packets corresponding to multiple transmission protocols, sending them to the receiving end, and receiving corresponding target data packets, determining the detection results of the target line based on the target data packet, including delay and packet loss rate, and then determining the traffic management strategy.
It realizes comprehensive and detailed detection of the transmission quality of multiple transmission protocols and long and short connections between the network line between the sending end and the receiving end, and can select a suitable tunnel transmission mode based on the detection results to maintain the continuous and stable service.
Smart Images

Figure CN116032807B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of communications, and in particular to a detection method, device, electronic device and storage medium. Background Art
[0002] Client sites can communicate with each other, such as between clients and servers, by building tunnels. However, the Internet status between sites is completely a black box for the communication devices of the sites (such as virtual private network (VPN) devices), and the status and visibility of the network are still completely dependent on network detection. Therefore, it is necessary to provide an effective method to detect the network status between sites. Summary of the invention
[0003] In order to solve the above technical problems, the embodiments of the present application provide a detection method, device, electronic device and storage medium.
[0004] The present application provides a detection method, which is applied to a transmitting end and includes:
[0005] Constructing multiple detection data packets corresponding to multiple transmission protocols;
[0006] Sending the plurality of detection data packets to a receiving end;
[0007] receiving a target data packet corresponding to the plurality of detection data packets sent by a receiving end;
[0008] A detection result of a target line is determined based on the target data packet; the target line is a network line between the sending end and the receiving end.
[0009] In an optional implementation manner of the present application, the construction of multiple detection data packets corresponding to multiple transmission protocols includes:
[0010] For each of the multiple transmission protocols, multiple detection data packets with different numbers of bytes are constructed.
[0011] In an optional implementation manner of the present application, the construction of multiple detection data packets corresponding to multiple transmission protocols includes:
[0012] For each of the plurality of transmission protocols, construct a plurality of detection data packets having the same five-tuple; and / or,
[0013] For each of the multiple transmission protocols, a plurality of detection data packets with different five-tuples are constructed.
[0014] In an optional implementation of the present application, the sending end uses a Berkeley Packet Filter (BPF) to filter the multiple detection data packets when sending the multiple detection data packets, and uses the BPF to filter the target data packet when receiving the target data packet.
[0015] In an optional implementation manner of the present application, determining a detection result of a target line based on the target data packet includes:
[0016] For each of the plurality of transmission protocols, based on the target data packets corresponding to the received plurality of detection data packets corresponding to the transmission protocol, determine the delay and packet loss rate of the target line under the transmission protocol;
[0017] Based on the delay and packet loss rate, a traffic management strategy for the target line under the transmission protocol is determined.
[0018] In an optional implementation manner of the present application, sending the multiple detection data packets to the receiving end includes:
[0019] Sending the plurality of detection data packets to a receiving end according to a first rule, wherein the first rule is used to indicate a sending time and a number of sending times of each detection data packet in the plurality of detection data packets, and a duration of receiving a target data packet corresponding to each detection data packet;
[0020] Correspondingly, determining the detection result of the target line based on the target data packet includes:
[0021] When the first rule is met, a detection result of the target line is determined based on the target data packet.
[0022] In an optional implementation manner of the present application, sending the multiple detection data packets to the receiving end includes:
[0023] Sending the multiple detection data packets to the receiving end according to a second rule; the second rule is used to indicate the time period for the sending end to send the multiple detection data packets; the second rule includes multiple time periods;
[0024] Correspondingly, determining the detection result of the target line based on the target data packet includes:
[0025] The traffic management strategy of the target line in different time periods is determined based on the target data packets received in the multiple time periods.
[0026] In an optional implementation manner of the present application, sending the multiple detection data packets to the receiving end includes:
[0027] Send the probe packets in the sliding window;
[0028] If a sliding window movement indication fed back by the receiving end is received, the sliding window is moved, and a newly added detection data packet in the moved sliding window is sent.
[0029] In an optional implementation manner of the present application, the target line is specifically a VPN tunnel;
[0030] Accordingly, after the step of determining the detection result of the target line based on the target data packet, the method further includes:
[0031] Based on the detection result, the construction protocol of the VPN tunnel is converted.
[0032] The embodiment of the present application further provides a detection device, which is applied to a transmitting end and includes:
[0033] A construction unit, used to construct a plurality of detection data packets corresponding to a plurality of transmission protocols;
[0034] A sending unit, configured to send the plurality of detection data packets to a receiving end;
[0035] A receiving unit, configured to receive a target data packet corresponding to the plurality of detection data packets sent by a receiving end;
[0036] A determination unit is used to determine a detection result of a target line based on the target data packet; the target line is a network line between the sending end and the receiving end.
[0037] In an optional implementation manner of the present application, the construction unit is specifically used to: construct multiple detection data packets with different numbers of bytes for each of the multiple transmission protocols.
[0038] In an optional embodiment of the present application, the construction unit is specifically used to: construct multiple probe data packets with the same five-tuple for each of the multiple transmission protocols; and / or construct multiple probe data packets with different five-tuples for each of the multiple transmission protocols.
[0039] In an optional implementation of the present application, the sending end uses a Berkeley Packet Filter (BPF) to filter the multiple detection data packets when sending the multiple detection data packets, and uses the BPF to filter the target data packet when receiving the target data packet.
[0040] In an optional implementation of the present application, the determination unit is specifically used to: for each of the multiple transmission protocols, based on the target data packets corresponding to the multiple detection data packets received corresponding to the transmission protocol, determine the delay and packet loss rate of the target line under the transmission protocol; based on the delay and packet loss rate, determine the traffic management strategy of the target line under the transmission protocol.
[0041] In an optional implementation manner of the present application, the sending unit is specifically used to: send the multiple detection data packets to the receiving end according to a first rule, wherein the first rule is used to indicate the sending time, the number of sending times, and the duration of receiving the target data packets corresponding to each detection data packet of the multiple detection data packets;
[0042] Correspondingly, the determining unit is specifically configured to: determine a detection result for a target line based on the target data packet when the first rule is satisfied.
[0043] In an optional implementation manner of the present application, the sending unit is specifically used to: send the multiple detection data packets to the receiving end according to a second rule; the second rule is used to indicate a time period for the sending end to send the multiple detection data packets; the second rule includes multiple time periods;
[0044] Correspondingly, the determining unit is specifically configured to determine the traffic management strategy of the target line in different time periods based on the target data packets received in the multiple time periods.
[0045] In an optional implementation of the present application, the sending unit is specifically used to: send a detection data packet in a sliding window; if a sliding window movement indication is fed back by a receiving end, move the sliding window and send a newly added detection data packet in the moved sliding window.
[0046] In an optional implementation manner of the present application, the target line is specifically a VPN tunnel; after the determination unit determines the detection result of the target line based on the target data packet, the device further includes:
[0047] A conversion unit is used to convert the construction protocol of the VPN tunnel based on the detection result.
[0048] An embodiment of the present application further provides an electronic device, comprising: a memory and a processor, wherein the memory stores computer executable instructions, and when the processor runs the computer executable instructions on the memory, the detection method described in the above embodiment can be implemented.
[0049] An embodiment of the present application further provides a computer storage medium, on which executable instructions are stored, and when the executable instructions are executed by a processor, the detection method described in the above embodiment is implemented.
[0050] The technical solution of the embodiment of the present application is that the transmitting end constructs multiple detection data packets corresponding to multiple transmission protocols; sends the multiple detection data packets to the receiving end; receives the target data packets corresponding to the multiple detection data packets sent by the receiving end; determines the detection result of the target line based on the target data packet; the target line is the network line between the transmitting end and the receiving end. In this way, the network transmission quality between the transmitting end and the receiving end for multiple different transmission protocols can be detected at the same time, so that the flow control behavior and blocking behavior of the operator can be speculated to a certain extent, and according to the speculation results, the appropriate tunnel transmission mode can be selected between the transmitting end and the receiving end to maintain the continuous stability of the business. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 An architectural diagram of a detection system provided in an embodiment of the present application;
[0052] Figure 2 A flow chart of a detection method provided in an embodiment of the present application;
[0053] Figure 3 A diagram of a data packet timeout retransmission process provided in an embodiment of the present application;
[0054] Figure 4 A schematic diagram of data packet transmission and reception in a detection process provided in an embodiment of the present application;
[0055] Figure 5 A schematic diagram of a packet loss statistics method based on a sliding window provided in an embodiment of the present application;
[0056] Figure 6 A TCP protocol connection management flow chart provided for an embodiment of the present application;
[0057] Figure 7 A schematic diagram of the structure of a detection device provided in an embodiment of the present application;
[0058] Figure 8 A schematic diagram of the structural composition of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0059] In order to enable a more detailed understanding of the features and technical contents of the embodiments of the present application, the implementation of the embodiments of the present application is described in detail below in conjunction with the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present application.
[0060] The following is an explanation of key terms related to the embodiments of the present application:
[0061] User Datagram Protocol (UDP) is a transport layer communication protocol that provides a method for applications to send encapsulated Internet Protocol (IP) data packets without establishing a connection.
[0062] Transmission Control Protocol (TCP) is a connection-oriented, reliable, byte-stream-based transport layer communication protocol.
[0063] Encapsulate Security Payload (ESP) is a protocol of Internet Protocol Security (IPSec), defined in RFC2406, and is used to provide confidentiality and anti-replay services for IP, including confidentiality of data packet contents and limited traffic confidentiality.
[0064] A virtual private network is a private network established on a public network for encrypted communication. It is widely used in corporate networks. VPN gateways enable remote access by encrypting data packets and converting the destination address of data packets.
[0065] Berkeley Packet Filter (BPF) is a primitive interface of the data link layer on Unix-like systems, providing the sending and receiving of primitive link layer packets.
[0066] Internet Service Provider (ISP), referred to as operator, refers to the operator that provides the following information services to the public: one is access service, which is to help users access the Internet; the second is navigation service, which is to help users find the information they need on the Internet; the third is information service, which is to establish a data service system, collect, process and store information, perform regular maintenance and updates, and provide information content services to users through the network.
[0067] The embodiment of the present application first provides a detection method, which is an Internet packet explorer (ping, packet gnat groper) and path detection (traceroute) used for quality detection in the prior art. For the traditional solution, the solution has the following disadvantages:
[0068] (1) The transmission protocol is fixed and cannot flexibly simulate user data behavior;
[0069] (2) It is impossible to detect the length of the connection.
[0070] The traditional solution can only detect the network line using the data packets of the established tunnel transmission mode / protocol, and cannot fully reflect the quality of the network line. For example, if the current tunnel is established in UDP mode, the traditional solution can only detect the quality of the line for UDP protocol, but cannot know the transmission quality of TCP and ESP protocols on the network line.
[0071] On the basis of the above scheme, the embodiment of the present application further proposes the detection method in the following embodiment, which can support multi-branch access, and by flexibly changing the encapsulation protocol of the data packet, as well as the size and port of the data packet, etc., it can not only detect the transmission quality of the network line between the sender and the receiver for multiple transmission protocols, but also test the connectivity of the long and short connections between the sender and the receiver, and comprehensively and meticulously detect the transmission quality of the network line, so as to provide a basis for selecting the optimal transmission mode between the sender and the receiver. In the embodiment of the present application, for VPN tunnel quality detection, if it is detected that the transmission quality of a certain protocol such as UDP is better, and the VPN tunnel is a non-UDP protocol at this time, the protocol used to construct the VPN tunnel can be converted. Of course, if the VPN tunnel is a UDP protocol at this time, there is no need to perform protocol conversion.
[0072] The technical solution of the embodiment of the present application is dedicated to detecting the overall performance of the Internet line and completely deducing the operator's behavior. The technical solution of the embodiment of the present application mainly includes the following aspects:
[0073] (1) Simulating tunnel behavior; simulating tunnel behavior mainly includes: a. Simulating different transmission protocols; constructing data packets based on different transmission protocols and sending and receiving data packets, and determining the transmission quality of the network line between the sender and the receiver for each transmission protocol; b. Constructing data packets of different sizes; simulating different network flows between the sender and the receiver by constructing data packets of different sizes, and determining the transmission quality of the network line for network flows of different sizes; c. Establishing long connections and short connections; determining the connectivity of the long connections and short connections of the network line between the sender and the receiver by changing the port number of the sender and / or the receiver.
[0074] (2) Send a detection packet for detection.
[0075] (3) Detection result statistics and feedback.
[0076] Figure 1 The detection system architecture diagram provided in the embodiment of the present application is as follows: Figure 1As shown, the detection method of the embodiment of the present application is based on a sender-server architecture design, wherein the sender can be understood as a sending site or branch device, generally a client; the receiving end can be understood as a receiving site or headquarters device, generally a server. Figure 1 In the process, the sending end mainly sends detection data packets and performs statistical analysis on the detection results; the receiving end mainly receives detection data packets and sends target data packets to the sending end.
[0077] The client is usually installed in the branch device and is responsible for actively initiating detection, while the server is usually installed in the headquarters device and is responsible for passively responding to the client's request. As a preferred method, considering that the server supports the high concurrency requirements of the client, the overall logic of the server tends to be simple. Its main function is to respond to client requests and return corresponding data packets. The main management logic is completed on the client.
[0078] Table 1 Figure 1 An introduction to the functions of some modules in the architecture shown.
[0079] Table 1 Introduction to detection system architecture modules
[0080]
[0081] Next, combine Figure 1 The detection architecture diagram shown is used to illustrate the technical solution of the embodiment of the present application. Figure 2 A flow chart of the detection method provided in the embodiment of the present application is as follows: Figure 2 As shown, the method is applied to a transmitting end, and the method comprises the following steps:
[0082] Step 201: construct multiple detection data packets corresponding to multiple transmission protocols.
[0083] In the embodiment of the present application, before constructing the detection data packet, the sending end first reads the configuration information of the detection line from the configuration management module, and the configuration information includes the IP address information of the receiving end.
[0084] In an embodiment of the present application, the client can simulate multiple detection data packets corresponding to multiple transmission protocols by creating a raw socket. Here, for each transmission protocol, the number of constructed detection packets can be multiple.
[0085] In the embodiments of the present application, there is no specific restriction on the specific protocols involved in the multiple transmission protocols, and the selection is made based on the user's detection needs. For example, the transmission protocol can be UDP protocol, TCP protocol, ESP protocol, and can also be a protocol customized by the user according to needs.
[0086] In an optional implementation manner of the present application, the step 201 specifically includes:
[0087] For each of the multiple transmission protocols, multiple detection data packets with different numbers of bytes are constructed.
[0088] In the embodiment of the present application, multiple detection packets with different numbers of bytes are constructed in order to detect the transmission status of the network line for different types of application traffic. For example, the embodiment of the present application uses a detection packet containing fewer bytes to perform line detection, which can determine the transmission quality of the line for text-type web page data. Use a detection packet containing a larger number of bytes to perform line detection, which can determine the transmission quality of the line for video and game application data.
[0089] In an optional implementation manner of the present application, step 201 may further specifically include:
[0090] For each of the multiple transport protocols, multiple detection packets with the same five-tuple are constructed. The five-tuple described in this article is: source port, source IP, destination port, destination IP and transport layer protocol type. By constructing detection packets with the same five-tuple, the connectivity of the network link for the long connection can be detected. The long connection means that the five-tuple of the detection packet remains unchanged for a long time.
[0091] and / or
[0092] For each of the multiple transmission protocols, multiple detection data packets of different five-tuples are constructed to detect the connectivity of the network link for the short connection. The different five-tuples mean that at least one of the five-tuples has different information.
[0093] Operators may regard long connections as malicious traffic and block them, causing slowdowns. Therefore, the technical features described here can detect the connectivity of long and short connections.
[0094] The technical solution of the embodiment of the present application can test the connectivity of the long and short connections of the line by defining the five-tuple in the data packet when constructing the data packet. Among them, by constructing multiple detection data packets with the same five-tuple, the connectivity of the line for the long connection can be tested, and by constructing multiple detection data packets with different five-tuples, the connectivity of the line for the short connection can be tested.
[0095] Step 202: Send the multiple detection data packets to the receiving end.
[0096] In an optional implementation of the present application, the sending end uses a Berkeley Packet Filter (BPF) to filter the multiple detection data packets when sending the multiple detection data packets, and uses the BPF to filter the target data packet when receiving the target data packet.
[0097] In the embodiment of the present application, the client can efficiently send probe data packets and receive target data packets by adopting a high-performance packet filtering solution based on Berkeley Packet Filter (BPF), thereby efficiently performing statistics on the detection results based on the sent probe data packets and the received target data packets.
[0098] In an optional implementation of the present application, the data packet filtering method can also adopt application layer data packet filtering. On the other hand, in a high version kernel, eBPF can be used to directly return the detection results without filtering the data packet to the application layer.
[0099] Application layer packet filtering, also known as application layer message filtering (ASPF, Application Specific Packet Filter), is packet filtering for the application layer, that is, message filtering based on state detection, also known as a stateful firewall, which maintains the state of each connection and checks the data of the application layer protocol to determine whether the data packet is allowed to pass. It works in conjunction with ordinary static firewalls to facilitate the implementation of internal network security policies. ASPF can detect application layer protocol session information that attempts to pass through the firewall and prevent data packets that do not comply with the rules from passing through.
[0100] As for eBPF, eBPF is the abbreviation of extended BPF. Extended BPF is a new design introduced in kernel 3.15, which develops the original BPF into a "kernel virtual machine" with a more complex instruction set and a wider range of applications. By "attaching" the eBPF program to the specified code path in the kernel, all attached eBPF programs will be executed when traversing the code path. eBPF can be used to write network programs. By writing programs attached to network sockets, traffic can be filtered, traffic can be classified, and network classifier operations can be run.
[0101] In an optional implementation manner of the present application, the above step 202 can be specifically implemented in the following manner:
[0102] The multiple detection data packets are sent to the receiving end according to a first rule, wherein the first rule is used to indicate the sending time and number of sending of each detection data packet in the multiple detection data packets and the duration of receiving the target data packet corresponding to each detection data packet.
[0103] In an embodiment of the present application, the duration of receiving the target data packet corresponding to each detection data packet is specified as a time threshold. The time threshold is understood to be the time interval between the time of sending the detection data packet and the time of receiving the target data packet corresponding to the detection data packet. If the time interval is exceeded, it is considered that the detection data packet needs to be retransmitted, or that the line between the sending end and the receiving end is interrupted.
[0104] In the embodiment of the present application, since the first rule specifies the sending time, the number of sending times of each detection data packet in the multiple data packets, and the time length of receiving the target data packet corresponding to each detection data packet, it can be used Figure 1 The timing management module in the method sets and manages the packet sending interval of each detection data packet in multiple detection data packets based on the first rule (determined according to the sending time of each detection data packet in the first rule), the timeout retransmission time interval of each detection data packet (determined according to the time length of receiving the target data packet corresponding to the detection data packet in the first rule, that is, the time threshold) and the number of timeout retransmissions (determined according to the number of sending times in the first rule).
[0105] In an embodiment of the present application, the timeout retransmission time of each detection data packet can be a pre-set time value, or it can be a time value calculated using an adaptive algorithm and can change according to the real-time transmission situation. For example, the round-trip time (RTT) of the data packet measured each time is used to calculate the weighted average round-trip time, and a time value slightly larger than the weighted average round-trip time is used as the timeout retransmission time.
[0106] Figure 3 The detection data packet timeout retransmission process diagram provided in the embodiment of the present application is as follows for each detection data packet corresponding to each transmission protocol. Figure 3 Steps 301 to 305 are shown to perform timeout retransmission of the detection data packet.
[0107] By sending the detection data packet according to the first rule, it is possible to trigger the sending end to perform detection result statistics for the detection packet after each detection data packet is sent, thereby avoiding the detection result statistics being performed before the detection process corresponding to the detection packet is completed (such as the timeout retransmission number has not been reached, the target data packet reception time has not been reached), thereby causing errors in the statistical results.
[0108] It can be understood that the statistical detection results of the embodiment of the present application include the number of timeout retransmissions and the timeout retransmission time of each detection data packet.
[0109] In an optional implementation manner of the present application, the above step 202 can also be specifically performed in the following manner:
[0110] Sending the multiple detection data packets to the receiving end according to a second rule; the second rule is used to indicate the time period for the sending end to send the multiple detection data packets; the second rule includes multiple time periods;
[0111] In the embodiment of the present application, multiple detection data packets are sent according to the second rule, mainly in combination with the sending end Figure 1 The timing management module in the system sets the time period for sending multiple detection data packets. It is understandable that the transmission quality of the network line may be different in different time periods. For example, in the early morning time period, the network line may have good transmission quality for any transmission protocol and also have good transmission quality for data packets of different sizes. In the evening time period, the network line may only have good transmission quality for one of the multiple transmission protocols.
[0112] The technical solution of the embodiment of the present application can use the select function to select the time period for sending the detection data packet, that is, to select the detection cycle, so as to detect the transmission quality of the network line in different time periods.
[0113] Step 203: Receive target data packets corresponding to the multiple detection data packets sent by the receiving end.
[0114] In the embodiment of the present application, the receiving end mainly sends the target data packets corresponding to the detection data packets to the sending end after receiving the detection data packets sent by the sending end. When the receiving end wants the sending end to return the target data packet, the uplink detection result of the target line can also be added to the target data packet.
[0115] In the embodiment of the present application, the uplink detection process is specifically the process from the sending end sending the detection data packet to the receiving end receiving the detection data packet sent by the sending end. The uplink detection result is the data transmission situation during the uplink detection process, such as the uplink transmission time of the data packet, the packet loss rate of the uplink transmission process of the data packet, etc. The receiving end adds the uplink detection result to the target data packet and sends it to the sending end, so that the sending end can obtain the uplink detection information (of course, the uplink detection result can also be calculated by the sending end). After that, the sending end determines the downlink detection information in combination with the received target data packet, and the uplink detection information and downlink detection information of the complete detection process can be obtained. In addition, the sending end can directly send the uplink detection information and the downlink detection information to the central server, which can exempt the receiving end from sending the uplink detection information to the central server separately, thereby reducing the number of data packets sent during the detection result statistics process.
[0116] In an embodiment of the present application, the target data packet returned by the receiving end can be an echo detection data packet or a confirmation data packet. For the echo detection data packet, specifically, after receiving the detection data packet, the receiving end keeps other data in the detection data packet unchanged, modifies the source address and destination address of the detection data packet (i.e., modifies the destination address of the detection data packet to the sender address, and modifies the source address of the detection data packet to the receiver address), obtains the target data packet, and sends the target data packet from the receiving end to the sender. For the confirmation data packet, specifically, after receiving the detection data packet, the receiving end sends a notification message to the sender for notifying the sender that the detection data packet has been received. In an optional implementation manner of the present application, the method of sending and receiving data packets can also adopt direct drive packet receiving, which is completed completely through the driver program. Of course, the sending and receiving of data packets can also be completed by using a pure application layer.
[0117] Step 204: Determine a detection result of a target line based on the target data packet; the target line is a network line between the sending end and the receiving end.
[0118] In the embodiment of the present application, the target line is specifically a VPN tunnel. After the sender determines the detection result of the target line based on the target data packet, the sender can convert the construction protocol of the VPN tunnel based on the detection result.
[0119] Specifically, in an optional implementation manner of the present application, step 204 specifically includes:
[0120] For each of the plurality of transmission protocols, based on the target data packets corresponding to the received plurality of detection data packets corresponding to the transmission protocol, determine network parameters such as delay and packet loss rate of the target line under the transmission protocol;
[0121] Based on the network parameters such as the delay and packet loss rate, the traffic management strategy of the target line for the transmission protocol (for example, the network operator's traffic management strategy for the protocol) can be determined, thereby providing a basis for subsequent protocol selection. For example, if the UDP protocol is found to have the best transmission quality after detection, the UDP protocol can be used for data transmission when data is actually transmitted later.
[0122] In an optional implementation manner of the present application, the sending end uses an interactive window mechanism to send the multiple detection data packets to the receiving end. The specific method of sending the multiple detection data packets is:
[0123] Send the probe packets in the sliding window;
[0124] If a sliding window movement indication fed back by the receiving end is received, the sliding window is moved, and a newly added detection data packet in the moved sliding window is sent.
[0125] Figure 4 A schematic diagram of data packet transmission and reception in a specific detection process provided by an embodiment of the present application. Figure 4 As shown, the sender mainly detects the transmission delay and packet loss rate of UDP, ESP and TCP protocols by sending detection data packets.
[0126] In an optional implementation of the present application, the transmission delay of the data packet can be directly obtained by using the round-trip time (RTT) of the data packet, and the packet loss situation can be obtained by Figure 5 The sliding window method shown in the figure counts the packet loss in the current window. Figure 5 The method of calculating the packet loss rate by the sliding window shown is described as follows.
[0127] For the sliding window mechanism, specifically, a sending window is set at the sending end, and a receiving window is set at the receiving end, such as Figure 5 As shown, a sending window and a receiving window with a window number of 16 can be set at the sending end and the receiving end. When the sending end sends a detection data packet to the receiving end, 5 detection data packets are grouped together. For the 1st to 5th data packets sent, the sending end changes the value of the corresponding sending window from 1 to 0 after sending these 5 data packets to the receiving end. After receiving the target data packet corresponding to one or more detection data packets in the 1st to 5th detection data packets, the sending end changes the value of the corresponding window from 0 to 1. At this point, the sending end can calculate the packet loss rate of the first 5 data packets sent. In addition, based on the sliding window mechanism, after the sender sends the 1st to 5th data packets to the receiver, the receiver determines that it can still receive the 6th to 15th data packets and feeds this information back to the sender. After receiving the information, the sender moves the sending window to the right by 5 windows and continues to send the 6th to 10th data packets. Here, when sending the 6th to 10th data packets, the sender only needs to confirm that the receiver still has receiving space (i.e., whether there are still remaining receiving windows), and does not need to ensure whether the sender has received the confirmation information of the first 1-5 data packets fed back by the receiver. After sending the 6th to 10th data packets, the sender changes the value of the corresponding sending window from 1 to 0, and based on receiving the target data packets corresponding to one or more detection data packets in the 6th to 10th detection data packets, the value of the corresponding sending window is changed from 0 to 1. At this point, the sender can calculate the packet loss rate of the first 10 data packets sent. For the 11th to 15th data packets, the sender can also send the 11th to 15th data packets without receiving confirmation information of the first 1-10 data packets fed back by the receiver and determining that the receiver still has a remaining receiving window, and determine the packet loss rate of the 11th to 15th data packets based on the reception status of the target data packets corresponding to the received 11th to 15th detection data packets.
[0128] In the embodiment of the present application, the packet loss of the data packets in the current window is counted through the sliding window mechanism. As the sliding window moves, the packet loss value can be calculated for each data packet, without having to wait until a whole group of data packets are received before calculating the packet loss value. In addition, the sliding window mechanism can be used to determine the receiving end's receiving ability for the detection data packet. When there is no remaining receiving window at the receiving end, the sending end temporarily stops sending the data packet. After the sending end confirms that the receiving end has received the detection data packet, that is, when it is determined that there is a remaining receiving window at the receiving end, the subsequent detection data packet is sent, which helps to lengthen the packet sending interval, reduce the detection overhead, and can avoid the detection result being affected not only by the network link but also by the receiving end, thereby avoiding inaccurate detection results.
[0129] In an optional implementation manner of the present application, when the sending end sends the plurality of detection data packets to the receiving end according to the first rule, the above step 204 specifically includes:
[0130] When the first rule is met, a detection result of the target line is determined based on the target data packet.
[0131] Specifically, since the first rule is used to indicate the sending time, the number of sending times, and the duration of receiving the target data packet corresponding to each of the multiple detection data packets, the sending end can manage each detection connection by using a hash table when sending the detection data packet and receiving the target data packet, use the keywords in the hash table to record the IP address pair information between the sending end and the receiving end, use the value information in the hash table to record the detection data packet sending time, retransmission time, number of retransmissions, target data packet receiving time and other information related to the target line, and calculate the transmission delay and packet loss rate corresponding to each data packet based on the above information.
[0132] Among them, for the transmission delay, the sender can determine the transmission delay of the detection data packet as t2-t1 according to the recorded sending time t1 of the detection data packet and the receiving time t2 of the target data packet corresponding to the detection data packet; for the packet loss rate, it can be calculated according to Figure 5 The sliding window method shown is used for determination.
[0133] Based on the above protocols that record and count, the detection results of the target line for each transmission protocol can be counted. According to the detection results, the flow control and blocking behaviors of the operator can be speculated to a certain extent, so that in the VPN scenario, a suitable VPN tunnel establishment protocol can be constructed to ensure the continuous stability of the business.
[0134] In an optional implementation manner of the present application, when the transmitting end sends the plurality of detection data packets to the receiving end according to the second rule, the above step 204 specifically includes:
[0135] The traffic management strategy of the target line in different time periods is determined based on the target data packets received in the multiple time periods. Specifically, since the second rule is used to indicate the time period in which the sender sends the multiple detection data packets. The present application can detect the transmission quality of the network line in different time periods by detecting the target line in different time periods.
[0136] It should be noted that for the detection of the target line under the TCP protocol, in order to avoid the TCP packet being blocked, a three-way handshake is required to establish a connection before TCP detection; after the three-way handshake, a child thread is created based on the constructed hash table to send packets for detection. The specific process is as follows Figure 6 Steps 601 to 604 are performed in sequence. In addition, for the detection of the target line under the TCP protocol, when the detection data packet times out and retransmits, the data packets that need to be retransmitted include the syn data packet of the TCP three-way handshake (the data packet that needs to be sent to establish a TCP connection, which can confirm whether the TCP connection is successfully established between the sender and the receiver) and the detection data packet (which can ensure that each detection data packet sent reaches the receiver). The present application can add the retransmission event to the timing management module of the sender, and count the confirmation time of this type of data packet. If a certain time interval is reached and no confirmation data packet is obtained, the data packet needs to be retransmitted, and the next round of timeout time is recalculated.
[0137] The technical solution of the embodiment of the present application can not only detect the transmission quality of the network line between the sender and the receiver for multiple transmission protocols by flexibly changing the construction conditions of the data packet, changing the encapsulation protocol of the data packet, and changing the size and port of the data packet, but also test the connectivity of the long and short connections between the sender and the receiver, comprehensively and meticulously detect the transmission quality of the network line, and provide a basis for selecting the optimal transmission mode between the sender and the receiver. The embodiment of the present application can make certain inferences on the flow control behavior and blocking behavior of the operator, and select a suitable tunnel transmission mode between the sender and the receiver based on the inference results to maintain the continuous stability of the business.
[0138] Figure 7 A schematic diagram of the structure of a detection device 700 provided in an embodiment of the present application, wherein the detection device 700 is applied to a receiving end, such as Figure 7 As shown, the detection device 700 includes:
[0139] A construction unit 701 is used to construct a plurality of detection data packets corresponding to a plurality of transmission protocols;
[0140] A sending unit 702 is used to send the multiple detection data packets to a receiving end;
[0141] The receiving unit 703 is configured to receive a target data packet corresponding to the plurality of detection data packets sent by a receiving end;
[0142] The determination unit 704 is configured to determine a detection result of a target line based on the target data packet; the target line is a network line between the sending end and the receiving end.
[0143] In an optional implementation manner of the present application, the construction unit 701 is specifically used to: construct multiple detection data packets with different numbers of bytes for each of the multiple transmission protocols.
[0144] In an optional implementation of the present application, the construction unit 701 is specifically used to: construct multiple probe data packets with the same five-tuple for each of the multiple transmission protocols; and / or construct multiple probe data packets with different five-tuples for each of the multiple transmission protocols.
[0145] In an optional implementation of the present application, the sending end uses a Berkeley Packet Filter (BPF) to filter the multiple detection data packets when sending the multiple detection data packets, and uses the BPF to filter the target data packet when receiving the target data packet.
[0146] In an optional implementation of the present application, the determination unit 704 is specifically used to: for each of the multiple transmission protocols, determine the delay and packet loss rate of the target line under the transmission protocol based on the target data packets corresponding to the multiple detection data packets received corresponding to the transmission protocol; based on the delay and packet loss rate, determine the traffic management strategy of the target line under the transmission protocol.
[0147] In an optional implementation manner of the present application, the sending unit 702 is specifically used to: send the multiple detection data packets to the receiving end according to a first rule, where the first rule is used to indicate the sending time, the number of sending times, and the duration of receiving the target data packets corresponding to each detection data packet in the multiple detection data packets;
[0148] Correspondingly, the determining unit 704 is specifically configured to: determine a detection result for a target line based on the target data packet when the first rule is satisfied.
[0149] In an optional implementation manner of the present application, the sending unit 702 is specifically used to: send the multiple detection data packets to the receiving end according to a second rule; the second rule is used to indicate a time period for the sending end to send the multiple detection data packets; the second rule includes multiple time periods;
[0150] Correspondingly, the determining unit 704 is specifically configured to determine the traffic management strategy of the target line in different time periods based on the target data packets received in the multiple time periods.
[0151] In an optional implementation of the present application, the sending unit 702 is specifically used to: send a detection data packet in a sliding window; if a sliding window movement indication is fed back by a receiving end, move the sliding window and send a newly added detection data packet in the moved sliding window.
[0152] In an optional implementation manner of the present application, the target line is specifically a VPN tunnel; after the determination unit 704 determines the detection result of the target line based on the target data packet, the device further includes:
[0153] The conversion unit 705 is used to convert the construction protocol of the VPN tunnel based on the detection result.
[0154] Those skilled in the art should understand that Figure 7 The functions implemented by each unit in the detection device shown can be understood by referring to the relevant description of the aforementioned detection method. Figure 7 The functions of each unit in the detection device shown can be implemented by a program running on a processor, or by a specific logic circuit.
[0155] An embodiment of the present application also provides an electronic device. Figure 8 Schematic diagram of the hardware structure of the electronic device of the embodiment of the present application, such as Figure 8 As shown, the electronic device includes: a communication component 803 for data transmission, at least one processor 801 and a memory 802 for storing a computer program that can be run on the processor 801. The various components in the terminal are coupled together through a bus system 804. It can be understood that the bus system 804 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 804 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, Figure 8 Various buses are labeled as bus system 804 .
[0156] When the processor 801 executes the computer program, at least Figure 1 The steps of the method are shown.
[0157] It can be understood that the memory 802 can be a volatile memory or a non-volatile memory, and can also include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disk, or a compact disc read-only memory (CD-ROM); the magnetic surface memory can be a disk memory or a tape memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM, SyncLink Dynamic Random Access Memory), and direct RAM bus random access memory (DRRAM, Direct Rambus Random Access Memory).The memory 802 described in the embodiments of the present application is intended to include but is not limited to these and any other suitable types of memories.
[0158] The method disclosed in the above embodiment of the present application can be applied to the processor 801, or implemented by the processor 801. The processor 801 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor 801 or an instruction in the form of software. The above processor 801 may be a general-purpose processor, a DSP, or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The processor 801 can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or any conventional processor, etc. In combination with the steps of the method disclosed in the embodiment of the present application, it can be directly embodied as a hardware decoding processor to execute, or it can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium, which is located in the memory 802, and the processor 801 reads the information in the memory 802 and completes the steps of the above method in combination with its hardware.
[0159] In an exemplary embodiment, the electronic device may be implemented by one or more application specific integrated circuits (ASIC), DSP, programmable logic device (PLD), complex programmable logic device (CPLD), FPGA, general purpose processor, controller, MCU, microprocessor, or other electronic components to execute the aforementioned call recording method.
[0160] The present application also provides a computer-readable storage medium having a computer program stored thereon, wherein the program is at least used to execute when executed by a processor Figure 1 The computer readable storage medium may be a memory. The memory may be Figure 8 Memory 802 is shown.
[0161] The technical solutions described in the embodiments of the present application can be combined arbitrarily without conflict.
[0162] In the several embodiments provided in the present application, it should be understood that the disclosed methods and intelligent devices can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0163] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0164] In addition, all functional units in the embodiments of the present application may be integrated into a second processing unit, or each unit may be a separate unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0165] The above description is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.
Claims
1. A detection method, characterized in that: The method is applied to a transmitting end, and the method comprises: Constructing multiple detection data packets corresponding to multiple transmission protocols; Sending the plurality of detection data packets to a receiving end; receiving a target data packet corresponding to the plurality of detection data packets sent by a receiving end; Determine the detection result of the target line based on the delay and packet loss rate corresponding to the target data packet; the target line is the network line between the sending end and the receiving end; The step of constructing a plurality of detection data packets corresponding to a plurality of transmission protocols includes: For each of the multiple transmission protocols, a plurality of detection data packets with different byte numbers are constructed; the plurality of detection data packets with different byte numbers are used to detect the transmission conditions of the network line for different types of application traffic.
2. The method according to claim 1, characterized in that: The constructing of multiple detection data packets corresponding to multiple transmission protocols includes: For each of the plurality of transport protocols, construct a plurality of probe data packets having the same five-tuple; and / or, For each of the multiple transmission protocols, a plurality of detection data packets with different five-tuples are constructed.
3. The method according to any one of claims 1 to 2, characterized in that: The sending end uses a Berkeley Packet Filter (BPF) to filter the multiple detection data packets when sending the multiple detection data packets, and uses the BPF to filter the target data packets when receiving the target data packets.
4. The method according to any one of claims 1 to 2, characterized in that The step of determining the detection result of the target line based on the delay and packet loss rate corresponding to the target data packet includes: For each of the plurality of transmission protocols, based on the target data packets corresponding to the received plurality of detection data packets corresponding to the transmission protocol, determine the delay and packet loss rate of the target line under the transmission protocol; Based on the delay and packet loss rate, a traffic management strategy for the target line under the transmission protocol is determined.
5. The method according to any one of claims 1 to 2, characterized in that The sending of the plurality of detection data packets to the receiving end comprises: Sending the plurality of detection data packets to a receiving end according to a first rule, wherein the first rule is used to indicate a sending time and a number of sending times of each detection data packet in the plurality of detection data packets, and a duration of receiving a target data packet corresponding to each detection data packet; Correspondingly, determining the detection result of the target line based on the target data packet includes: When the first rule is met, a detection result of the target line is determined based on the target data packet.
6. The method according to any one of claims 1 to 2, characterized in that The sending of the plurality of detection data packets to the receiving end comprises: Sending the multiple detection data packets to the receiving end according to a second rule; the second rule is used to indicate the time period for the sending end to send the multiple detection data packets; the second rule includes multiple time periods; Correspondingly, determining the detection result of the target line based on the target data packet includes: The traffic management strategy of the target line in different time periods is determined based on the target data packets received in the multiple time periods.
7. The method according to claim 1, characterized in that The sending of the plurality of detection data packets to the receiving end comprises: Send the probe packets in the sliding window; If a sliding window movement indication fed back by the receiving end is received, the sliding window is moved, and a newly added detection data packet in the moved sliding window is sent.
8. The method according to claim 1, characterized in that The target line is specifically a VPN tunnel; Accordingly, after the step of determining the detection result of the target line based on the target data packet, the method further includes: Based on the detection result, the construction protocol of the VPN tunnel is converted.
9. A detection device, characterized in that: The device is applied to a transmitting end, and the device includes: A construction unit, used to construct a plurality of detection data packets corresponding to a plurality of transmission protocols; A sending unit, configured to send the plurality of detection data packets to a receiving end; A receiving unit, configured to receive a target data packet corresponding to the plurality of detection data packets sent by a receiving end; A determination unit, configured to determine a detection result of a target line based on a delay and a packet loss rate corresponding to the target data packet; the target line is a network line between the sending end and the receiving end; The step of constructing a plurality of detection data packets corresponding to a plurality of transmission protocols includes: For each of the multiple transmission protocols, a plurality of detection data packets with different byte numbers are constructed; the plurality of detection data packets with different byte numbers are used to detect the transmission conditions of the network line for different types of application traffic.
10. An electronic device, characterized in that: The electronic device comprises: a memory and a processor, wherein the memory stores computer executable instructions, and the processor can implement any one of claims 1 to 8 when executing the computer executable instructions on the memory.
11. A computer storage medium, characterized in that: The storage medium stores executable instructions, which, when executed by a processor, implement the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
End-to-end link packet loss analysis method based on packet loss rate
CN110233778A
Network quality detection method, system and device
CN112511454A