Traffic mirroring method and device, equipment and medium

By completing filter condition matching and rate limiting on the mirror source node, and directly delivering it to the mirror destination node through the mirror session VXLAN tunnel, the problems of slow transmission speed and resource waste in the existing mirror traffic method are solved, and cross-VPC mirror traffic is realized. Reception and performance improvements.

CN118784601APending Publication Date: 2024-10-15CHINA UNITED NETWORK COMM GRP CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411061161.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-02
Publication Date
2024-10-15

AI Technical Summary

Technical Problem

Existing methods of mirroring traffic have problems such as slow transmission speed and waste of resources.

Method used

By completing filter condition matching, rate limiting and traffic replication on the mirror source node, and directly delivering the traffic to the mirror destination node through the mirror session VXLAN tunnel, traffic mirror gateway clusters are avoided and distributed technology is used to directly import traffic from the mirror source into the mirror. At the destination end, multiple transfers of traffic are reduced, the transmission speed is improved and resource waste is avoided.

Benefits of technology

It realizes cross-VPC mirror traffic reception, improves mirror replication performance, reduces resource investment and failure points, and improves transmission speed and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118784601A_ABST
    Figure CN118784601A_ABST
Patent Text Reader

Abstract

The invention provides a traffic mirroring method and device, equipment and a medium. Comprising the following steps: determining equipment information of source transmission equipment and target transmission equipment, a data packet transmitted by the source transmission equipment and a target mirror image field; determining a to-be-mirrored packet according to a preset tag table and the data packet, and determining an initial header of the to-be-mirrored packet; according to the device information, determining an undefinable parameter in the header of the to-be-mirrored packet, and according to the target mirroring field, determining a definable parameter in the header of the to-be-mirrored packet; determining a target header according to the undefinable parameters and the definable parameters, and determining a target to-be-mirrored packet according to the to-be-mirrored packet and the target header; determining a target network bridge according to the initial header, and removing the initial header in the target to-be-mirrored packet according to the target network bridge to obtain a target data packet; and sending the target data packet to the target transmission equipment according to the target network bridge. Thus, multiple times of flow transmission caused by the mirror image gateway cluster is avoided, the transmission speed is improved, and waste of resources is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing, and in particular to a traffic mirroring method, device, equipment and medium. Background Art

[0002] In a cloud environment, multiple mirror sources (mainly virtual network cards) forward their incoming and outgoing traffic to the mirror destination (usually also a virtual network card or a load balancer) based on the filtering conditions of the traffic mirror, thereby achieving security data analysis, situational awareness, and monitoring requirements for multiple key businesses under certain strategies.

[0003] Current traffic mirroring methods rely on a traffic mirroring gateway cluster to implement certain filtering and rate limiting strategies, or to complete the construction header encapsulation work of the user-visible part in the cluster.

[0004] However, existing mirroring traffic methods suffer from slow transmission speed and resource waste. Summary of the invention

[0005] The present application provides a traffic mirroring method, apparatus, device and medium to solve the problems of slow transmission speed and waste of resources in the existing traffic mirroring method.

[0006] In a first aspect, the present application provides a traffic mirroring method, comprising:

[0007] Determine device information of a source transmission device and a target transmission device, a data packet transmitted by the source transmission device, and a target mirror field;

[0008] According to the preset label table and data packet, determine the packet to be mirrored and determine the initial header of the packet to be mirrored;

[0009] Determine the undefinable parameters in the header of the to-be-mirrored packet according to the device information, and determine the definable parameters in the header of the to-be-mirrored packet according to the target mirroring field;

[0010] Determine the target header according to the undefinable parameters and the definable parameters, and determine the target packet to be mirrored according to the packet to be mirrored and the target header;

[0011] According to the initial header, the target bridge is determined, and according to the target bridge, the initial header in the target packet to be mirrored is removed to obtain the target data packet;

[0012] According to the target bridge, the target data packet is sent to the target transmission device.

[0013] In an embodiment of the present application, determining device information of a source transmission device and a target transmission device, a data packet transmitted by the source transmission device, and a target mirroring field includes:

[0014] Determine the virtual identifier of the target transmission device according to the device information of the target transmission device;

[0015] The virtual identifier of the data packet is determined according to the virtual identifier of the target transmission device.

[0016] In an embodiment of the present application, determining device information of a source transmission device and a target transmission device, a data packet transmitted by the source transmission device, and a target mirroring field includes:

[0017] Determine all data packets transmitted by the source transmission device and determine the target transmission port of the source transmission device;

[0018] Determine a preset data flow table, and compare all data packets according to the data flow table, the target data packets whose corresponding transmission ports are the target transmission ports;

[0019] The target data packet is determined to be a data packet transmitted by the source transmission device.

[0020] In an embodiment of the present application, the preset label table includes a mirror label table and a data label table. According to the preset label table and the data packet, the to-be-mirrored packet is determined, and the initial header of the to-be-mirrored packet is determined, including:

[0021] Determine a preset image label table, and determine the target data type according to the image label table;

[0022] Compare the data type of the data packet with the target data type to obtain a comparison result;

[0023] According to the comparison result, determine the data packet to be mirrored that has the same data type as the target data in the data packet;

[0024] Determine a preset data label table, and determine the network speed data and bandwidth data corresponding to the data packet to be mirrored according to the data label table;

