Data packet sending method and device, terminal equipment and storage medium
By using virtualization technology in terminal devices to adjust the transmission order and transmission path of data packets, the congestion problem when data packets are transmitted to the same broadcast domain in industrial networks is solved, and higher network stability and reliability are achieved.
Patent Information
- Application Number
- CN202311745426.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-19
- Publication Date
- 2025-06-27
AI Technical Summary
A large number of data packets in industrial networks are easily caused by network congestion and paralysis when transmitted to the same broadcast domain.
By introducing virtual switches and virtual routers into terminal devices, virtualization technology is used to adjust the transmission order and transmission path of data packets to avoid the transmission of data packets to the same transmission path at the same time.
It effectively avoids congestion during data packet transmission, improves the stability and reliability of industrial networks, and reduces deployment costs.
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This application belongs to the field of network technology, and particularly relates to a data packet sending method, apparatus, terminal device, and storage medium. Background Art
[0002] With the rapid progress of network technology, the scale of industrial networks is also gradually expanding. Among them, an industrial network refers to a fully digital, two-way, multi-station communication system installed in an industrial production environment.
[0003] Currently, a large number of hardware network devices are usually deployed in industrial networks. When a large number of hardware network devices perform data interaction, a large number of switches and routers are required to provide network services.
[0004] However, since switches and routers cannot send data packets flexibly and intelligently, when a large number of data packets need to be transmitted to the same broadcast domain, it is easy to cause congestion in the entire industrial network, resulting in the problem of industrial network paralysis. Summary of the Invention
[0005] Embodiments of this application provide a data packet sending method, apparatus, terminal device, and storage medium, which can solve the problem that the entire industrial network is prone to congestion and paralysis when a large number of data packets need to be transmitted to the same broadcast domain.
[0006] In a first aspect, embodiments of this application provide a data packet sending method, which is characterized in that it is applied to a terminal device. The terminal device includes a virtual switch and a virtual router. The method includes: Determine the port information of each data packet received by the virtual switch and the data information of each data packet respectively; the data information includes the DSCP value and the destination IP; If there are multiple data packets to be sent, control the virtual switch to adjust the first sending order of each data packet sent to the virtual router according to the port information and the DSCP value; Control the virtual switch to send each data packet to the virtual router based on the first sending order; Control the virtual router to adjust the target transmission path and the second sending order of each data packet when sending according to each DSCP value and the destination IP; Control the virtual router to send data packets respectively according to the target transmission path and the second sending order of each data packet.
[0007] In a second aspect, embodiments of this application provide a data packet sending apparatus, which is applied to a terminal device. The terminal device includes a virtual switch and a virtual router. The apparatus includes: A determination module, configured to respectively determine the port information of each data packet received by the virtual switch and the data information of each data packet; the data information includes the DSCP value and the destination IP; A first adjustment module, configured to, if there are multiple data packets to be sent, control the virtual switch to adjust the first sending order of each data packet sent to the virtual router according to the port information and the DSCP value; A first sending module, configured to control the virtual switch to send each data packet to the virtual router based on the first sending order; A second adjustment module, configured to control the virtual router to adjust the target transmission path and the second sending order of each data packet when sending according to each DSCP value and the destination IP; A second sending module, configured to control the virtual router to send the data packets respectively according to the target transmission path and the second sending order of each data packet.
[0008] In a third aspect, an embodiment of the present application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the method in the first aspect as described above is implemented.
[0009] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, storing a computer program, and when the computer program is executed by a processor, the method in the first aspect as described above is implemented.
[0010] In a fifth aspect, an embodiment of the present application provides a computer program product, which, when running on a terminal device, causes the terminal device to execute the method in the first aspect as described above.
[0011] The beneficial effects of the embodiments of the present application compared with the prior art are as follows: The terminal device can use virtualization technology to convert the functions of a hardware switch and a hardware router into software capabilities and implement them within the terminal device. This can not only achieve the flexibility and programmability of industrial network deployment, but also reduce the number of switches and routers that need to be deployed, thereby lowering the deployment cost of the industrial network. Subsequently, when sending data packets, the terminal device can respectively determine the port information when each data packet is received by the virtual switch and the DSCP value in each data packet, so as to adjust the sending order of each data packet when it is sent to the virtual router, and make the data packets be sent to the virtual router in sequence. Then, when the virtual router has multiple data packets to be sent, the virtual router can, according to the DSCP value and destination IP of each data packet, adjust the second sending order of the data packets again, and at the same time adjust the target transmission path during the transmission of the data packets. Furthermore, on the basis of realizing the transmission of data packets, the second sending order and the target transmission path of each data packet can also be flexibly adjusted according to the data information of the data packets to be sent in the virtual router and the virtual switch. Moreover, when a large number of data packets need to be transmitted to the same broadcast domain, sending each data packet according to the adjusted target transmission path and the second sending order can avoid the situation where a large number of data packets are transmitted to the same transmission path simultaneously, resulting in congestion in the entire industrial network. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for use in the embodiments or the description of the prior art. Obviously, the following drawings are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0013] Figure 1 is a flowchart of the implementation of a data packet sending method provided by an embodiment of the present application; Figure 2 is a schematic diagram of an implementation manner for determining data information in a data packet sending method provided by an embodiment of the present application; Figure 3 is a flowchart of the implementation of a data sending method provided by another embodiment of the present application; Figure 4 is a schematic diagram of the structure of a data packet sending device provided by an embodiment of the present application; Figure 5 is a schematic diagram of the structure of a terminal device provided by an embodiment of the present application. EMBODIMENTS
[0014] In the following description, specific details such as specific system architectures and technologies are presented for the purpose of illustration rather than limitation, so as to thoroughly understand the embodiments of the present application. However, those skilled in the art should understand that the present application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid unnecessary details from obstructing the description of the present application.
[0015] It should be understood that when used in the specification and appended claims of the present application, the term "comprising" indicates the presence of the described features, wholes, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.
[0016] In addition, in the description of the specification and appended claims of the present application, the terms "first", "second", "third", etc. are only used for distinguishing descriptions and cannot be construed as indicating or implying relative importance.
[0017] With the rapid progress of network technology, the scale of industrial networks is also gradually expanding. Among them, an industrial network refers to a fully digital, two-way, multi-station communication system installed in an industrial production environment.
[0018] Currently, a large number of hardware network devices are usually deployed in industrial networks. When a large number of hardware network devices perform data interaction, a large number of switches and routers are required to provide network services.
[0019] Specifically, a switch is a network device that can identify based on MAC (the hardware address of the network card) and can complete the function of encapsulating and forwarding data packets. Among them, the switch mainly operates at the data link layer. The switch can store the MAC address in the internal address table and establish a temporary transmission path between the source MAC and the destination MAC of the data packet, so that the data packet can directly reach the source MAC and the destination MAC.
[0020] A router is a network device that connects multiple networks or network segments and can transmit data information between different networks or network segments. Among them, the router includes a data channel function and a control function. The data channel function includes functions such as transmission decision, backplane transmission, and output link scheduling, and can determine the transmission path of data packets through dynamic routing protocols and static routing protocols. Specifically, the router can establish a transmission path according to the destination IP in the data packet for data transmission. Among them, the router mainly operates at the network layer and performs address allocation and routing between various nodes of the network. The control function includes information exchange with adjacent routers, system configuration, system management, etc.
[0021] However, since switches and routers cannot send data packets flexibly and intelligently, when a large number of data packets need to be transmitted to the same broadcast domain, it is easy to cause congestion in the entire industrial network, resulting in the problem of industrial network paralysis.
[0022] Based on this, in order to send data packets flexibly and intelligently to maintain the entire industrial network, the data packet sending method provided in the embodiments of the present application can be applied to terminal devices such as mobile phones, tablet computers, laptop computers, Ultra-Mobile Personal Computers (UMPCs), and netbooks. The embodiments of the present application do not impose any restrictions on the specific types of terminal devices.
[0023] In one embodiment, the terminal device includes a virtual switch and a virtual router. Among them, the virtual switch can implement the functions of a hardware switch, and the virtual router can implement the functions of a hardware router. That is, by using virtualization technology, the functions of a hardware switch and a hardware router are converted into software capabilities and implemented within the terminal device, which can not only achieve the flexibility and programmability of industrial network deployment, but also reduce the number of switches and routers that need to be deployed, thereby reducing the deployment cost of the industrial network.
[0024] It should be added that since the functions of a hardware switch and a hardware router are converted into software capabilities and implemented within the terminal device by using virtualization technology, the staff can also develop and adjust the software capabilities of the terminal device. Furthermore, on the basis of being able to implement the functions of the original hardware switch and hardware router, the terminal device can also optimize data packet transmission according to the developed and adjusted functions to avoid congestion in the industrial network.
[0025] Please refer to Figure 1 , Figure 1 , which shows the implementation flowchart of a data packet sending method provided in the embodiments of the present application. The method includes the following steps: S101. Determine the port information of each data packet received by the virtual switch and the data information of each data packet respectively; the data information includes the DSCP value and the destination IP.
[0026] In one embodiment, the above port information includes, but is not limited to, the port number and port attributes of the received data packet, and no limitation is imposed thereon. Exemplarily, the port number can be used to represent the importance of the sent data packet. The port attribute can be used to represent the service type of the sent data packet. In this embodiment, the port information can mainly include the port number.
[0027] Among them, the terminal device can pre-define the importance level corresponding to each port respectively, and establish the correspondence between the port number of the port and the importance level. At this time, when the terminal device determines the port number when the virtual switch receives each data packet, it can determine the importance level of the data packet based on the correspondence.
[0028] In one embodiment, the above data packets can be sent by physical network devices, for example, network devices such as mobile phones, tablet computers, laptop computers, etc., which are not limited thereto. Among them, the network device can send data packets to the virtual switch in the terminal device through a physical bridge.
[0029] Among them, the physical bridge is also a storage or forwarding network device that connects two local area networks, can connect two similar networks, and manage the flow of network data, mainly working at the data link layer. Correspondingly, the switch also works at the data link layer. Therefore, the network device can send data packets to the virtual switch in the terminal device through the physical bridge.
[0030] In one embodiment, the above data information includes but is not limited to DSCP value, destination IP, source IP, data type, and data content, which are not limited thereto.
[0031] In one embodiment, the above DSCP value is the value in the Differentiated Services CodePoint. Among them, the DSCP value is in the service class identification byte of the IP header of each data packet, and uses the 6 used bits and the 2 unused bits to distinguish priorities through the encoding value. Therefore, it can be considered that the DSCP value existing in the data packet can be used to describe the priority of the data packet.
[0032] Among them, the above destination IP is the IP address that the data packet needs to reach, and the above source IP is the sending address of the data packet. Based on this, the terminal device can determine the transmission path of the data packet according to the destination IP.
[0033] In one embodiment, the method for the virtual router to resolve the destination IP from the data packet is a prior art and will not be described in detail herein.
[0034] S102. If there are multiple data packets to be sent, control the virtual switch to adjust the first sending order of each data packet sent to the virtual router according to the port information and the DSCP value.
[0035] In one embodiment, since the port information includes the port number that can characterize the importance level of the data packet, it can be considered that when each data packet is sent to the virtual router for routing in sequence, it can be sent according to the importance level of the data packet. In this way, the transmission efficiency of important data packets can be improved, and the stability and reliability of the network can be enhanced.
[0036] However, when receiving data packets with the same importance level, the terminal device can also determine the first transmission order of each data packet based on the priority of the data packet itself.
[0037] Specifically, for any data packet, the terminal device can control the virtual switch to determine the first weight corresponding to the DSCP value according to a preset flow table, and control the virtual switch to determine the first priority value of the data packet according to the first weight and the second weight corresponding to the port information. Then, control the virtual switch to adjust the first transmission order of each data packet sent to the virtual router according to each first priority value.
[0038] Among them, the first transmission order of the data packet with a higher first priority value is earlier than that of the data packet with a lower first priority value.
[0039] In an embodiment, it has been described above that the port number corresponds to the importance level. Therefore, the importance level can be regarded as the above-mentioned second weight to quantify the priority of the received data packets.
[0040] In an embodiment, the above-mentioned flow table is a table pre-set in the virtual switch, which can define the priority of each data packet in the industrial network. Specifically, in the virtual switch, the Open Flow flow table can be used to set the priority of the data packet. For example, during the configuration of the Open Flow flow table, the DSCP value or other fields of each data packet can be used to mark the priority of the data packet. That is to say, it can be considered that the flow table records the weight corresponding to each DSCP value.
[0041] Among them, Open Flow can standardize the interface between the virtual switch and other network devices, so that the virtual switch and other network devices can support the processing of both standard data streams and custom data streams. Among them, the custom data stream processing can include defining the priority processing of each data packet.
[0042] Based on this, after the terminal device establishes the Open Flow flow table to quantify the priority of each data packet, it can determine the first weight corresponding to each DSCP value by looking up the Open Flow flow table.
[0043] In an embodiment, the terminal device can control the virtual switch to determine the sum or product of the first weight and the second weight as the first priority value of the data packet, which is not limited herein. Then, it can control the virtual switch to sort each data packet from largest to smallest according to the first priority value to determine the first transmission order.
[0044] S103. Control the virtual switch to send each data packet to the virtual router based on the first transmission order.
[0045] In this embodiment, sending according to the priority of data packets can not only improve the transmission efficiency of important data packets, but also avoid a large number of data packets being transmitted to the virtual router simultaneously, so as to instantaneously increase the processing volume of data packets that the virtual router needs to process. Furthermore, the stability and reliability of the industrial network are enhanced.
[0046] It should be noted that when the first priority values corresponding to multiple data packets are the same, the data packets with each first priority value can be sent randomly.
[0047] In another embodiment, the Open Flow flow table can also be used to detect the security of data packets. When the detected data packet is a secure data packet, the data packet is sent. Otherwise, when the detected data packet is a dangerous data packet, the data packet is deleted.
[0048] S104. Control the virtual router to adjust the target transmission path and the second sending order of each data packet according to each DSCP value and the destination IP.
[0049] In one embodiment, under normal circumstances, the virtual router usually generates the transmission path of the data packet according to the destination IP, and then sends the data packet according to the transmission path.
[0050] However, when a large number of data packets need to be transmitted to the same broadcast domain simultaneously (for example, all data packets are sent through the same transmission path), it is easy to cause congestion in the entire industrial network, resulting in the paralysis of the industrial network.
[0051] Based on this, in order to improve the stability and reliability of the industrial network, in the embodiments of the present application, the terminal device can adjust the second sending order and the target transmission path of each data packet according to the destination IP and the DSCP value corresponding to the data packet.
[0052] It should be noted that the virtual switch receives the data packets sent by the network device. Therefore, when determining the first sending order, it can be judged according to the priority of the data packet itself and the importance of the data packet characterized by the port information. However, when the virtual router sends the data packet to the network device where the destination IP is located, the port used by the virtual router when transmitting the data packet will be determined by the transmission path, and the virtual router only needs to send the data packet according to the port corresponding to the transmission path. Based on this, it can be considered that the port used by the virtual router when sending the data packet cannot characterize the importance of the data packet. Therefore, when determining the second sending order, it can be judged according to the priority of the data packet itself and the priority corresponding to the destination IP.
[0053] As an example, the terminal device may control the virtual router to determine the second priority value of a data packet based on the destination IP and the DSCP value, and adjust the second transmission order of each data packet when it is sent according to each second priority value.
[0054] Among them, the second transmission order of the data packet with a higher second priority value is earlier than that of the data packet with a lower second priority value.
[0055] Specifically, the terminal device may control the virtual router to determine the fourth weight corresponding to the destination IP based on a preset IP address range; and control the virtual router to determine the fifth weight corresponding to the DSCP value based on a preset field value table. Then, the terminal device may control the virtual router to determine the sum of the fourth weight and the fifth weight as the second priority value. Among them, each IP address range corresponds to a weight; the field value table records the weight corresponding to each DSCP value.
[0056] Among them, the above DSCP value has been explained above, and determining the fifth weight of the data packet based on the DSCP value and the field value table is similar to the way the above virtual switch determines the first weight based on the DSCP value and the Open Flow flow table, so this will not be described again.
[0057] In an embodiment, the destination IP may be the IP address that the data packet needs to reach. Among them, each network device on the network has a unique IP address, which serves as an identifier for the network device to communicate with other network devices. And, since different devices have different purposes and requirements when running on the network, the requirements (security or reliability) for data packets by different network devices may also vary. At this time, for different network devices, their corresponding IP address levels can be used for identification.
[0058] Exemplarily, the IP address levels are mainly divided into five categories: A, B, C, D, and E, and each level has a corresponding address range and characteristics. Among them, it can be considered that level A > level B > level C > level D > level E, but this is not limited.
[0059] Based on this, the terminal device may pre-store the association relationship between the IP address range and the level, and assign different weights to different levels respectively, and the weight corresponding to a higher level is greater than the weight corresponding to a lower level. Furthermore, the terminal device may control the virtual router to determine the fourth weight of the data packet based on the destination IP. That is, each IP address range corresponds to a weight.
[0060] It can be understood that when determining the sum of the fourth weight and the fifth weight as the third priority value, the terminal device can control the virtual router to sort each data packet from largest to smallest according to the third priority value, so as to adjust the second sending order when each data packet is sent.
[0061] In another embodiment, the terminal device can also optimize the processing of each data packet in turn based on the hardware acceleration technology, so as to improve the processing speed and efficiency of important data packets.
[0062] In one embodiment, when there are multiple transmission paths that can reach the target IP, the terminal device can randomly select a transmission path to transmit the data packet. However, there may be multiple data packets to be sent or being sent in the randomly selected transmission path. At this time, if the data packet also selects this transmission path subsequently, it will cause congestion of the transmission path.
[0063] Based on this, the terminal device can reselect the target transmission path according to the preset routing protocol and the target IP, or select the target transmission path according to the network load of each transmission path that can reach the target IP, which is not limited herein.
[0064] S105. Control the virtual router to send the data packets respectively according to the target transmission path and the second sending order of each data packet.
[0065] In one embodiment, the terminal device can select the priority (second sending order) and the target transmission path when sending the data packet based on multiple dimensions of the destination IP and the DSCP value, so as to ensure that high-priority data packets can be transmitted in time.
[0066] In this embodiment, the terminal device can use virtualization technology to convert the functions of the hardware switch and the hardware router into software capabilities within the terminal device, which can not only achieve the flexibility and programmability of industrial network deployment, but also reduce the number of switches and routers that need to be deployed, thereby reducing the deployment cost of the industrial network. Then, when sending data packets, the terminal device can respectively determine the port information when the virtual switch receives each data packet and the DSCP value in each data packet, so as to adjust the sending order of each data packet when it is sent to the virtual router, and make the data packets be sent to the virtual router in sequence. Then, when the virtual router has multiple data packets to be sent, the virtual router can, according to the DSCP value and the destination IP of each data packet, adjust the second sending order of the data packet transmission again, and at the same time adjust the target transmission path during the data packet transmission. Furthermore, on the basis of realizing data packet transmission, the second sending order and the target transmission path of each data packet can be flexibly adjusted according to the data information of the data packets to be sent in the virtual router and the virtual switch. Furthermore, when a large number of data packets need to be transmitted to the same broadcast domain, sending each data packet according to the adjusted target transmission path and the second sending order can avoid the situation where a large number of data packets are transmitted to the same transmission path at the same time, resulting in congestion in the entire industrial network.
[0067] As an example, in order to further improve the transmission efficiency of data packets and avoid the problem of industrial network paralysis caused by congestion in the recommended transmission path. The terminal device can determine the target transmission path of each data packet according to the steps S201-S203 as shown in Figure 2 The details are as follows: S201. Control the virtual router to determine multiple transmission paths for sending data packets and the third weights respectively corresponding to the multiple transmission paths based on a preset routing protocol and the destination IP.
[0068] In one embodiment, the above preset routing protocol can be the protocol in the hardware router and can be set in advance. Among them, the preset routing protocol can include two types: static routing protocol and dynamic routing protocol, which is not limited thereto.
[0069] It can be understood that for an industrial network, in order to ensure the communication of each network device in the industrial network and the normal transmission of data packets, a network connection topology emerges. Among them, the network connection topology describes the physical or logical connection method between each network device in the industrial network, and usually uses a router to establish the network connection topology. Therefore, in the network connection topology, the router can converge all network devices so as to be able to deliver data packets to the network device corresponding to the correct destination IP. At this time, the router can determine the transmission path that can send data packets to the destination IP from the network connection topology according to the preset routing protocol.
[0070] In a specific embodiment, the preset routing protocol may include the Border Gateway Protocol (BGP). Among them, the BGP protocol is a core decentralized autonomous routing protocol on the Internet. When using this protocol to select a transmission path, each transmission node of each transmission path contains multiple path attributes. At this time, the path attributes of BGP will affect the preference of routing. That is, the path attributes are used to select the optimal transmission path from multiple transmission paths. Among them, the path attributes include, but are not limited to, multiple types such as weight value attributes and local priority attributes, and no limitation is made thereto. Determining multiple transmission paths for sending data packets and the corresponding third weight of each transmission path based on the preset routing protocol is a prior art and no limitation is made thereto.
[0071] However, in this embodiment, the virtual router does not simply output an optimal transmission path, but outputs all transmission paths that can reach the destination IP, and the corresponding third weight of each transmission path.
[0072] It should be added that if only transmitting based on the transmission paths recommended by the preset routing protocol, then in the entire industrial network, the recommended transmission path may be recommended to transmit a large number of data packets multiple times in a short period of time. Furthermore, it makes the data packets unable to be sent to the network device corresponding to the destination IP in time, and causes congestion in the recommended transmission path, resulting in the paralysis of the industrial network. Based on this, it is also necessary to combine the following steps S202 - S203 to determine the target transmission path.
[0073] S202. Control the virtual router to respectively determine the network loads of multiple transmission paths.
[0074] In an embodiment, the network load is the pressure of the data traffic carried in the transmission path. Among them, the pressure mainly comes from the number of data packets to be sent and being sent in the virtual router and the traffic size of the data packets. When the pressure of the transmission path is too large, the transmission path will experience network congestion, resulting in a slow network speed or abnormal connection.
[0075] Among them, after determining multiple transmission paths based on the destination IP, the virtual router can respectively determine the number of data packets and the traffic size of the data packets in multiple transmission paths to respectively determine the network loads of multiple transmission paths. As another example, the terminal device can control the virtual router to determine the historical data packets that have been sent by multiple transmission paths respectively within a preset historical time period to respectively determine the network loads of multiple transmission paths.
[0076] In an embodiment, the above-mentioned preset historical time period can be set according to the actual situation, for example, 1 minute before the current moment, and no limitation is made thereto.
[0077] As another example, the virtual router may also determine the sum of the traffic sizes of each packet that needs to be sent and is being sent from this transmission path as the network load of this transmission path.
[0078] S203. Control the virtual router to determine a target transmission path from multiple transmission paths according to the third weight corresponding to the transmission path and the network load.
[0079] In one embodiment, for any transmission path, the terminal device may first control the virtual router to determine the load weight of the transmission path according to the network load. Then, control the virtual router to determine the sum of the third weight and the load weight as the third priority value corresponding to the transmission path. Finally, control the virtual router to determine the transmission path corresponding to the maximum value of the third priority value as the target transmission path.
[0080] It should be noted that the greater the network load, the greater the pressure on the corresponding transmission path. At this time, in order to reduce the pressure on the transmission path and avoid congestion on the transmission path, the terminal device may set the load weight of the transmission path with a large network load to be lower than the load weight of the transmission path with a small network load. That is, the network load and the load weight are negatively correlated.
[0081] In a specific embodiment, multiple network load ranges may be preset, and each network load range corresponds to a load weight. Based on this, the terminal device may control the virtual router to determine the load weight of the transmission path according to the network load range where the network load is located. Exemplarily, the sum of the load weight and the third weight may be determined as the third priority value corresponding to the transmission path.
[0082] It can be understood that determining the transmission path corresponding to the maximum value of the third priority value as the target transmission path not only considers the multiple optimal transmission paths provided by the virtual router based on the preset routing protocol, but also considers the network load conditions of each transmission path within the preset historical time period. In this way, determining the target transmission path by integrating factors from two dimensions can not only achieve the sending of data packets, but also realize the dynamic allocation of network resources within the entire industrial network (that is, also reasonably select the target transmission path according to the network load), and avoid the situation where the entire industrial network is congested and causes the industrial network to collapse.
[0083] It should be added that in combination with Figure 1Example descriptions of each step in the method. When sending data packets, the terminal device not only determines the importance of data packets by comprehensively considering multiple factors such as the importance of the destination IP and port of the data packet and the DSCP value in the data packet, but also considers multiple optimal transmission paths provided by each routing protocol during the transmission process and the network load of the transmission path when sending data packets to determine the target transmission path of the data packet. Furthermore, on the basis of ensuring that important and critical data packets can be preferentially transmitted, the stability and reliability of the industrial network can also be guaranteed.
[0084] In another embodiment, referring to Figure 3 , Figure 3 FIG. is a flowchart of the implementation of a data sending method provided by another embodiment of the present application. The network device 1 (or other network devices) can send data packets to the virtual switch in the terminal device through the respective ports of the physical bridge. The virtual switch can determine the first weight of each data packet according to the internally set Open Flow flow table and the DSCP value of the data packet, and determine the corresponding port priority (second weight) according to the port information when receiving each data packet. Furthermore, the virtual switch determines the first priority value of each data packet based on the first weight and the second weight to adjust the first sending order of each data packet. For example, the first sending order of the data packet with a higher first priority value is earlier than the first sending order of the data packet with a lower first priority value. At the same time, the virtual switch can also process each data packet in turn based on the first priority value. For example, detect whether each data packet is secure or compliant, and then send each data packet to the virtual router in turn when it is determined to be secure and compliant.
[0085] After receiving the data packet, the virtual router can first determine the fourth weight of the data packet based on the destination IP of the data packet, and determine the fifth weight of the data packet based on the DSCP value, and determine the sum of the fourth weight and the fifth weight as the second priority value of the data packet. Then, the virtual router can also adjust the second sending order of each data packet based on the third priority value of each data packet. Similarly, the second sending order of the data packet with a higher second priority value is earlier than the second sending order of the data packet with a lower second priority value.
[0086] Among them, when sending each data packet according to the second sending order, in order to realize the dynamic allocation of network resources within the entire industrial network and avoid the situation where the entire industrial network is congested and causes the industrial network to collapse. The virtual router can determine multiple transmission paths for sending data packets and the corresponding third weights of each transmission path based on a preset routing protocol and the destination IP. And, based on the network load of each transmission path, determine the load weight of each transmission path. Then, calculate the sum of the corresponding third weight and the load weight of each transmission path respectively to obtain the third priority value corresponding to the transmission path, so as to adjust the transmission path corresponding to the maximum value of the third priority value to the target transmission path. After that, the virtual router can select the port corresponding to the target transmission path from the physical bridge to send the data packet to the network device 2.
[0087] Please refer to Figure 4 , Figure 4 which is the structural block diagram of a data packet sending device provided by an embodiment of the present application. In this embodiment, each module included in the data packet sending device is used to execute Figure 1 and Figure 2 the respective steps in the corresponding embodiments. Specifically, please refer to Figure 1 and Figure 2 as well as Figure 1 and Figure 2 the relevant descriptions in the corresponding embodiments. For the sake of convenience of description, only the parts related to this embodiment are shown. Specifically, the data packet sending device is applied to a terminal device, and the terminal device includes a virtual switch and a virtual router. Referring to Figure 4 , the data packet sending device 400 may include: a determination module 410, a first adjustment module 420, a first sending module 430, a second adjustment module 440, and a second sending module 450, where: The determination module 410 is configured to respectively determine the port information when the virtual switch receives each data packet and the data information of each data packet; the data information includes the DSCP value and the destination IP.
[0088] The first adjustment module 420 is configured to, if there are multiple data packets to be sent, control the virtual switch to adjust the first sending order of each data packet sent to the virtual router according to the port information and the DSCP value.
[0089] The first sending module 430 is configured to control the virtual switch to send each data packet to the virtual router based on the first sending order.
[0090] The second adjustment module 440 is configured to control the virtual router to adjust the target transmission path and the second sending order when each data packet is sent according to each DSCP value and the destination IP.
[0091] The second sending module 450 is configured to control the virtual router to send data packets respectively according to the target transmission paths and the second sending order of each data packet.
[0092] In one embodiment, the first adjustment module 420 is further configured to: For any data packet, control the virtual switch to determine the first weight corresponding to the DSCP value according to a preset flow table; the flow table records the weight corresponding to each DSCP value; control the virtual switch to determine the first priority value of the data packet according to the first weight and the second weight corresponding to the port information; control the virtual switch to adjust the first sending order of each data packet sent to the virtual router according to each first priority value; the first sending order of the data packet with a higher first priority value is earlier than that of the data packet with a lower first priority value.
[0093] In one embodiment, the second adjustment module 440 is further configured to: Control the virtual router to determine the target transmission path according to the destination IP; control the virtual router to determine the second priority value of the data packet based on the destination IP and the DSCP value, and adjust the second sending order when each data packet is sent according to each second priority value; the second sending order of the data packet with a higher second priority value is earlier than that of the data packet with a lower second priority value.
[0094] In one embodiment, the second adjustment module 440 is further configured to: Control the virtual router to determine multiple transmission paths for sending data packets and the third weight corresponding to each transmission path based on a preset routing protocol and the destination IP; control the virtual router to determine the network load of each transmission path; control the virtual router to determine the target transmission path from the multiple transmission paths according to the third weight corresponding to the transmission path and the network load.
[0095] In one embodiment, the second adjustment module 440 is further configured to: Control the virtual router to determine the historical data packets sent within a preset historical time period; control the virtual router to determine the network load of each transmission path respectively according to the historical transmission paths corresponding to the historical data packets.
[0096] In one embodiment, the second adjustment module 440 is further configured to: For any transmission path, control the virtual router to determine the load weight of the transmission path according to the network load; control the virtual router to determine the sum of the third weight and the load weight as the third priority value corresponding to the transmission path; control the virtual router to determine the transmission path corresponding to the maximum value of the third priority value as the target transmission path.
[0097] In one embodiment, the second adjustment module 440 is further configured to: The virtual router is controlled to determine a fourth weight corresponding to the destination IP based on a preset IP address range; each IP address range corresponds to a weight; and, the virtual router is controlled to determine a fifth weight corresponding to the DSCP value based on a preset field value table; the field value table records the weight corresponding to each DSCP value; the virtual router determines the sum of the fourth weight and the fifth weight as the second priority value.
[0098] It should be understood that Figure 4 In the structural block diagram of the packet sending device shown, each module is used to execute Figure 1 and Figure 2 the steps in the corresponding embodiments, and for Figure 1 and Figure 2 the steps in the corresponding embodiments have been explained in detail in the above embodiments. For details, please refer to Figure 1 and Figure 2 and Figure 1 and Figure 2 the relevant descriptions in the corresponding embodiments, which will not be elaborated here.
[0099] Figure 5 This is a structural block diagram of a terminal device provided by an embodiment of the present application. As Figure 5 shown, the terminal device 500 of this embodiment includes: a processor 510, a memory 520, and a computer program 530 stored in the memory 520 and executable on the processor 510, such as a program for the packet sending method. When the processor 510 executes the computer program 530, the steps in the above-mentioned various embodiments of the packet sending method are implemented, such as Figure 1 S101 to S105 shown. Alternatively, when the processor 510 executes the computer program 530, the functions of each module in the above Figure 4 corresponding embodiments are implemented. For example, Figure 4 the functions of each module shown. For details, please refer to Figure 4 the relevant descriptions in the corresponding embodiments.
[0100] Exemplarily, the computer program 530 can be divided into one or more modules. One or more modules are stored in the memory 520 and executed by the processor 510 to implement the packet sending method provided by the embodiments of the present application. One or more modules can be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program 530 in the terminal device 500. For example, the computer program 530 can implement the packet sending method provided by the embodiments of the present application.
[0101] The terminal device 500 may include, but is not limited to, a processor 510 and a memory 520. Those skilled in the art can understand that Figure 5This is merely an example of the terminal device 500, which does not constitute a limitation on the terminal device 500. It may include more or fewer components than those shown in the figure, or combine some components, or different components. For example, the terminal device may also include input / output devices, network access devices, buses, etc.
[0102] The so-called processor 510 may be a central processing unit, or may also be other general-purpose processors, digital signal processors, application-specific integrated circuits, off-the-shelf programmable gate arrays or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0103] The memory 520 may be an internal storage unit of the terminal device 500, such as the hard disk or memory of the terminal device 500. The memory 520 may also be an external storage device of the terminal device 500, such as a plug-in hard disk, smart memory card, flash memory card, etc. equipped on the terminal device 500. Further, the memory 520 may also include both the internal storage unit and the external storage device of the terminal device 500.
[0104] The embodiments of the present application provide a computer-readable storage medium, and the computer-readable storage medium stores a computer program, and the computer program is executed by the processor to perform the data packet sending method in the above various embodiments.
[0105] The embodiments of the present application provide a computer program product, and when the computer program product runs on the terminal device, the terminal device is enabled to perform the data packet sending method in the above various embodiments.
[0106] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A data packet sending method, characterized in that, Applied to a terminal device, the terminal device includes a virtual switch and a virtual router, and the method includes: Respectively determine the port information when the virtual switch receives each data packet and the data information of each data packet; the data information includes the DSCP value and the destination IP; If there are multiple data packets to be sent, control the virtual switch to adjust the first sending order of each data packet sent to the virtual router according to the port information and the DSCP value; Control the virtual switch to send each data packet to the virtual router based on the first sending order; Control the virtual router to adjust the target transmission path and the second sending order when each data packet is sent according to each DSCP value and the destination IP; Control the virtual router to send the data packet respectively according to the target transmission path and the second sending order of each data packet.
2. The method according to claim 1, characterized in that, The controlling the virtual switch to adjust the first sending order of each data packet sent to the virtual router according to the port information and the DSCP value includes: For any one of the data packets, control the virtual switch to determine the first weight corresponding to the DSCP value according to a preset flow table; the flow table records the weight corresponding to each DSCP value; Control the virtual switch to determine the first priority value of the data packet according to the first weight and the second weight corresponding to the port information; Control the virtual switch to adjust the first sending order of each data packet sent to the virtual router according to each first priority value; the first sending order of the data packet with a higher first priority value is earlier than the first sending order of the data packet with a lower first priority value.
3. The method according to claim 1 or 2, characterized in that, The controlling the virtual router to adjust the target transmission path and the second sending order when each data packet is sent according to each DSCP value and the destination IP includes: Control the virtual router to determine the target transmission path according to the destination IP; Control the virtual router to determine the second priority value of the data packet based on the destination IP and the DSCP value, and adjust the second sending order when each data packet is sent according to each second priority value; the second sending order of the data packet with a higher second priority value is earlier than the second sending order of the data packet with a lower second priority value.
4. The method according to claim 3, characterized in that The controlling the virtual router to determine the target transmission path according to the destination IP includes: Control the virtual router to determine multiple transmission paths for sending the data packet and the third weight corresponding to each of the multiple transmission paths based on a preset routing protocol and the destination IP; Control the virtual router to respectively determine the network load of the multiple transmission paths; Control the virtual router to determine the target transmission path from the multiple transmission paths according to the third weight corresponding to the transmission path and the network load.
5. The method according to claim 4, wherein The controlling the virtual router to respectively determine the network load of the multiple transmission paths includes: Control the virtual router to determine the historical data packets that have been sent by each of the multiple transmission paths within a preset historical time period; Control the virtual router to respectively determine the network loads of the multiple transmission paths according to the historical transmission paths corresponding to the historical data packets.
6. The method according to claim 4, characterized in that, The step of controlling the virtual router to determine a target transmission path from the multiple transmission paths according to the third weight corresponding to the transmission path and the network load includes: For any one of the transmission paths, control the virtual router to determine the load weight of the transmission path according to the network load; Control the virtual router to determine the sum of the third weight and the load weight as the third priority value corresponding to the transmission path; Control the virtual router to determine the transmission path corresponding to the maximum value of the third priority value as the target transmission path.
7. The method according to claim 3, wherein The step of controlling the virtual router to determine the second priority value of the data packet based on the destination IP and the DSCP value includes: Control the virtual router to determine the fourth weight corresponding to the destination IP based on a preset IP address range; each IP address range corresponds to a weight; and, Control the virtual router to determine the fifth weight corresponding to the DSCP value based on a preset field value table; the field value table records the weight corresponding to each DSCP value; Control the virtual router to determine the sum of the fourth weight and the fifth weight as the second priority value.
8. A data packet sending device, characterized in that, Applied to a terminal device, the terminal device includes a virtual switch and a virtual router, and the apparatus includes: A determination module, configured to respectively determine the port information when the virtual switch receives each data packet and the data information of each data packet; the data information includes the DSCP value and the destination IP; A first adjustment module, configured to, if there are multiple data packets to be sent, control the virtual switch to adjust the first sending order of each data packet sent to the virtual router according to the port information and the DSCP value; A first sending module, configured to control the virtual switch to send each data packet to the virtual router based on the first sending order; A second adjustment module, configured to control the virtual router to adjust the target transmission path and the second sending order when each data packet is sent according to each DSCP value and the destination IP; A second sending module, configured to control the virtual router to send the data packet respectively according to the target transmission path and the second sending order of each data packet.
9. A terminal device, comprising a virtual switch, a virtual router, a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it controls the virtual switch and the virtual router to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the method according to any one of claims 1 to 7.