[0025] The packets to be mirrored are determined according to the network speed data and bandwidth data of the packets to be mirrored.

[0026] In an embodiment of the present application, determining the undefinable parameters in the header of the to-be-mirrored packet according to the device information, and determining the definable parameters in the header of the to-be-mirrored packet according to the target mirroring field, includes:

[0027] Determine Ethernet information, address information, and protocol information corresponding to the source transmission device and the target transmission device according to the device information, and determine undefinable parameters according to the Ethernet information, address information, and protocol information;

[0028] Determine the preset program interface, and determine the corresponding mirror data according to the program interface;

[0029] According to the image data, the target image field is determined, and according to the target image field, the definable parameters are determined.

[0030] In an embodiment of the present application, determining a target header according to undefinable parameters and definable parameters, and determining a target packet to be mirrored according to the packet to be mirrored and the target header, includes:

[0031] Determine the initial header and original data in the package to be mirrored;

[0032] Determine the initial package to be mirrored based on the initial header, target header, and original data;

[0033] Determine the preset data capacity and the mirror package capacity of the initial mirror package, and compare the data capacity and the mirror package capacity to obtain a comparison result;

[0034] If the comparison result shows that the mirroring packet capacity is greater than the data capacity, data is intercepted from the initial mirroring packet according to the data capacity to obtain the target mirroring packet;

[0035] If the comparison result is that the mirroring package capacity is not greater than the data capacity, the initial package to be mirrored is determined as the target package to be mirrored.

[0036] In an embodiment of the present application, a target bridge is determined according to an initial header, and the initial header in the target packet to be mirrored is removed according to the target bridge to obtain a target data packet, including:

[0037] Determine the virtual identifier in the initial header;

[0038] Determine the target bridge based on the virtual identifier.

[0039] In a second aspect, the present application provides a traffic mirroring device, the device comprising:

[0040] An information determination module, used to determine device information of a source transmission device and a target transmission device, a data packet transmitted by the source transmission device, and a target mirror field;

[0041] An initial header determination module is used to determine the packet to be mirrored and the initial header of the packet to be mirrored according to a preset label table and data packet;

[0042] A parameter determination module, used to determine the undefinable parameters in the header of the to-be-mirrored packet according to the device information, and to determine the definable parameters in the header of the to-be-mirrored packet according to the target mirroring field;

[0043] A target header determination module, used to determine a target header according to undefinable parameters and definable parameters, and to determine a target packet to be mirrored according to the packet to be mirrored and the target header;

[0044] The data packet determination module is used to determine the target bridge according to the initial header, and remove the initial header in the target packet to be mirrored according to the target bridge to obtain the target data packet;

[0045] The sending module is used to send the target data packet to the target transmission device according to the target bridge.

[0046] In a third aspect, the present application provides a device, comprising: a processor, and a memory communicatively connected to the processor;

[0047] Memory stores computer-executable instructions;

[0048] The processor executes the computer-executable instructions stored in the memory to implement the method of the present application.

[0049] In a fourth aspect, the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the method of the present application.

[0050] The traffic mirroring method, apparatus, device and medium provided by the present application determine the device information of the source transmission device and the target transmission device, the data packet transmitted by the source transmission device, and the target mirroring field; determine the packet to be mirrored according to the preset label table and the data packet, and determine the initial header of the packet to be mirrored; determine the undefinable parameters in the header of the packet to be mirrored according to the device information, and determine the definable parameters in the header of the packet to be mirrored according to the target mirroring field; determine the target header according to the undefinable parameters and the definable parameters, and determine the target packet to be mirrored according to the packet to be mirrored and the target header; determine the target bridge according to the initial header, and remove the initial header in the target packet to be mirrored according to the target bridge to obtain the target data packet; send the target data packet to the target transmission device according to the target bridge.

[0051] In this way, through the decentralized mirror gateway cluster, distributed technology is adopted to directly import traffic from the mirror source to the mirror destination, and the addition of the data packet construction header is completed, which reduces the multiple transmission of traffic during the mirror traffic process, thereby improving the transmission speed and avoiding resource waste. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0053] Figure 1 A flow chart of a traffic mirroring method provided in an embodiment of the present application;

[0054] Figure 2 A schematic diagram of a packet sending process of a traffic mirroring method provided in an embodiment of the present application;

[0055] Figure 3 A schematic diagram of the structure of an initial data packet header of a traffic mirroring method provided in an embodiment of the present application;

[0056] Figure 4 A schematic diagram of initial data packet header stripping of a traffic mirroring method provided in an embodiment of the present application;

[0057] Figure 5 A schematic diagram of a traffic mirroring method provided in an embodiment of the present application;

[0058] Figure 6 A schematic diagram of the target data packet header structure of a traffic mirroring method provided in an embodiment of the present application;

[0059] Figure 7 A flow chart of a traffic mirroring method provided in an embodiment of the present application;

[0060] Figure 8 A schematic diagram of the structure of a traffic mirroring device provided in an embodiment of the present application;

[0061] Fig. 9 The present invention is a structural block diagram of a device for executing a traffic mirroring method according to an embodiment of the present invention.

[0062] The above-mentioned drawings have shown clear embodiments of the present application, which will be described in more detail below; these drawings and textual descriptions are not intended to limit the scope of the concept of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0063] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0064] Traffic mirroring means that by configuring the mirroring function, you can "capture" the messages received or sent by a specified port, so as to understand the data status of the specified port and then locate network problems, avoiding direct monitoring and analysis of the port, which may affect the forwarding efficiency of the port.

[0065] The source transmission device and the target transmission device are devices that can transmit data, such as virtual switches. The source transmission device can be a mirror source virtual machine, that is, a device that receives or sends data, and the target transmission device can be a mirror target virtual machine, that is, a device that can analyze and process mirror data.

[0066] The target bridge is a bridge that processes and transmits data packets. The bridge is a connection device that filters and forwards data packets based on physical addresses. It works at the data link layer of the OSI model. The target bridge can include an integrated bridge and a mirror bridge. The integrated bridge can perform conditional filtering and transmission speed limit settings on data packets, and the mirror bridge can set the header structure of the data packet.

[0067] Network virtualization technology (Visual eXtensible Local Area Network, VXLAN) is a tunnel encapsulation technology used to extend the functions of a local area network. It uses VNI (VXLAN Network Identifier) ​​to distinguish different tenants and VXLAN segments, ensuring that only virtual machines with the same VNI can communicate with each other through VXLAN Layer 2 forwarding in the same VXLAN segment.

[0068] The data packet header is the header structure in the data packet structure. The data packet can be composed of a header structure and original data. The header structure can include: an ETH Ethernet header, the main data of which is the source MAC address, the destination MAC address, and the Ethernet protocol type; an IP header, the main parameters of which are the source IP address, the destination IP address, and the IP protocol type; a UDP header, the main parameters of which are the source UDP port number and the destination UDP port number; and a VXLAN header, the main parameter of which is the VNI number.

[0069] In the prior art, mirrored traffic needs to be transmitted multiple times. The port-level traffic mirroring of the switch or virtual machine switch (OpenVswitch, OVS) does not have the necessary capabilities in the traffic mirroring function model on the cloud: it does not have the ability to add filtering conditions, does not have traffic speed limit, and does not have the ability to add additional "construction headers"; at the same time, the prior art relies on the traffic mirroring gateway cluster, which is usually understood as a centralized transit. The transit forwarding performance is related to the number of cluster servers and the number of cluster network cards. Small-scale clusters carry small traffic, and large-scale clusters carry large traffic, which leads to increased resource investment and increased failure points.

[0070] In order to solve the above problems, the embodiment of the present application proposes a traffic mirroring method, which completes the matching of filter conditions, speed limiting, traffic replication, and addition of the user-visible part (mainly the VXLAN header) at the mirror source node, and directly delivers it to the mirror destination node through the mirror session VXLAN tunnel, without the need for a traffic mirroring gateway cluster, to achieve a distributed mirror traffic model. The traffic mirroring method system proposed in the present application can realize the reception of mirrored traffic across VPCs, that is, the mirror source and mirror destination can exist in any VPC in the cloud. The new OpenVswitch action added in the present application can support hardware offloading and improve the performance of mirror replication at the source node.

[0071] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0072] Figure 1 A flow chart of a traffic mirroring method provided in an embodiment of the present application. Figure 1 The traffic mirroring method may include the following steps:

[0073] S110: Determine device information of a source transmission device and a target transmission device, a data packet transmitted by the source transmission device, and a target mirroring field.

[0074] Among them, the source transmission device can be a mirror source virtual machine, the target transmission device can be a mirror target virtual machine, and the device information can be the network communication information corresponding to the device, including Ethernet information, address information, User Datagram Protocol (UDP) information and other information.

[0075] The data packet is the data transmitted by the port of the mirror source virtual machine, including the data of receiving and sending packets.

[0076] The target mirror field is used to determine the VXLAN VNI number and can be set by the user, such as the mirror_vni field in the traffic_mirror_session data created by the user calling the API.

[0077] Based on this, by determining the device information, data packet, and target mirror field, the parameters corresponding to the header structure of the data packet can be determined according to the device information and the target mirror field, and the data packet can be transmitted to the mirror target virtual machine to complete the process of traffic mirroring.

[0078] S120: Determine the packet to be mirrored according to the preset label table and the data packet, and determine the initial header of the packet to be mirrored.

[0079] The preset label table is used to process data packets, such as filtering and speed limit setting, and can be a table; a table is an object used to store data in a database and is a collection of structured data.

[0080] After the mirroring packet is processed according to the label table, the obtained mirroring data needs to be sent to the mirroring target virtual machine.

[0081] The initial header is a header structure corresponding to the packet to be mirrored, and the packet to be mirrored may include the initial header and original data.

[0082] Based on this, the data packet is processed through the table to obtain the packet to be mirrored that meets the corresponding conditions of the table, and the header data structure of the packet to be mirrored is determined, so that the corresponding target bridge can be determined according to the parameters of the header data structure, and the packet to be mirrored is sent to the mirror target virtual machine according to the target bridge to realize traffic mirroring.

[0083] S130: Determine the undefinable parameters in the header of the to-be-mirrored packet according to the device information, and determine the definable parameters in the header of the to-be-mirrored packet according to the target mirroring field.

[0084] Among them, according to the source of the parameters filled in the data for constructing the header, the parameters of the header can be divided into undefinable parameters and definable parameters. Undefinable parameters are parameters that cannot be filled according to user input, such as ETH, IP, UDP and other parameters; definable parameters are parameters that can be directly entered by the user, such as the VNI parameter of the VXLAN header.

[0085] Based on this, the undefinable parameters and definable parameters in the header parameters are determined through the device information and the target mirroring field, so that the target header of the packet to be mirrored can be determined based on the undefinable parameters and definable parameters, thereby realizing the construction of a user-visible data packet header.

[0086] S140: Determine a target header according to the undefinable parameters and the definable parameters, and determine a target packet to be mirrored according to the packet to be mirrored and the target header.

[0087] The target header is the header structure of the to-be-mirrored packet determined according to the device information and the target mirroring field.

[0088] Based on this, the target header is determined, and the target packet to be mirrored is further determined according to the target header, so as to subsequently determine the corresponding target bridge.

[0089] You can refer to Figure 2, Figure 2 A schematic diagram of a packet sending process of a traffic mirroring method provided in an embodiment of the present application; Figure 2 As shown, in the mirror bridge, the direction of the data packet is determined, and the local VLAN ID of the matching virtual machine and the source MAC of the matching data packet are the MAC of the mirror source virtual machine (dl_vlan=5, dl_src=ff:11:22:33:44:55). If the data packet matches, the subsequent actions are executed to remove the local VLAN ID (strip_vlan action), add a construction header (add_vxlan action), intercept a specific packet length, and then send it to the VXLAN tunnel to the mirror destination node (accomplished by the output action and the max_len parameter).

[0090] You can refer to Figure 3 , Figure 3 A schematic diagram of the initial data packet header structure of a traffic mirroring method provided in an embodiment of the present application; Figure 3 As shown, the structure of the target to-be-mirrored packet received by the mirroring bridge is an initial header, a target header, and original data, wherein the target header and original data are user-visible parts.

[0091] S150, determining a target bridge according to the initial header, and removing the initial header in the target packet to be mirrored according to the target bridge to obtain a target data packet.

[0092] The target bridge is a bridge that processes and transmits data packets, and may include an integrated bridge and a mirror bridge. The integrated bridge may perform conditional filtering and transmission speed limit settings on data packets, and the mirror bridge may set the header structure of the data packet.

[0093] Based on this, the corresponding target bridge is determined through the parameters of the header structure in the target packet to be mirrored, and according to the target bridge, the mirror session VXLAN tunnel header (invisible to the user) is partially stripped to obtain the target data packet that needs to be sent to the mirror target virtual machine, including the target header and original data.

[0094] You can refer to Figure 4 , Figure 4 A schematic diagram of initial data packet header stripping of a traffic mirroring method provided in an embodiment of the present application; Figure 4 As shown, when the mirrored session VXLAN VNI is matched by the mirrored bridge and sent to the integrated bridge, the mirrored session VXLAN tunnel header (invisible to the user) is partially stripped.

[0095] S160: Send the target data packet to the target transmission device according to the target bridge.

[0096] Based on this, the mirror transmission of the data packet is completed through the target bridge, and the construction of the user-visible header is realized.

[0097] You can refer to Figure 5 , Figure 5 A schematic diagram of a traffic mirroring method provided in an embodiment of the present application; Figure 5 As shown in the figure, for traffic from multiple mirror sources to the same mirror destination, after the data packets copied by the mirror sources arrive at the mirror bridge of the mirror destination, they will match the same mirror session VXLAN VNI and perform the same action.

[0098] You can refer to Figure 6 , Figure 6 A schematic diagram of the target data packet header structure of a traffic mirroring method provided in an embodiment of the present application; Figure 6 As shown in the figure, the mirror bridge completes the stripping of the mirror session VXLAN header, and the data packet finally processed by the integrated bridge is only the visible part. The user-visible part is processed according to the standard pipeline of the mirror destination virtual machine, and the user-visible part is processed as a normal, integrated data packet.

[0099] Based on the above embodiment, the present application further provides an implementation method of determining a virtual identifier of a data packet in S110, including:

[0100] Determine the virtual identifier of the target transmission device according to the device information of the target transmission device;

[0101] The virtual identifier of the data packet is determined according to the virtual identifier of the target transmission device.

[0102] The virtual identifier can be understood as a local VLAN ID according to the VPC where the mirror destination virtual machine is located. For example, on the mirror bridge, it is only necessary to match different mirror session VXLAN tunnel VNIs, mark the local VLAN ID according to the VPC where the mirror destination virtual machine is located, and send it to the integrated bridge. Therefore, there is the following flow table on br-mirror (mirror bridge):

[0103] tun_id=0x1234 actions=mod_vlan_vid:2,output:"mirror-br-int"

[0104] In the above example, the VNI of the flow table mirroring session VXLAN tunnel is 0x1234. After the data packet is marked with the local VLAN ID 2, it is sent to the integrated bridge for processing through the patch port (mirror-br-int).

[0105] Based on this, by matching the mirror session VXLAN VNI on the mirror bridge and sending it to the integrated bridge, the mirror session VXLAN tunnel header (invisible to the user) can be stripped off later, so that the mirror destination node can be directly delivered through the mirror session VXLAN tunnel without the need for a traffic mirroring gateway cluster, thus realizing a distributed mirror traffic model.

[0106] Based on the feasible implementation of S110 above, the present application further provides a process of determining a target data packet according to a flow table:

[0107] Determine all data packets transmitted by the source transmission device and determine the target transmission port of the source transmission device;

[0108] Determine a preset data flow table, and compare all data packets according to the data flow table, the target data packets whose corresponding transmission ports are the target transmission ports;

[0109] The target data packet is determined to be a data packet transmitted by the source transmission device.

[0110] Among them, the target transmission port is the port of the mirror source device to transmit the data packet, and the data flow table determines the source OFPORT of the data packet (the port number of the OVS virtual switch). For example, in the following flow table, in_port=10 indicates that the data packet is sent from port 10 on the virtual machine switch, and the execution action is to submit it to table=71 for further processing:

[0111] in_port=10actions=resubmit(,71)

[0112] You can also use the name of the port of the OVS virtual switch to send it down. For example, in the following flow table, in_port = "vhubf3f35d2-05" means that the data packet is judged to be sent from the vhubf3f35d2-05 port on the virtual machine switch, and the execution action is to submit it to table = 71 for further processing:

[0113] in_port="vhubf3f35d2-05" actions=resubmit(,71).

[0114] Furthermore, the flow table can also be used to determine the direction of the virtual machine's "packet receiving" and use the flow table to determine the local VLAN ID and destination MAC address of the data packet. For example, the following flow table matches and determines that the VLAN ID is 5 and the destination MAC address of the data packet is ff:11:22:33:44:55. The execution action is to submit to table=71 for further processing:

[0115] dl_vlan=5,dl_dst=ff:11:22:33:44:55actions=resubmit(,71)

[0116] Based on this, by using the flow table, it is possible to determine the transmission port of the mirror source virtual machine corresponding to the data packet, and further determine the sending and receiving direction of the data packet.

[0117] Based on the feasible implementation of S120 above, the present application further provides a process of filtering and setting a speed limit for data packets according to the table:

[0118] Determine a preset image label table, and determine the target data type according to the image label table;

[0119] Compare the data type of the data packet with the target data type to obtain a comparison result;

[0120] According to the comparison result, determine the data packet to be mirrored that has the same data type as the target data in the data packet;

[0121] Determine a preset data label table, and determine the network speed data and bandwidth data corresponding to the data packet to be mirrored according to the data label table;

[0122] The packets to be mirrored are determined according to the network speed data and bandwidth data of the packets to be mirrored.

[0123] The target data type is the data type corresponding to the data packet that needs to be mirrored. The data packet is sent to the filter condition table synchronously to match the filter condition. The match in the filter condition table is a standard OVS capability, which usually matches the type, protocol, port number, etc. of the data packet. If the data packet matches the above rules and the action of the rule is drop, it means that in the filter condition, such data packets will not be mirrored; if the type of the data packet meets the record in the filter condition, it means that such data packets will be mirrored.

[0124] Further, continue to enter the bandwidth (bps) speed limit policy table = 221, the rule sets a meter speed limit action meter: N, this meter speed limit policy uses the meter ID of the mirror source port, so that the mirror traffic can share the user network card (bandwidth bps) rate. The default action of all rules in table = 221 is to send the packet rate (pps) speed limit policy goto_table: 222. For example:

[0125] table=221dl_vlan=5,in_port=10actions=meter:166701,goto_table:222

[0126] In table=222, the packet rate (pps) is limited. The rule sets a meter rate limit action meter:N. This meter rate limit strategy uses the meter ID of the mirror source port, so that the mirror traffic can share the user network card (packet rate pps) rate. The default action of all rules in table=2221 is sent to table=223. For example:

[0127] table=222dl_vlan=5,in_port=10actions=meter:2211,goto_table:223

[0128] In table=223, the data packet is sent to a patch device (int-br-mirror) between OVS bridges, and the data packet will enter the mirror bridge:

[0129] table=223dl_vlan=5,in_port=10actions=output:"int-br-mirror".

[0130] Based on this, by synchronously sending the data packets to the filter condition table for matching the filter conditions, and setting the corresponding bandwidth and network speed limits for the data packets that meet the filter conditions according to the bandwidth and network speed limit table, the ability to share the user network card (bandwidth bps) rate of mirrored traffic is achieved.

[0131] Based on the feasible implementation of S130 above, the present application further provides a process for determining undefinable parameters and definable parameters:

[0132] Determine Ethernet information, address information, and protocol information corresponding to the source transmission device and the target transmission device according to the device information, and determine undefinable parameters according to the Ethernet information, address information, and protocol information;

[0133] Determine the preset program interface, and determine the corresponding mirror data according to the program interface;

[0134] According to the image data, the target image field is determined, and according to the target image field, the definable parameters are determined.

[0135] The source of the parameters for constructing the data filling of the header is the various inputs of the add_vxlan method. The data of the add_vxlan method comes from the source virtual machine or the destination virtual machine. Therefore, the Ethernet information, address information, and protocol information may include:

[0136] ETH: Ethernet header, the two MAC addresses of eth (src = source MAC address, dst = destination MAC address) are filled with the MAC address of the source virtual machine and the MAC address of the destination virtual machine respectively; Ethernet protocol type is determined according to the type of the first IP address used by the virtual machine network card. If it is an IPv4 address, the Ethernet type is 0x0800, and if it is an IPv6 address, the Ethernet type is 0x86dd.

[0137] IP: IP header, two addresses of ipv4 (src = source IPv4 address, dst = destination IPv4 address) or ipv6 (src = source IPv6 address, dst = destination IPv6 address), which are filled with the IP address of the source virtual machine and the first IP (IPv4 or IPv6) address of the destination virtual machine respectively; IP protocol type is automatically filled with UDP.

[0138] UDP: The source UDP port number is randomly filled. The destination UDP port number is fixed to 4789 of the VXLAN protocol.

[0139] Correspondingly, the definable parameter can be the VNI number filled in according to the user input, that is, the mirror_vni field in the traffic_mirror_session data created by the user calling the API; the original data packet is appended as the data part (payload) of the header, and the appending process requires recalculation of the constructed header: IP packet length, IP checksum, UDP packet length and UDP checksum.

[0140] Furthermore, hardware offload of the header construction action can be realized: adding the header construction action requires a certain amount of server resources. Therefore, under the premise of hardware network card support, this action can be completed with the help of hardware capabilities. <vxlan>), this application uses this capability to improve the construction header encapsulation performance of the mirror source end in the smart network card and DPU environment.

[0141] Based on the feasible implementation of S140 above, the present application further provides a process of intercepting a specific step length of a data packet:

[0142] Determine the initial header and original data in the package to be mirrored;

[0143] Determine the initial package to be mirrored based on the initial header, target header, and original data;

[0144] Determine the preset data capacity and the mirror package capacity of the initial mirror package, and compare the data capacity and the mirror package capacity to obtain a comparison result;

[0145] If the comparison result shows that the mirroring packet capacity is greater than the data capacity, data is intercepted from the initial mirroring packet according to the data capacity to obtain the target mirroring packet;

[0146] If the comparison result is that the mirroring package capacity is not greater than the data capacity, the initial package to be mirrored is determined as the target package to be mirrored.

[0147] The preset data capacity is the pre-set capacity of the mirror data packet that needs to be transmitted.

[0148] Based on this, by comparing the data capacity of the mirrored packet with the preset data capacity, a specific packet length is intercepted, and after intercepting the specific packet length, it is sent to the destination node through the mirrored session VXLAN tunnel.

[0149] Based on the feasible implementation of S150 above, the present application further provides a process for determining a corresponding mirror bridge:

[0150] Determine the virtual identifier in the initial header;

[0151] Determine the target bridge based on the virtual identifier.

[0152] Among them, on the mirror bridge, it is only necessary to match different mirror session VXLAN tunnel VNIs, mark the local VLAN ID according to the VPC where the mirror destination virtual machine is located, and send it to the integrated bridge. Therefore, there is the following flow table on br-mirror (mirror bridge):

[0153] tun_id=0x1234 actions=mod_vlan_vid:2,output:"mirror-br-int"

[0154] The VNI of the mirrored session VXLAN tunnel in the flow table is 0x1234. After marking the data packet with the local VLAN ID of 2, it is sent to the integrated bridge for processing through the patch port (mirror-br-int). The matching tun_id = 0x1234 is the VXLAN-related field in the initial header of the data packet structure. When the mirrored bridge matches the mirrored session VXLAN VNI and sends it to the integrated bridge, the mirrored session VXLAN tunnel header (not visible to the user) is stripped.

[0155] You can refer to Figure 2 , Figure 2 A schematic diagram of a packet sending process of a traffic mirroring method provided in an embodiment of the present application; Figure 2 As shown, in the mirror bridge, the direction of the data packet is determined, and the local VLAN ID of the matching virtual machine and the source MAC of the matching data packet are the MAC of the mirror source virtual machine (dl_vlan=5, dl_src=ff:11:22:33:44:55). If the data packet matches, the subsequent actions are executed to remove the local VLAN ID (strip_vlan action), add a construction header (add_vxlan action), intercept a specific packet length, and then send it to the VXLAN tunnel to the mirror destination node (accomplished by the output action and the max_len parameter).

[0156] You can refer to Figure 7 , Figure 7 A flow chart of a traffic mirroring method provided in an embodiment of the present application; Figure 7 As shown in the figure, as long as the mirror destination exists in the cloud, it exists in a computing node. After the mirror session VXLAN header is encapsulated, the mirror traffic copied by any computing node can be directly delivered to the mirror destination node. The mirror destination node does not care about the VPC location and VPC encapsulation of the mirror source virtual machine, nor does it care about any details of the original data packet. It only needs to match the VNI of the mirror session VXLAN header to identify the mirror traffic. Based on this, cross-VPC mirror traffic reception can be achieved, that is, the mirror source and mirror destination can exist in any VPC in the cloud.

[0157] In this embodiment, in order to solve the problems of slow transmission speed and waste of resources in the existing mirror traffic method, the filter condition matching, speed limit, traffic replication, and addition of the user-visible part (mainly the VXLAN header) are completed at the mirror source node, and the mirror destination node is directly delivered through the mirror session VXLAN tunnel without the need for a traffic mirroring gateway cluster, thereby realizing a distributed mirror traffic model; the proposed traffic mirroring method system can realize the reception of mirror traffic across VPCs, that is, the mirror source and the mirror destination can exist in any VPC in the cloud; the added new OpenVswitch action can support hardware offloading and improve the performance of mirror replication at the source node.

[0158] In this way, a series of flow table pipeline designs are completed at the mirror source node, including filter condition matching, speed limiting, traffic replication, and addition of the structure header (user-visible VXLAN header); and the structure header (user-visible VXLAN header) and the add_vxlan method action design added to OVS are added at the source node. At the same time, the virtual bridge of the mirror source and destination nodes, the mirror traffic tunnel encapsulation method design of the mirror source and destination nodes, and the mirror traffic matching and flow table pipeline design of the mirror destination node are realized.

[0159] Figure 8 A schematic diagram of the structure of a traffic mirroring device provided in an embodiment of the present application is shown in FIG. Figure 8 As shown, the traffic mirroring device 800 includes: an information determination module 810, an initial header determination module 820, a parameter determination module 830, a target header determination module 840, a data packet determination module 850, and a sending module 860.

[0160] An information determination module 810 is used to determine device information of a source transmission device and a target transmission device, a data packet transmitted by the source transmission device, and a target mirror field;

[0161] The initial header determination module 820 is used to determine the packet to be mirrored and the initial header of the packet to be mirrored according to the preset label table and the data packet;

[0162] A parameter determination module 830, configured to determine the undefinable parameters in the header of the packet to be mirrored according to the device information, and to determine the definable parameters in the header of the packet to be mirrored according to the target mirroring field;

[0163] A target header determination module 840 is used to determine a target header according to the undefinable parameters and the definable parameters, and to determine a target packet to be mirrored according to the packet to be mirrored and the target header;

[0164] The data packet determination module 850 is used to determine the target bridge according to the initial header, and remove the initial header in the target packet to be mirrored according to the target bridge to obtain the target data packet;

[0165] The sending module 860 is used to send the target data packet to the target transmission device according to the target bridge.

[0166] In the embodiment of the present application, the information determination module 810 may also be specifically used for:

[0167] Determine the virtual identifier of the target transmission device according to the device information of the target transmission device;

[0168] The virtual identifier of the data packet is determined according to the virtual identifier of the target transmission device.

[0169] In the embodiment of the present application, the information determination module 810 may also be specifically used for:

[0170] Determine all data packets transmitted by the source transmission device and determine the target transmission port of the source transmission device;

[0171] Determine a preset data flow table, and compare all data packets according to the data flow table, the target data packets whose corresponding transmission ports are the target transmission ports;

[0172] The target data packet is determined to be a data packet transmitted by the source transmission device.

[0173] In the embodiment of the present application, the initial header determination module 820 may also be specifically used for:

[0174] Determine a preset image label table, and determine the target data type according to the image label table;

[0175] Compare the data type of the data packet with the target data type to obtain a comparison result;

[0176] According to the comparison result, determine the data packet to be mirrored that has the same data type as the target data in the data packet;

[0177] Determine a preset data label table, and determine the network speed data and bandwidth data corresponding to the data packet to be mirrored according to the data label table;

[0178] The packets to be mirrored are determined according to the network speed data and bandwidth data of the packets to be mirrored.

[0179] In the embodiment of the present application, the parameter determination module 830 may also be specifically used for:

[0180] Determine Ethernet information, address information, and protocol information corresponding to the source transmission device and the target transmission device according to the device information, and determine undefinable parameters according to the Ethernet information, address information, and protocol information;

[0181] Determine the preset program interface, and determine the corresponding mirror data according to the program interface;

[0182] According to the image data, the target image field is determined, and according to the target image field, the definable parameters are determined.

[0183] In the embodiment of the present application, the target head determination module 840 may also be specifically used for:

[0184] Determine the initial header and original data in the package to be mirrored;

[0185] Determine the initial package to be mirrored based on the initial header, target header, and original data;

[0186] Determine the preset data capacity and the mirror package capacity of the initial mirror package, and compare the data capacity and the mirror package capacity to obtain a comparison result;

[0187] If the comparison result shows that the mirroring packet capacity is greater than the data capacity, data is intercepted from the initial mirroring packet according to the data capacity to obtain the target mirroring packet;

[0188] If the comparison result is that the mirroring package capacity is not greater than the data capacity, the initial package to be mirrored is determined as the target package to be mirrored.

[0189] In the embodiment of the present application, the data packet determination module 850 may also be specifically used for:

[0190] Determine the virtual identifier in the initial header;

[0191] Determine the target bridge based on the virtual identifier.

[0192] Fig. 9 This is a schematic diagram of the structure of the device provided in the embodiment of the present application. Fig. 9 As shown, the device 900 includes:

[0193] The device 900 may include a processor 901 with one or more processing cores, a memory 902 with one or more computer-readable storage media, a communication component 903 and other components. The processor 901 , the memory 902 and the communication component 903 are connected via a bus 904 .

[0194] In a specific implementation process, at least one processor 901 executes the computer execution instructions stored in the memory 902, so that at least one processor 901 executes the above message processing method.

[0195] The specific implementation process of the processor 901 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.

[0196] In the above Fig. 9 In the illustrated embodiment, it should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the present application may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.

[0197] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (Non-volatile Memory, NVM), such as at least one disk memory.

[0198] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.

[0199] In some embodiments, a computer program product is further proposed, including a computer program or instructions, which implement the steps in any of the above-mentioned traffic mirroring methods when executed by a processor.

[0200] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0201] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0202] To this end, an embodiment of the present application provides a computer-readable storage medium, in which multiple computer-executable instructions are stored. The computer-executable instructions can be loaded by a processor to execute the steps in any traffic mirroring method provided in the embodiment of the present application.

[0203] The storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0204] According to one aspect of the present application, a computer program product or a computer program is provided. The computer program product or the computer program comprises computer instructions stored in a computer-readable storage medium.

[0205] Since the instructions stored in the storage medium can execute the steps in any traffic mirroring method provided in the embodiments of the present application, the beneficial effects that can be achieved by any traffic mirroring method provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0206] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0207] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.< / vxlan>

Claims

1. A traffic mirroring method, characterized in that: The method comprises: Determine device information of a source transmission device and a target transmission device, a data packet transmitted by the source transmission device, and a target mirror field; Determine the packet to be mirrored according to the preset label table and the data packet, and determine the initial header of the packet to be mirrored; Determine, according to the device information, an undefinable parameter in the header of the packet to be mirrored, and determine, according to the target mirroring field, a definable parameter in the header of the packet to be mirrored; Determine a target header according to the undefinable parameters and the definable parameters, and determine a target packet to be mirrored according to the packet to be mirrored and the target header; Determine a target bridge according to the initial header, and remove the initial header in the target packet to be mirrored according to the target bridge to obtain a target data packet; According to the target bridge, the target data packet is sent to the target transmission device.

2. The method according to claim 1, characterized in that The determining of device information of a source transmission device and a target transmission device, a data packet transmitted by the source transmission device, and a target mirroring field includes: Determining a virtual identifier of the target transmission device according to the device information of the target transmission device; The virtual identifier of the data packet is determined according to the virtual identifier of the target transmission device.

3. The method according to claim 1, characterized in that: The determining of device information of a source transmission device and a target transmission device, a data packet transmitted by the source transmission device, and a target mirroring field includes: Determine all data packets transmitted by the source transmission device, and determine the target transmission port of the source transmission device; Determine a preset data flow table, and compare, according to the data flow table, all the data packets, the target data packets whose corresponding transmission ports are the target transmission ports; Determine that the target data packet is a data packet transmitted by the source transmission device.

4. The method according to claim 1, characterized in that: The preset label table includes a mirror label table and a data label table, and the method of determining the to-be-mirrored packet according to the preset label table and the data packet, and determining the initial header of the to-be-mirrored packet includes: Determine the preset mirror label table, and determine the target data type according to the mirror label table; Comparing the data type of the data packet with the target data type to obtain a comparison result; According to the comparison result, determining a data packet to be mirrored having the same data type as the target data in the data packet; Determine the preset data label table, and determine the network speed data and bandwidth data corresponding to the data packet to be mirrored according to the data label table; The packet to be mirrored is determined according to the network speed data and bandwidth data of the packet to be mirrored.

5. The method according to claim 1, characterized in that The determining, according to the device information, the undefinable parameters in the header of the to-be-mirrored packet, and determining, according to the target mirroring field, the definable parameters in the header of the to-be-mirrored packet, comprises: Determine the Ethernet information, address information, and protocol information corresponding to the source transmission device and the target transmission device according to the device information, and determine the undefinable parameter according to the Ethernet information, address information, and protocol information; Determine a preset program interface, and determine corresponding mirror data according to the program interface; The target image field is determined according to the image data, and the definable parameter is determined according to the target image field.

6. The method according to claim 1, characterized in that The step of determining a target header according to the undefinable parameters and the definable parameters, and determining a target packet to be mirrored according to the packet to be mirrored and the target header, includes: Determine the initial header and original data in the to-be-mirrored packet; Determine an initial packet to be mirrored according to the initial header, the target header, and the original data; Determine a preset data capacity and a mirror package capacity of the initial to-be-mirrored package, and compare the data capacity and the mirror package capacity to obtain a comparison result; If the comparison result is that the mirroring packet capacity is greater than the data capacity, data interception is performed on the initial packet to be mirrored according to the data capacity to obtain the target packet to be mirrored; If the comparison result is that the mirroring packet capacity is not greater than the data capacity, the initial packet to be mirrored is determined as the target packet to be mirrored.

7. The method according to claim 1, characterized in that The step of determining a target bridge according to the initial header, and removing the initial header in the target packet to be mirrored according to the target bridge to obtain a target data packet includes: Determining a virtual identifier in the initial header; The target network bridge is determined according to the virtual identifier.

8. A traffic mirroring device, characterized in that: The device comprises: An information determination module, used to determine device information of a source transmission device and a target transmission device, a data packet transmitted by the source transmission device, and a target mirror field; An initial header determination module, used to determine the packet to be mirrored according to a preset label table and the data packet, and determine the initial header of the packet to be mirrored; A parameter determination module, configured to determine the undefinable parameters in the header of the packet to be mirrored according to the device information, and to determine the definable parameters in the header of the packet to be mirrored according to the target mirroring field; A target header determination module, used to determine a target header according to the undefinable parameters and the definable parameters, and determine a target packet to be mirrored according to the packet to be mirrored and the target header; A data packet determination module, used to determine a target bridge according to the initial header, and remove the initial header in the target packet to be mirrored according to the target bridge to obtain a target data packet; A sending module is used to send the target data packet to the target transmission device according to the target bridge.

9. A device, characterized in that: include: one or more processors; Memory; One or more programs, wherein the one or more programs are stored in a memory and configured to be executed by one or more processors, the one or more programs being configured to execute the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions can be called by a processor to execute the method as claimed in any one of claims 1 to 7.