WO2024159962A1 - Traffic mirroring method and apparatus for virtual instance, virtual machine platform, and storage medium - Google Patents
Traffic mirroring method and apparatus for virtual instance, virtual machine platform, and storage medium Download PDFInfo
- Publication number
- WO2024159962A1 WO2024159962A1 PCT/CN2023/140326 CN2023140326W WO2024159962A1 WO 2024159962 A1 WO2024159962 A1 WO 2024159962A1 CN 2023140326 W CN2023140326 W CN 2023140326W WO 2024159962 A1 WO2024159962 A1 WO 2024159962A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- traffic
- mirrored
- mirroring
- instance
- virtual
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 92
- 238000001914 filtration Methods 0.000 claims description 31
- 238000012545 processing Methods 0.000 claims description 24
- 238000004590 computer program Methods 0.000 claims description 19
- 238000004891 communication Methods 0.000 abstract description 3
- 230000008569 process Effects 0.000 description 39
- 230000009471 action Effects 0.000 description 25
- 238000010586 diagram Methods 0.000 description 17
- 230000006870 function Effects 0.000 description 8
- 238000012544 monitoring process Methods 0.000 description 6
- 238000013461 design Methods 0.000 description 5
- 230000004069 differentiation Effects 0.000 description 5
- 101100412394 Drosophila melanogaster Reg-2 gene Proteins 0.000 description 4
- 206010047289 Ventricular extrasystoles Diseases 0.000 description 4
- 230000004044 response Effects 0.000 description 4
- 238000005129 volume perturbation calorimetry Methods 0.000 description 4
- 238000004458 analytical method Methods 0.000 description 3
- 238000010276 construction Methods 0.000 description 3
- 101100301524 Drosophila melanogaster Reg-5 gene Proteins 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 101001121408 Homo sapiens L-amino-acid oxidase Proteins 0.000 description 1
- 101000827703 Homo sapiens Polyphosphoinositide phosphatase Proteins 0.000 description 1
- 102100026388 L-amino-acid oxidase Human genes 0.000 description 1
- 102100023591 Polyphosphoinositide phosphatase Human genes 0.000 description 1
- 101100012902 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) FIG2 gene Proteins 0.000 description 1
- 101100233916 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) KAR5 gene Proteins 0.000 description 1
- 238000012550 audit Methods 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000005538 encapsulation Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L45/00—Routing or path finding of packets in data switching networks
- H04L45/58—Association of routers
- H04L45/586—Association of routers of virtual routers
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L45/00—Routing or path finding of packets in data switching networks
- H04L45/74—Address processing for routing
- H04L45/745—Address table lookup; Address filtering
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L45/00—Routing or path finding of packets in data switching networks
- H04L45/76—Routing in software-defined topologies, e.g. routing between virtual machines
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1095—Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
Definitions
- the present application relates to the field of communication technology, and in particular to a traffic mirroring method for a virtual instance, a traffic mirroring device for a virtual instance, a corresponding virtual machine platform, and a corresponding computer-readable storage medium.
- traffic mirroring In the related technology of traffic mirroring, it can be manifested as determining the monitoring port corresponding to the mirror destination request based on the mirror source IP resolution of the mirror source request, and then sending the traffic request to the corresponding monitoring port to realize traffic mirroring.
- the traffic mirroring realized by it cannot distinguish the traffic mirroring, which is not conducive to the traffic analysis and audit of the inbound and outbound traffic.
- embodiments of the present application are proposed to provide a traffic mirroring method for a virtual instance, a traffic mirroring device for a virtual instance, a corresponding virtual machine platform, and a corresponding computer-readable storage medium that overcome the above problems or at least partially solve the above problems.
- the embodiment of the present application discloses a traffic mirroring method of a virtual instance, which is applied to a virtual machine platform.
- the virtual machine platform includes a computing node of the virtual instance.
- the method includes:
- the mirrored traffic packets are sent to the destination terminal so that the destination terminal can distinguish the inbound and outbound mirrored traffic of the port according to the mirrored traffic packets.
- obtaining the constructed traffic flow table for the mirrored traffic further includes:
- the configured traffic mirroring information is obtained, and a traffic flow table for the mirrored traffic is constructed using the traffic mirroring information; wherein the traffic mirroring information includes at least traffic direction information, traffic mirroring instance information, terminal node information, traffic filtering policy information, and user-defined label information.
- the mirrored traffic includes inbound mirrored traffic for inbound traffic and outbound mirrored traffic for outbound traffic.
- the traffic flow table for the mirrored traffic is constructed using the traffic mirroring information, including:
- the traffic mirroring instance information, traffic direction information, terminal node information, traffic filtering policy information, and user-defined label information are used to construct the inbound flow table for the incoming mirrored traffic and the outbound flow table for the outgoing mirrored traffic. Traffic flow table.
- the virtual instance is located in a virtual private cloud, and the virtual private cloud has a corresponding traffic mirroring gateway instance created in the mirroring gateway, and the mirroring gateway group for carrying different traffic mirroring gateway instances includes multiple mirroring gateway nodes.
- generating a mirrored traffic packet according to the mirrored traffic and the traffic flow table includes:
- the mirrored traffic and traffic flow table are received through the mirrored gateway node of the mirrored gateway group;
- the routing table is obtained through the mirror gateway node, and the mirror traffic message is processed according to the routing table and the traffic flow table to generate a mirror traffic packet.
- the mirrored traffic message is processed according to the routing forwarding table and the traffic flow table to generate a mirrored traffic packet, including:
- the traffic mirroring information of the response traffic flow table is matched successfully with the routing forwarding information respectively, and the routing forwarding information is used to encapsulate the mirrored traffic message to obtain a mirrored traffic packet.
- the method before generating the mirrored traffic packet according to the mirrored traffic and the traffic flow table, the method further includes:
- An access request sent by a user destination terminal is received; wherein the access request includes a virtual instance to be accessed, and the virtual instance has a corresponding traffic mirroring gateway instance created in the mirroring gateway.
- sending the mirrored traffic message to the destination terminal includes:
- a destination terminal node of the destination terminal is determined based on the destination gateway address, and the mirrored traffic message is sent to the destination terminal node.
- the mirrored traffic message is sent to the destination terminal node, including:
- the embodiment of the present application also discloses a traffic mirroring method of a virtual instance, which is applied to a destination terminal, the destination terminal is communicatively connected with a virtual machine platform, and the virtual machine platform includes a computing node of the virtual instance, and the method includes:
- a mirrored traffic message sent by a computing node of the virtual instance;
- the mirrored traffic message is generated based on the mirrored traffic and the traffic flow table, wherein the mirrored traffic is obtained by mirroring the inbound and outbound traffic of the virtual instance;
- the traffic flow table is constructed based on the configured traffic mirroring information, and the traffic mirroring information includes at least traffic direction information and/or traffic mirroring instance information;
- Distinguish mirrored traffic based on the traffic direction information in the traffic flow table of the mirrored traffic packet including:
- the inbound mirror traffic and outbound mirror traffic of the virtual instance corresponding to the traffic mirroring instance information are analyzed;
- the mirrored traffic of the virtual instances corresponding to different traffic mirroring instance information is distinguished, and the mirrored traffic of the different virtual instances is analyzed.
- the embodiment of the present application also discloses a traffic mirroring device for a virtual instance, which is applied to a virtual machine platform.
- the virtual machine platform includes a computing node of the virtual instance.
- the device includes:
- a module for acquiring traffic to be mirrored used for acquiring traffic to be mirrored of a virtual instance, where the traffic to be mirrored of the virtual instance includes inbound traffic and/or outbound traffic;
- a traffic mirroring module is used to mirror the inbound and outbound traffic of the virtual instance on the computing node of the virtual instance to obtain mirrored traffic;
- a mirrored traffic message generation module used to obtain the traffic flow table constructed for the mirrored traffic, and generate a mirrored traffic message according to the mirrored traffic and the traffic flow table;
- the mirrored traffic message sending module is used to send the mirrored traffic message to the destination terminal so that the destination terminal can distinguish the inbound and outbound mirrored traffic of the port according to the mirrored traffic message.
- the embodiment of the present application also discloses a traffic mirroring device of a virtual instance, which is applied to a destination terminal, the destination terminal is communicatively connected with a virtual machine platform, and the virtual machine platform includes a computing node of the virtual instance, and the device includes:
- a mirrored traffic message receiving module used for receiving a mirrored traffic message sent by a computing node of a virtual instance; the mirrored traffic message is generated based on the mirrored traffic and a traffic flow table, wherein the mirrored traffic is obtained based on mirroring the inbound and outbound traffic of the virtual instance;
- the mirrored traffic distinguishing module is used to distinguish the inbound and outbound mirrored traffic of the port according to the mirrored traffic messages.
- the embodiment of the present application also discloses a virtual machine platform, including: a processor, a memory, and a computer program stored in the memory and capable of running on the processor, and when the computer program is executed by the processor, a traffic mirroring method of any virtual instance is implemented.
- the embodiment of the present application also discloses a computer-readable storage medium, on which a computer program is stored.
- a computer program is stored.
- the computer program is executed by a processor, a traffic mirroring method of any virtual instance is implemented.
- the inbound and outbound traffic of the virtual instance is mirrored at the computing node of the virtual instance to obtain the mirrored traffic, and the traffic flow table constructed for the mirrored traffic can be obtained, and the mirrored traffic message is generated according to the mirrored traffic and the traffic flow table, and the mirrored traffic message is sent to the destination terminal, so that the destination terminal can distinguish the inbound and outbound mirrored traffic of the port according to the mirrored traffic message.
- the relevant information of the virtual instance mirrored traffic is designed into the message, and sent from the computing node through the message carrying method, the traffic of the virtual instance is mirrored while occupying the least data center, and the mirrored traffic is sent to the designated terminal node, and the mirrored traffic is distinguished at the terminal node.
- the routing forwarding table on the mirrored gateway can be designed according to the characteristics of the mirrored traffic message sent by the computing node to achieve high-speed processing of the mirrored message.
- FIG1 is a flow chart of a flow mirroring method embodiment of a virtual instance of the present application.
- FIG2 is a schematic diagram of constructing an outbound flow table for a virtual instance provided in an embodiment of the present application
- FIG3 is a schematic diagram of constructing an inflow flow table of a virtual instance provided in an embodiment of the present application.
- FIG. 4 is a schematic diagram of the logical network distribution of a virtual machine instance on a public cloud provided in an embodiment of the present application
- FIG5 is a flowchart of another embodiment of a traffic mirroring method for a virtual instance of the present application.
- FIG. 6 is a schematic diagram of an application scenario of traffic mirroring of a virtual instance provided in an embodiment of the present application
- FIG. 7 is a block diagram of a flow mirroring device embodiment of a virtual instance of the present application.
- FIG8 is a structural block diagram of another virtual instance of a traffic mirroring device embodiment of the present application.
- the embodiment of the present application implements traffic mirroring based on the UDP (User Datagram Protocol) protocol in the public cloud, specifically through the traffic flow table Open vSwitch encapsulated by the VXLAN Tunnel.
- UDP User Datagram Protocol
- the core idea of the embodiment of the present application is to mirror the inbound and outbound traffic of the virtual instance at the computing node of the virtual instance to obtain the mirrored traffic, and to obtain the traffic flow table constructed for the mirrored traffic, and to generate the mirrored traffic message according to the mirrored traffic and the traffic flow table, and to send the mirrored traffic message to the destination terminal, so that the destination terminal can distinguish the inbound and outbound mirrored traffic of the port according to the mirrored traffic message.
- the user can more accurately and flexibly mirror the traffic of the cloud instance, and the traffic mirroring process is completed at the computing node where the virtual instance is located, which greatly saves the network bandwidth resources of the data center, and does not affect the main process of the user's virtual instance.
- the user's mirrored traffic can be distributed to any designated terminal node (as long as the three-layer network is reachable) through configuration, and the traffic of the virtual instance is mirrored while occupying the least data center, and the mirrored traffic is sent to the designated terminal node, and the mirrored traffic is distinguished at the terminal node.
- the traffic mirroring gateway sends the mirrored traffic message to the destination terminal node based on the UDP encapsulated double-layer tunnel message according to the routing forwarding table.
- the routing forwarding table on the mirroring gateway according to the characteristics of the mirrored traffic message sent by the computing node, high-speed processing of the mirrored message is achieved.
- the filtering strategy of the traffic filter configured by the user can also be completed on the computing node to filter out the unnecessary traffic at the source end. The filter strategy supports accepting and discarding operations.
- a flowchart of a method for traffic mirroring of a virtual instance of the present application is shown, which is applied to a virtual machine platform, and the virtual machine platform includes a computing node of a virtual instance, and specifically may include the following steps:
- Step 101 obtaining the traffic to be mirrored of the virtual instance, where the traffic to be mirrored of the virtual instance includes inbound traffic and/or outbound traffic;
- Traffic mirroring refers to the process of copying the traffic of a monitored port to a specific monitoring port for the purpose of traffic monitoring. Specifically, it can be manifested as the process of copying the traffic of a virtual instance to a destination terminal.
- the direction of the virtual instance mirror traffic can be designed into the message by designing and arranging the traffic of the computing node, and by implementing the mirroring of the mirror traffic and the generation of the mirror traffic message at the computing node, and the message is sent from the computing node through the message carrying method, so as to occupy the least space in the data center.
- the traffic of the virtual instance can be mirrored, the mirrored traffic can be sent to the specified terminal node, and the mirrored traffic can be distinguished at the terminal node.
- the traffic to be mirrored of the virtual instance may first be acquired, and the acquired traffic to be mirrored of the virtual instance may include the inbound traffic and/or outbound traffic of the virtual instance.
- the inbound traffic of the virtual instance may refer to access traffic or request traffic, etc.
- the outbound traffic may refer to response traffic and requested data, information, etc., which is not limited in the embodiments of the present application.
- Step 102 mirroring the inbound and outbound traffic of the virtual instance at the computing node of the virtual instance to obtain mirrored traffic;
- the incoming and outgoing traffic of the virtual instance can be mirrored on the computing node of the virtual instance to obtain mirrored traffic for the incoming traffic and mirrored traffic for the outgoing traffic.
- the traffic mirroring process is completed on the computing node where the virtual instance is located.
- the computing node can refer to the host node to save network bandwidth resources in the data center.
- the computing node may also obtain the traffic filter filtering policy configured by the user, and based on the traffic filter filtering policy configured by the user, filter out the unnecessary traffic at the source end so as to mirror the traffic of the filtered virtual instance.
- the filter policy may support accept and discard operations.
- Step 103 obtaining the constructed traffic flow table for the mirrored traffic, and generating a mirrored traffic message according to the mirrored traffic and the traffic flow table;
- the traffic flow table constructed for the mirrored traffic can be obtained to generate mirrored traffic packets based on the mirrored traffic and the traffic flow table, so as to design the routing forwarding table on the mirrored gateway according to the characteristics of the mirrored traffic packets sent by the computing nodes, so as to realize high-speed processing of the mirrored packets.
- the traffic flow table for the mirrored traffic is obtained mainly by obtaining the configured traffic mirroring information, and then using the traffic mirroring information to construct the traffic flow table for the mirrored traffic, so as to design and arrange the traffic of the computing node Open vSwitch and optimize the flow table on the bridge.
- the traffic mirroring information at least includes traffic mirroring instance information, terminal node information, traffic direction information, traffic filtering policy information, and user-defined label information, etc., so as to mirror the network traffic of the user virtual instance to the designated terminal node based on the traffic mirroring instance information, traffic direction information, terminal node information, traffic filtering policy information, and user-defined label information (such as traffic differentiation label, length of data packet intercepted after mirroring, etc.) configured by the user, so that the traffic of the mirrors of different virtual instances can be distinguished at the same terminal node (if the terminal node information of different virtual instances is configured as the same) according to the user-defined label information, so that the traffic message quintuple of the virtual instance is the same. That is, the relevant information of the aforementioned traffic mirroring can be designed into the message, so that the relevant information can be sent to the computing node in the form of message carrying.
- the mirrored traffic includes inbound mirrored traffic for inbound traffic and outbound mirrored traffic for outbound traffic
- traffic mirroring instance information traffic direction information, terminal node information, and traffic
- the filtering policy information and the user-defined label information are used to construct an inbound flow table for inbound mirrored traffic and an outbound flow table for outbound mirrored traffic.
- FIG. 2 a schematic diagram of constructing an outbound flow table for a virtual instance provided by an embodiment of the present application is shown, which can be mainly manifested as adding three tables again in the normally arranged flow table Pipeline, where table refers to a table for storing flow table entries. It should be noted that the table id can be determined according to actual conditions, and the embodiment of the present application does not limit this.
- table7 table8, and table180.
- table0, table6, table10 and other tables can perform normal flow table processing procedures
- each outbound flow table may be as follows:
- reg2 is the flag for whether to mirror (the specific value of reg2 can be set based on the policy that the inbound value is 1 and the outbound value is 2)
- the port that needs to be mirrored passes the mirrored traffic filter table, and the priority is set higher than the normal traffic. Assume that the priority of the port that needs to be mirrored is set to 100, and the priority of the port that does not need to be mirrored is set to 10.
- the relevant operations of table:7 are executed, that is, the function processing filter strategy in the process of mirroring traffic, so as to filter out the unnecessary traffic at the source end based on the traffic filtering strategy information.
- #By default normal traffic does not need to be sent through mirror traffic. That is, at this time, you can perform the relevant operations of table:10 and perform normal flow table processing.
- #table 7 function processing filter strategy, based on the action set reg1 flag to determine whether mirroring is needed, assuming 0x1 needs mirroring, if the mirroring switch of the port is turned off, the flow table of reg1 is set not to be sent.
- FIG. 3 a schematic diagram of constructing an inflow flow table of a virtual instance provided in an embodiment of the present application is shown, which is mainly manifested in adding three tables to the normally arranged flow table Pipeline, where table refers to a table for storing flow table entries. It should be noted that the table id can be determined according to actual conditions, and the embodiment of the present application does not limit this.
- each flow table in the specific inbound direction may be as follows:
- the port that needs to be mirrored passes through the mirror traffic filter table, and the priority is set higher than the normal traffic. Assume that the priority of the port that needs to be mirrored is set to 100, and the priority of the port that does not need to be mirrored is set to 10.
- the relevant operations of table:87 are executed, that is, the function processing filter strategy during the mirror traffic process, so that the unnecessary traffic can be filtered out at the source end based on the traffic filtering strategy information.
- the mirroring of the inbound and outbound traffic of the above virtual instance can be selected based on the user's actual situation at the mirroring point (such as table6 and table86). Generally speaking, the mirroring point of the outbound traffic will be selected after passing the port's Qos speed limit flow table and before passing the security group flow table; the mirroring point of the inbound traffic will be selected after passing the security group and port's Qos speed limit traffic. In addition, the location and value of carrying the direction mark of the mirrored traffic to the message can also be freely selected.
- the direction can be carried in the physical address mac of the source end of the message memory, the outbound mark value is set to 0x4163e, and the inbound mark value is set to 0x2163e.
- This embodiment of the present application does not limit this.
- the virtual instance is located in a virtual private cloud
- the virtual private cloud has a corresponding traffic mirror gateway instance created in the mirror gateway
- the mirror gateway group for carrying different traffic mirror gateway instances includes multiple mirror gateway nodes.
- virtual instance 1 i.e., VM1
- virtual instance 2 i.e., VM2
- VPC1 Virtual Private Cloud
- each VPC can create a traffic mirroring gateway instance on the mirroring gateway (for example, traffic mirroring gateway instance 1mrgw-VPC1, traffic mirroring gateway instance 2mrgw-VPC2, etc.), and a mirroring gateway group can contain multiple mirroring gateway nodes to carry traffic mirroring gateway instances of different VPCs, where different mirroring gateway nodes can be implemented based on multiple physical servers as nodes.
- the mirrored traffic and the traffic flow table can be received through the mirrored gateway node of the mirrored gateway group, and then the mirrored traffic message is generated by using the mirrored traffic and the traffic flow table.
- the routing forwarding table can also be obtained through the mirrored gateway node, and the mirrored traffic message is processed according to the routing forwarding table and the traffic flow table to generate a mirrored traffic packet.
- the specific message processing process can be manifested as obtaining the traffic mirroring information of the traffic flow table and obtaining the routing forwarding information of the routing forwarding table, and then responding to the successful matching of the traffic mirroring information of the traffic flow table with the routing forwarding information, and using the routing forwarding information to encapsulate the mirrored traffic message to obtain a mirrored traffic packet.
- the routing forwarding table can be obtained based on the routing forwarding information of the matching domain and the routing forwarding information of the action domain.
- the routing forwarding information of the matching domain is mainly used to match the traffic mirroring information of the traffic flow table
- the routing forwarding information of the action domain is mainly used to implement the message sending operation when the match is successful.
- the routing forwarding information of the matching domain may include Vni (Vni can be a user ID similar to VLAN ID for identifying a Virtual Network Instance), traffic direction, port physical address portmac information.
- Vni can be a user ID similar to VLAN ID for identifying a Virtual Network Instance
- traffic direction can be matched with the Vni, traffic direction, and portmac information in the routing forwarding table. If the match is unsuccessful, the message will be discarded.
- the data message hits the routing forwarding table, it can be forwarded according to the routing forwarding information of the routing forwarding table, and the mirrored traffic message can be encapsulated and sent out.
- the routing table may be as shown in Table 1 below:
- the routing forwarding information of the matching domain may include the internal destination physical address InnerDstMac, the internal source physical address InnerSrcMac, the internal source logical address innerSrcIp, the internal destination logical address innerDstIp, the internal virtual network instance identifier InnerVni, the external destination logical address OuterDstIp and the external network instance identifier OuterVni.
- it can be mainly manifested as encapsulating the intermediate layer VXLAN information according to the InnerDstMac, InnerSrcMac, innerSrcIp, innerDstIp, and InnerVni of the action domain.
- the message is sent from the traffic mirroring gateway to the mirroring terminal node.
- InnerVni can be defined by the user and is used to distinguish traffic at the mirroring terminal node.
- Step 104 Send the mirrored traffic message to the destination terminal so that the destination terminal can distinguish the inbound and outbound mirrored traffic of the port according to the mirrored traffic message.
- a mirrored traffic message When sending a mirrored traffic message to a destination terminal, it can be manifested as obtaining a routing forwarding table and a destination gateway address of the routing forwarding table through a mirrored gateway, and then determining the destination terminal node of the destination terminal based on the destination gateway address, and sending the mirrored traffic message to the destination terminal node, that is, the traffic mirroring gateway can send the mirrored traffic message to the destination terminal node based on a UDP encapsulated double-layer tunnel message according to the routing forwarding table.
- an access request sent by a user's destination terminal will be received, and the destination terminal may be a virtual instance preset in a preset virtual private cloud.
- the access request includes the virtual instance to be accessed, and the virtual instance has a corresponding traffic mirroring gateway instance created in the mirroring gateway.
- a mirrored traffic message When sending a mirrored traffic message to a destination terminal node, it can also be manifested as obtaining the virtual instance where the traffic mirroring gateway instance to be accessed is currently located, and forwarding the routing forwarding table of the traffic mirroring gateway instance corresponding to the virtual instance where the traffic mirroring gateway instance to be accessed is currently located, so as to forward the mirrored traffic message to the destination terminal node based on the routing forwarding table of the corresponding traffic mirroring gateway instance.
- a mirrored traffic message is sent to a destination terminal, and the destination terminal can distinguish the mirrored traffic based on the relevant information carried and sent in the mirrored traffic message.
- the relevant information is related to the mirrored traffic, and includes at least traffic mirroring instance information, terminal node information, traffic direction information, traffic filtering policy information, and user-defined label information, etc.
- the mirrored traffic can be distinguished based on the traffic direction information and/or traffic mirroring instance information in the traffic flow table.
- it can be manifested as distinguishing the incoming mirrored traffic and outgoing mirrored traffic of the mirrored traffic based on the traffic direction information carried by the mirrored traffic packet, and analyzing the incoming traffic and outgoing traffic; and/or distinguishing the incoming mirrored traffic and outgoing mirrored traffic of the virtual instance corresponding to the traffic mirroring instance information based on the traffic mirroring instance information and traffic direction of the mirrored traffic packet, and analyzing the incoming traffic and outgoing traffic of the virtual instance corresponding to the traffic mirroring instance information; and/or distinguishing the mirrored traffic of virtual instances corresponding to different traffic mirroring instance information based on the traffic mirroring instance information of the mirrored traffic packet, and analyzing the mirrored traffic of different virtual instances.
- the inbound and outbound traffic of the virtual instance is mirrored at the computing node of the virtual instance to obtain the mirrored traffic, and the traffic flow table constructed for the mirrored traffic can be obtained, and the mirrored traffic message is generated according to the mirrored traffic and the traffic flow table, and the mirrored traffic message is sent to the destination terminal, so that the destination terminal can distinguish the inbound and outbound mirrored traffic of the port according to the mirrored traffic message.
- the relevant information of the virtual instance mirrored traffic is designed into the message, and sent from the computing node through the message carrying method, the mirroring of the traffic of the virtual instance is realized while occupying the least data center, the mirrored sending to the designated terminal node, and the differentiation of the mirrored traffic at the terminal node.
- the routing forwarding table on the mirrored gateway can be designed according to the characteristics of the mirrored traffic message sent by the computing node to realize high-speed processing of the mirrored message.
- FIG. 1 is applied to a virtual machine platform, where the virtual machine platform includes a computing node of a virtual instance, and specifically may include the following steps:
- Step 501 receiving a mirrored traffic message sent by a computing node of a virtual instance
- Traffic mirroring refers to the process of copying the traffic of a monitored port to a specific monitoring port for the purpose of traffic monitoring. Specifically, it can be manifested as the process of copying the traffic of a virtual instance to a destination terminal.
- relevant information of the virtual instance mirrored traffic can be designed into the message, and sent from the computing nodes through message carrying, thereby implementing mirroring of the traffic of the virtual instance with minimal occupation of the data center, mirroring transmission to the designated terminal node, and differentiation of the mirrored traffic at the terminal node.
- the destination terminal can receive the mirrored traffic message sent by the computing node of the virtual instance, so as to distinguish the inbound and outbound mirrored traffic of the port according to the mirrored traffic message, for example, distinguish the mirrored traffic based on the traffic direction information contained in the carried traffic flow table.
- the received mirrored traffic message may be generated based on the mirrored traffic and the traffic flow table, wherein the mirrored traffic is obtained based on mirroring the inbound traffic and the outbound traffic of the virtual instance.
- Traffic mirroring information at least includes traffic mirroring instance information, terminal node information, traffic direction information, traffic filtering policy information, and user-defined label information, etc., to mirror the network traffic of the user's virtual instance to the specified terminal node based on the user-configured traffic mirroring instance information, traffic direction information, terminal node information, traffic filtering policy information, and user-defined label information (such as traffic differentiation label, length of data packet intercepted after mirroring, etc.), so that the traffic of subsequent mirrors of different virtual instances can be distinguished at the same terminal node (if the terminal node information of different virtual instances is configured as the same) according to the user-defined label information, that is, the traffic message quintuple of the virtual instance is the same. It is also possible to mirror the inbound and outbound traffic of the virtual instance separately and distinguish the traffic direction, so that users can more accurately and flexibly mirror the traffic of cloud instances.
- Step 502 Differentiate the inbound and outbound mirrored traffic of the port according to the mirrored traffic message.
- the inbound and outbound mirrored traffic of a port can be distinguished based on the traffic direction information carried by the mirrored traffic message
- the inbound and outbound mirrored traffic of a port can be distinguished based on the traffic mirroring instance information carried by the mirrored traffic message
- the inbound and outbound mirrored traffic of a port can be distinguished based on the traffic direction information and traffic mirroring instance information carried by the mirrored traffic message.
- the relevant information used to distinguish the inbound and outbound mirrored traffic of a port can also be other information carried in the message; and the relevant information used to distinguish the inbound and outbound mirrored traffic of a port can be specifically determined based on the information designed to be carried in the message, and the embodiments of the present application do not limit this.
- the incoming mirrored traffic and the outgoing mirrored traffic of the mirrored traffic can be distinguished based on the traffic direction information of the mirrored traffic packet, and the incoming traffic and the outgoing traffic can be analyzed; in another case, the incoming mirrored traffic and the outgoing mirrored traffic of the virtual instance corresponding to the traffic mirrored instance information can be distinguished based on the traffic mirrored instance information and the traffic direction of the mirrored traffic packet, and the incoming traffic and the outgoing traffic of the virtual instance corresponding to the traffic mirrored instance information can be analyzed; in yet another case, the mirrored traffic of the virtual instances corresponding to different traffic mirrored instance information can also be distinguished based on the traffic mirrored instance information of the mirrored traffic packet, and the mirrored traffic of different virtual instances can be analyzed.
- the user can more accurately and flexibly mirror the traffic of the cloud instance, and the traffic mirroring process is completed at the computing node where the virtual instance is located, which greatly saves the network bandwidth resources of the data center and does not affect the main process of the user's virtual instance.
- the traffic after the user's mirroring can be distributed to any designated terminal node (as long as the three-layer network is reachable) through configuration, and the traffic of the virtual instance is mirrored while occupying the least data center, and the mirroring is sent to the designated terminal node, and the mirroring traffic is distinguished at the terminal node.
- the traffic mirroring gateway sends the mirrored traffic message to the destination terminal node based on the UDP encapsulated double-layer Tunnel message according to the routing forwarding table, and designs the routing forwarding table on the mirroring gateway according to the characteristics of the mirrored traffic message sent by the computing node, so as to realize high-speed processing of the mirrored message.
- the filtering strategy of the traffic filter configured by the user can also be completed at the computing node, and the unnecessary traffic is filtered out at the source end, and the filter strategy supports accepting and discarding operations.
- FIG. 6 a schematic diagram of the application scenario of traffic mirroring of a virtual instance provided in an embodiment of the present application is shown.
- the embodiment of the present application implements traffic mirroring based on the UDP protocol in a public cloud, specifically through traffic flow table Open vSwitch encapsulated by VXLAN Tunnel.
- the logical network distribution of the virtual machine instances to be mirrored on the public cloud can be shown in Figure 4.
- virtual instance 1 i.e. VM1
- virtual instance 2 i.e. VM2
- virtual instance 3 i.e. VM3
- subnet 1 i.e. subnet1 in user VPC2.
- Each VPC can create a traffic mirroring gateway instance (such as mrgw-VPC1, mrgw-VPC2, etc.) on the mirroring gateway
- a mirroring gateway group can contain multiple mirroring gateway nodes to carry traffic mirroring gateway instances of different VPCs, where different mirroring gateway nodes can be implemented based on multiple physical servers as nodes.
- dotted line 1 is the access traffic of VM1 accessing VM3
- dotted line 2 is the response traffic of VM1 accessing VM3.
- the access traffic can be the inbound traffic
- the response traffic can be the outbound traffic.
- the corresponding orchestration flow table will be sent up and down on the br-int bridge on the Open vSwitch of the host node (compute node 2) where VM3 is located, and the inbound (outbound) traffic will be mirrored and sent to the mirror node of the mirror gateway group through the UDP protocol.
- the mirror gateway group will send a forwarding routing table to the mirror gateway instance of VPC2 (i.e., mrgw-VPC2), and the mirror gateway instance will forward the traffic to the terminal node (i.e., the virtual instance VM2 in VPC1) according to the sent forwarding routing table, so that the terminal node can distinguish the mirror traffic based on the traffic direction information in the traffic flow table of the mirror traffic message.
- VPC2 i.e., mrgw-VPC2
- the mirror gateway instance will forward the traffic to the terminal node (i.e., the virtual instance VM2 in VPC1) according to the sent forwarding routing table, so that the terminal node can distinguish the mirror traffic based on the traffic direction information in the traffic flow table of the mirror traffic message.
- the user can more accurately and flexibly mirror the traffic of the cloud instance, and the traffic mirroring process is completed on the computing node where the virtual instance is located, which greatly saves the network bandwidth resources of the data center and does not affect the main process of the user's virtual instance.
- the user's mirrored traffic can be distributed to any specified terminal node (as long as the three-layer network is reachable) through configuration, and the traffic of the virtual instance can be mirrored while occupying the least data center, and the mirrored traffic can be sent to the specified terminal node, and the mirrored traffic can be mirrored at the terminal node. Distinguish.
- the traffic mirroring gateway sends the mirrored traffic message to the destination terminal node based on the UDP encapsulated double-layer tunnel message according to the routing forwarding table.
- the routing forwarding table By designing the routing forwarding table on the mirroring gateway according to the characteristics of the mirrored traffic message sent by the computing node, high-speed processing of the mirrored message is achieved.
- the filtering strategy based on the user-configured traffic filter is also completed on the computing node to filter out unnecessary traffic at the source end. The filter strategy supports accepting and discarding operations.
- the virtual machine platform includes a computing node of a virtual instance, and specifically may include the following modules:
- the to-be-mirrored traffic acquisition module 701 is used to acquire the to-be-mirrored traffic of the virtual instance, where the to-be-mirrored traffic of the virtual instance includes inbound traffic and/or outbound traffic;
- the traffic mirroring module 702 is used to mirror the inbound and outbound traffic of the virtual instance at the computing node of the virtual instance to obtain mirrored traffic;
- the mirrored traffic message generation module 703 is used to obtain the constructed traffic flow table for the mirrored traffic and generate the mirrored traffic message according to the mirrored traffic and the traffic flow table;
- the mirrored traffic message sending module 704 is used to send the mirrored traffic message to the destination terminal so that the destination terminal can distinguish the inbound and outbound mirrored traffic of the port according to the mirrored traffic message.
- the device provided in the embodiment of the present application may further include the following modules:
- the traffic flow table construction module is used to obtain the configured traffic mirroring information and use the traffic mirroring information to construct a traffic flow table for the mirrored traffic; wherein the traffic mirroring information at least includes traffic direction information, traffic mirroring instance information, terminal node information, traffic filtering policy information and user-defined label information.
- the mirrored traffic includes inbound mirrored traffic for inbound traffic and outbound mirrored traffic for outbound traffic;
- the traffic flow table construction module may include the following submodules:
- the traffic flow table construction submodule is used to use traffic mirroring instance information, traffic direction information, terminal node information, traffic filtering policy information and user-defined label information to respectively construct an inbound traffic flow table for incoming mirrored traffic and an outbound traffic flow table for outgoing mirrored traffic.
- the virtual instance is located in a virtual private cloud, and the virtual private cloud has a corresponding traffic mirroring gateway instance created in the mirroring gateway.
- the mirroring gateway group for carrying different traffic mirroring gateway instances includes multiple mirroring gateway nodes.
- the mirrored traffic packet generation module 703 may include the following submodules:
- the mirror traffic receiving submodule is used to receive the mirror traffic and traffic flow table through the mirror gateway node of the mirror gateway group after the computing node of the virtual instance builds the mirror traffic;
- the mirrored traffic message generation submodule is used to generate a mirrored traffic message using the mirrored traffic and the traffic flow table.
- the mirrored traffic message generation module 703 may further include the following submodules:
- the mirror traffic packet generation submodule is used to obtain the routing forwarding table through the mirror gateway node and The forwarding table and traffic flow table process the mirrored traffic packets and generate mirrored traffic packets.
- the mirrored traffic packet generation submodule may include the following units:
- a routing forwarding information acquisition unit used to acquire traffic mirroring information of a traffic flow table and acquire routing forwarding information of a routing forwarding table
- the mirror traffic packet generating unit is used to respond to the traffic mirror information of the traffic flow table being matched successfully with the routing forwarding information, and to encapsulate the mirror traffic message using the routing forwarding information to obtain the mirror traffic packet.
- the device proposed in the embodiment of the present application may further include the following modules:
- the access request receiving module is used to receive the access request sent by the user's destination terminal; wherein the access request includes the virtual instance to be accessed, and the virtual instance has a corresponding traffic mirroring gateway instance created in the mirroring gateway.
- the mirrored traffic message sending module 704 may include the following submodules:
- the target gateway address acquisition submodule is used to obtain the routing forwarding table through the mirror gateway and obtain the destination gateway address of the routing forwarding table;
- the mirrored traffic message sending submodule is used to determine the destination terminal node of the destination terminal based on the destination gateway address and send the mirrored traffic message to the destination terminal node.
- the mirrored traffic message sending submodule may include the following units:
- the mirrored traffic message sending unit is used to obtain the virtual instance where the traffic mirroring gateway instance to be accessed is currently located, and forward the routing forwarding table to the traffic mirroring gateway instance corresponding to the virtual instance where the traffic mirroring gateway instance to be accessed is currently located, so as to forward the mirrored traffic message to the destination terminal node based on the routing forwarding table based on the corresponding traffic mirroring gateway instance.
- the flow mirroring device of the virtual instance provided in the embodiment of the present application can mirror the inbound and outbound flows of the virtual instance at the computing node of the virtual instance to obtain the mirrored flow, and can obtain the constructed flow flow table for the mirrored flow, and generate the mirrored flow message according to the mirrored flow and the flow flow table, and send the mirrored flow message to the destination terminal, so that the destination terminal can distinguish the inbound and outbound mirrored flows of the port according to the mirrored flow message.
- the relevant information of the virtual instance mirrored flow is designed into the message, and sent from the computing node through the message carrying method, the mirroring of the flow of the virtual instance is realized under the condition of occupying the least data center, the mirroring is sent to the designated terminal node, and the distinction of the mirrored flow is realized at the terminal node.
- the routing forwarding table on the mirrored gateway can be designed according to the characteristics of the mirrored flow message sent by the computing node to realize high-speed processing of the mirrored message.
- FIG. 8 a structural block diagram of another embodiment of a traffic mirroring device of a virtual instance of the present application is shown, which is applied to a destination terminal, the destination terminal is connected to a virtual machine platform for communication, and the virtual machine platform includes a computing node of a virtual instance, and specifically may include the following modules:
- the mirrored traffic message receiving module 801 is used to receive the mirrored traffic message sent by the computing node of the virtual instance; the mirrored traffic message is generated based on the mirrored traffic and the traffic flow table, wherein the mirrored traffic is obtained based on mirroring the inbound and outbound traffic of the virtual instance;
- the mirrored traffic distinguishing module 802 is used to distinguish the inbound and outbound mirrored traffic of the port according to the mirrored traffic messages.
- the traffic flow table is constructed based on the configured traffic mirroring information, and the traffic mirroring information includes at least traffic direction information and/or traffic mirroring instance information; the mirrored traffic differentiation module 802 may include the following submodules:
- a first mirrored traffic distinguishing submodule is used to distinguish incoming mirrored traffic and outgoing mirrored traffic of the mirrored traffic based on traffic direction information of the mirrored traffic packet, and analyze the incoming traffic and the outgoing traffic;
- the second mirrored traffic distinguishing submodule is used to distinguish the incoming mirrored traffic and the outgoing mirrored traffic of the virtual instance corresponding to the traffic mirrored instance information based on the traffic mirrored instance information and the traffic direction of the mirrored traffic packet, and analyze the incoming traffic and the outgoing traffic of the virtual instance corresponding to the traffic mirrored instance information;
- the third mirrored traffic distinguishing submodule is used to distinguish the mirrored traffic of virtual instances corresponding to different traffic mirroring instance information based on the traffic mirroring instance information of the mirrored traffic packet, and analyze the mirrored traffic of different virtual instances.
- the traffic mirroring device of the virtual instance provided by the embodiment of the present application realizes the mirroring of the inflow and outflow of the virtual instance respectively, distinguishes the traffic direction, and allows users to more accurately and flexibly mirror the traffic of the cloud instance, and the traffic mirroring process is completed at the computing node where the virtual instance is located, which greatly saves the network bandwidth resources of the data center, and does not affect the main process of the user's virtual instance.
- the traffic after the user's mirroring can be distributed to any designated terminal node (as long as the three-layer network is reachable) through configuration, and the traffic of the virtual instance is mirrored while occupying the least data center, and the mirroring is sent to the designated terminal node, and the mirroring traffic is distinguished at the terminal node.
- the traffic mirroring gateway sends the mirrored traffic message to the destination terminal node based on the UDP encapsulated double-layer Tunnel message according to the routing forwarding table, and the routing forwarding table on the mirroring gateway is designed according to the characteristics of the mirrored traffic message sent by the computing node, so as to realize high-speed processing of the mirrored message.
- the filtering strategy of the traffic filter configured by the user can also be completed at the computing node, and the unnecessary traffic is filtered out at the source end, and the filter strategy supports acceptance and discarding operations.
- the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
- the embodiment of the present application also provides a virtual machine platform, including:
- It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor.
- the computer program When the computer program is executed by the processor, each process of the traffic mirroring method embodiment of the above virtual instance is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
- the embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored.
- a computer program is stored.
- the computer program is executed by a processor, each process of the traffic mirroring method embodiment of the above-mentioned virtual instance is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
- the embodiments of the present application can be provided as methods, devices, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
- a computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
- each process and/or box in the flowchart and/or block diagram, and the combination of the process and/or box in the flowchart and/or block diagram can be realized by computer program instructions.
- These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing terminal device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device produce a device for realizing the function specified in one process or multiple processes in the flowchart and/or one box or multiple boxes in the block diagram.
- These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
- These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce computer-implemented processing, so that the instructions executed on the computer or other programmable terminal device provide steps for implementing the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
Embodiments of the present application relate to the technical field of communications, and provide a traffic mirroring method and apparatus for a virtual instance, a virtual machine platform, and a storage medium. The method comprises: acquiring traffic to be mirrored of a virtual instance; mirroring inbound traffic and outbound traffic of the virtual instance at a computing node for the virtual instance to obtain mirrored traffic; acquiring a constructed traffic flow table for the mirrored traffic, and generating a mirrored traffic packet according to the mirrored traffic and the traffic flow table; and sending the mirrored traffic packet to a destination terminal, such that the destination terminal distinguishes inbound mirrored traffic and outbound mirrored traffic of a port according to the mirrored traffic packet. By mirroring traffic to be mirrored and generating a mirrored traffic packet at a computing node, related information of mirrored traffic of a virtual instance is designed into the packet, and is thus carried in the packet and sent out from the computing node, such that the mirroring of the traffic of the virtual instance and the sending of the mirrored traffic are implemented while a minimum portion of a data center is occupied, thereby distinguishing mirrored traffic at a terminal node.
Description
相关申请的交叉引用CROSS-REFERENCE TO RELATED APPLICATIONS
本申请要求于2023年02月01日提交中国专利局,申请号为202310050246.9,申请名称为“虚拟实例的流量镜像方法、装置、虚拟机平台及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to a Chinese patent application filed with the China Patent Office on February 1, 2023, with application number 202310050246.9 and application name “Traffic mirroring method, device, virtual machine platform and storage medium for virtual instances”, the entire contents of which are incorporated by reference into this application.
本申请涉及通信技术领域,特别是涉及一种虚拟实例的流量镜像方法、一种虚拟实例的流量镜像装置、相应的一种虚拟机平台以及相应的一种计算机可读存储介质。The present application relates to the field of communication technology, and in particular to a traffic mirroring method for a virtual instance, a traffic mirroring device for a virtual instance, a corresponding virtual machine platform, and a corresponding computer-readable storage medium.
在公有云虚拟网络中,用户通常会有对云上虚拟实例(虚拟机或Docker容器)的入出流量进行镜像的需求,镜像流量后导入到用户指定的终端节点进行流量分析及审计。In a public cloud virtual network, users usually need to mirror the inbound and outbound traffic of virtual instances (virtual machines or Docker containers) on the cloud. After mirroring the traffic, it is imported into the user-specified terminal node for traffic analysis and auditing.
在流量镜像的相关技术中,可以表现为基于对镜像源请求的镜像源IP解析确定镜像目的请求对应的监控端口,然后将流量发送请求到对应的监控端口实现流量镜像,然而其所实现的流量镜像无法对流量镜像进行区分,不利于对入出流量的流量分析及审计。In the related technology of traffic mirroring, it can be manifested as determining the monitoring port corresponding to the mirror destination request based on the mirror source IP resolution of the mirror source request, and then sending the traffic request to the corresponding monitoring port to realize traffic mirroring. However, the traffic mirroring realized by it cannot distinguish the traffic mirroring, which is not conducive to the traffic analysis and audit of the inbound and outbound traffic.
概述Overview
鉴于上述问题,提出了本申请实施例以便提供一种克服上述问题或者至少部分地解决上述问题的一种虚拟实例的流量镜像方法、一种虚拟实例的流量镜像装置、相应的一种虚拟机平台以及相应的一种计算机可读存储介质。In view of the above problems, embodiments of the present application are proposed to provide a traffic mirroring method for a virtual instance, a traffic mirroring device for a virtual instance, a corresponding virtual machine platform, and a corresponding computer-readable storage medium that overcome the above problems or at least partially solve the above problems.
本申请实施例公开了一种虚拟实例的流量镜像方法,应用于虚拟机平台,虚拟机平台包含虚拟实例的计算节点,方法包括:The embodiment of the present application discloses a traffic mirroring method of a virtual instance, which is applied to a virtual machine platform. The virtual machine platform includes a computing node of the virtual instance. The method includes:
获取虚拟实例的待镜像流量,虚拟实例的待镜像流量包括入流量和/或出流量;Obtaining the traffic to be mirrored of the virtual instance, where the traffic to be mirrored of the virtual instance includes inbound traffic and/or outbound traffic;
在虚拟实例的计算节点对虚拟实例的入流量和出流量进行镜像,得到镜像流量;Mirror the inbound and outbound traffic of the virtual instance on the computing node of the virtual instance to obtain mirrored traffic;
获取所构建的针对镜像流量的流量流表,根据镜像流量和流量流表生成镜像流量报文;Obtain the traffic flow table constructed for the mirrored traffic, and generate a mirrored traffic message according to the mirrored traffic and the traffic flow table;
向目的终端发送镜像流量报文,以便目的终端根据镜像流量报文区分端口的入出镜像流量。The mirrored traffic packets are sent to the destination terminal so that the destination terminal can distinguish the inbound and outbound mirrored traffic of the port according to the mirrored traffic packets.
可选地,获取所构建的针对镜像流量的流量流表,还包括:Optionally, obtaining the constructed traffic flow table for the mirrored traffic further includes:
获取所配置的流量镜像信息,采用流量镜像信息构建针对镜像流量的流量流表;其中,流量镜像信息至少包括流量方向信息、流量镜像实例信息、终端节点信息、流量过滤策略信息以及用户自定义标签信息。The configured traffic mirroring information is obtained, and a traffic flow table for the mirrored traffic is constructed using the traffic mirroring information; wherein the traffic mirroring information includes at least traffic direction information, traffic mirroring instance information, terminal node information, traffic filtering policy information, and user-defined label information.
可选地,镜像流量包括针对入流量的入镜像流量和针对出流量的出镜像流量;采用流量镜像信息构建针对镜像流量的流量流表,包括:Optionally, the mirrored traffic includes inbound mirrored traffic for inbound traffic and outbound mirrored traffic for outbound traffic. The traffic flow table for the mirrored traffic is constructed using the traffic mirroring information, including:
采用流量镜像实例信息、流量方向信息、终端节点信息、流量过滤策略信息以及用户自定义标签信息,分别构建入镜像流量的入流量流表,以及出镜像流量的出
流量流表。The traffic mirroring instance information, traffic direction information, terminal node information, traffic filtering policy information, and user-defined label information are used to construct the inbound flow table for the incoming mirrored traffic and the outbound flow table for the outgoing mirrored traffic. Traffic flow table.
可选地,虚拟实例位于虚拟私有云,虚拟私有云在镜像网关具有所创建的相应的流量镜像网关实例,用于承载不同流量镜像网关实例的镜像网关组包括多个镜像网关节点。Optionally, the virtual instance is located in a virtual private cloud, and the virtual private cloud has a corresponding traffic mirroring gateway instance created in the mirroring gateway, and the mirroring gateway group for carrying different traffic mirroring gateway instances includes multiple mirroring gateway nodes.
可选地,根据镜像流量和流量流表生成镜像流量报文,包括:Optionally, generating a mirrored traffic packet according to the mirrored traffic and the traffic flow table includes:
在虚拟实例的计算节点构建得到镜像流量后,通过镜像网关组的镜像网关节点接收镜像流量和流量流表;After the compute node of the virtual instance builds the mirrored traffic, the mirrored traffic and traffic flow table are received through the mirrored gateway node of the mirrored gateway group;
采用镜像流量和流量流表生成镜像流量报文;Use mirrored traffic and traffic flow table to generate mirrored traffic packets;
还包括:Also includes:
通过镜像网关节点获取路由转发表,并根据路由转发表和流量流表对镜像流量报文进行报文处理,生成镜像流量包。The routing table is obtained through the mirror gateway node, and the mirror traffic message is processed according to the routing table and the traffic flow table to generate a mirror traffic packet.
可选地,根据路由转发表和流量流表对镜像流量报文进行报文处理,生成镜像流量包,包括:Optionally, the mirrored traffic message is processed according to the routing forwarding table and the traffic flow table to generate a mirrored traffic packet, including:
获取流量流表的流量镜像信息,以及获取路由转发表的路由转发信息;Obtain traffic mirroring information from the traffic flow table and route forwarding information from the route forwarding table;
响应流量流表的流量镜像信息分别与路由转发信息匹配成功,采用路由转发信息对镜像流量报文进行封装,得到镜像流量包。The traffic mirroring information of the response traffic flow table is matched successfully with the routing forwarding information respectively, and the routing forwarding information is used to encapsulate the mirrored traffic message to obtain a mirrored traffic packet.
可选地,在根据镜像流量和流量流表生成镜像流量报文之前,还包括:Optionally, before generating the mirrored traffic packet according to the mirrored traffic and the traffic flow table, the method further includes:
接收用户目的终端发送的访问请求;其中,访问请求包括所要访问的虚拟实例,虚拟实例在镜像网关具有所创建的相应的流量镜像网关实例。An access request sent by a user destination terminal is received; wherein the access request includes a virtual instance to be accessed, and the virtual instance has a corresponding traffic mirroring gateway instance created in the mirroring gateway.
可选地,向目的终端发送镜像流量报文,包括:Optionally, sending the mirrored traffic message to the destination terminal includes:
通过镜像网关获取路由转发表并获取路由转发表的目的网关地址;Obtain the routing forwarding table through the mirror gateway and obtain the destination gateway address of the routing forwarding table;
基于目的网关地址确定将目的终端的目的终端节点,并向目的终端节点发送镜像流量报文。A destination terminal node of the destination terminal is determined based on the destination gateway address, and the mirrored traffic message is sent to the destination terminal node.
可选地,向目的终端节点发送镜像流量报文,包括:Optionally, the mirrored traffic message is sent to the destination terminal node, including:
获取所要访问的流量镜像网关实例当前所在的虚拟实例,向所要访问的流量镜像网关实例当前所在的虚拟实例,所对应的流量镜像网关实例转发路由转发表,以便基于所对应的流量镜像网关实例基于路由转发表将镜像流量报文转发至目的终端节点。Obtain the virtual instance where the traffic mirroring gateway instance to be accessed is currently located, and forward the routing forwarding table to the traffic mirroring gateway instance corresponding to the virtual instance where the traffic mirroring gateway instance to be accessed is currently located, so as to forward the mirrored traffic message to the destination terminal node based on the routing forwarding table of the corresponding traffic mirroring gateway instance.
本申请实施例还公开了一种虚拟实例的流量镜像方法,应用于目的终端,目的终端与虚拟机平台通信连接,虚拟机平台包含虚拟实例的计算节点,方法包括:The embodiment of the present application also discloses a traffic mirroring method of a virtual instance, which is applied to a destination terminal, the destination terminal is communicatively connected with a virtual machine platform, and the virtual machine platform includes a computing node of the virtual instance, and the method includes:
接收虚拟实例的计算节点发送的镜像流量报文;镜像流量报文基于镜像流量和流量流表生成,其中,镜像流量基于对虚拟实例的入流量和出流量进行镜像得到;Receive a mirrored traffic message sent by a computing node of the virtual instance; the mirrored traffic message is generated based on the mirrored traffic and the traffic flow table, wherein the mirrored traffic is obtained by mirroring the inbound and outbound traffic of the virtual instance;
根据镜像流量报文区分端口的入出镜像流量。Differentiate the inbound and outbound mirrored traffic on a port based on the mirrored traffic packets.
可选地,流量流表基于所配置的流量镜像信息构建,流量镜像信息至少包括流量方向信息和/或流量镜像实例信息;Optionally, the traffic flow table is constructed based on the configured traffic mirroring information, and the traffic mirroring information includes at least traffic direction information and/or traffic mirroring instance information;
基于镜像流量报文的流量流表中流量方向信息区分镜像流量,包括:Distinguish mirrored traffic based on the traffic direction information in the traffic flow table of the mirrored traffic packet, including:
基于镜像流量包的流量方向信息区分镜像流量的入镜像流量和出镜像流量,对入流量和出流量进行分析;Distinguish incoming and outgoing mirrored traffic based on the traffic direction information of the mirrored traffic packet, and analyze the incoming and outgoing traffic.
和/或,基于镜像流量包的流量镜像实例信息和流量方向区分与流量镜像实例信
息相应虚拟实例的入镜像流量和出镜像流量,对与流量镜像实例信息相应虚拟实例的入流量和出流量进行分析;and/or, distinguishing traffic mirroring instance information and traffic direction based on the traffic mirroring packet and traffic mirroring instance information. The inbound mirror traffic and outbound mirror traffic of the virtual instance corresponding to the traffic mirroring instance information are analyzed;
和/或,基于镜像流量包的流量镜像实例信息区分与不同流量镜像实例信息相应虚拟实例的镜像流量,对不同虚拟实例的镜像流量进行分析。And/or, based on the traffic mirroring instance information of the mirrored traffic packet, the mirrored traffic of the virtual instances corresponding to different traffic mirroring instance information is distinguished, and the mirrored traffic of the different virtual instances is analyzed.
本申请实施例还公开了一种虚拟实例的流量镜像装置,应用于虚拟机平台,虚拟机平台包含虚拟实例的计算节点,装置包括:The embodiment of the present application also discloses a traffic mirroring device for a virtual instance, which is applied to a virtual machine platform. The virtual machine platform includes a computing node of the virtual instance. The device includes:
待镜像流量获取模块,用于获取虚拟实例的待镜像流量,虚拟实例的待镜像流量包括入流量和/或出流量;A module for acquiring traffic to be mirrored, used for acquiring traffic to be mirrored of a virtual instance, where the traffic to be mirrored of the virtual instance includes inbound traffic and/or outbound traffic;
流量镜像模块,用于在虚拟实例的计算节点对虚拟实例的入流量和出流量进行镜像,得到镜像流量;A traffic mirroring module is used to mirror the inbound and outbound traffic of the virtual instance on the computing node of the virtual instance to obtain mirrored traffic;
镜像流量报文生成模块,用于获取所构建的针对镜像流量的流量流表,根据镜像流量和流量流表生成镜像流量报文;A mirrored traffic message generation module, used to obtain the traffic flow table constructed for the mirrored traffic, and generate a mirrored traffic message according to the mirrored traffic and the traffic flow table;
镜像流量报文发送模块,用于向目的终端发送镜像流量报文,以便目的终端根据镜像流量报文区分端口的入出镜像流量。The mirrored traffic message sending module is used to send the mirrored traffic message to the destination terminal so that the destination terminal can distinguish the inbound and outbound mirrored traffic of the port according to the mirrored traffic message.
本申请实施例还公开了一种虚拟实例的流量镜像装置,应用于目的终端,目的终端与虚拟机平台通信连接,虚拟机平台包含虚拟实例的计算节点,装置包括:The embodiment of the present application also discloses a traffic mirroring device of a virtual instance, which is applied to a destination terminal, the destination terminal is communicatively connected with a virtual machine platform, and the virtual machine platform includes a computing node of the virtual instance, and the device includes:
镜像流量报文接收模块,用于接收虚拟实例的计算节点发送的镜像流量报文;镜像流量报文基于镜像流量和流量流表生成,其中,镜像流量基于对虚拟实例的入流量和出流量进行镜像得到;A mirrored traffic message receiving module, used for receiving a mirrored traffic message sent by a computing node of a virtual instance; the mirrored traffic message is generated based on the mirrored traffic and a traffic flow table, wherein the mirrored traffic is obtained based on mirroring the inbound and outbound traffic of the virtual instance;
镜像流量区分模块,用于根据镜像流量报文区分端口的入出镜像流量。The mirrored traffic distinguishing module is used to distinguish the inbound and outbound mirrored traffic of the port according to the mirrored traffic messages.
本申请实施例还公开了一种虚拟机平台,包括:处理器、存储器及存储在存储器上并能够在处理器上运行的计算机程序,计算机程序被处理器执行时实现任一项虚拟实例的流量镜像方法。The embodiment of the present application also discloses a virtual machine platform, including: a processor, a memory, and a computer program stored in the memory and capable of running on the processor, and when the computer program is executed by the processor, a traffic mirroring method of any virtual instance is implemented.
本申请实施例还公开了一种计算机可读存储介质,计算机可读存储介质上存储计算机程序,计算机程序被处理器执行时实现任一项虚拟实例的流量镜像方法。The embodiment of the present application also discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, a traffic mirroring method of any virtual instance is implemented.
本申请实施例包括以下优点:The embodiments of the present application include the following advantages:
在本申请实施例中,在虚拟实例的计算节点对虚拟实例的入流量和出流量进行镜像,得到镜像流量,以及可以获取所构建的针对镜像流量的流量流表,并根据镜像流量和流量流表生成镜像流量报文,向目的终端发送镜像流量报文,以便目的终端能够根据镜像流量报文区分端口的入出镜像流量。通过对计算节点的流量的设计编排,以及通过在计算节点实现对待镜像流量的镜像以及镜像流量报文的生成,将虚拟实例镜像流量的相关信息设计到报文中,通过报文携带方式从计算节点发送出去,在占用数据中心最少的情况下实现对虚拟实例的流量的镜像,向指定终端节点进行的镜像发送,以及实现在终端节点对镜像流量进行的区分。进一步地,还可以通过根据计算节点发送出的镜像流量报文特性,设计镜像网关上的路由转发表,实现对镜像报文的高速处理。In an embodiment of the present application, the inbound and outbound traffic of the virtual instance is mirrored at the computing node of the virtual instance to obtain the mirrored traffic, and the traffic flow table constructed for the mirrored traffic can be obtained, and the mirrored traffic message is generated according to the mirrored traffic and the traffic flow table, and the mirrored traffic message is sent to the destination terminal, so that the destination terminal can distinguish the inbound and outbound mirrored traffic of the port according to the mirrored traffic message. By designing and arranging the traffic of the computing node, and by implementing the mirroring of the mirrored traffic and the generation of the mirrored traffic message at the computing node, the relevant information of the virtual instance mirrored traffic is designed into the message, and sent from the computing node through the message carrying method, the traffic of the virtual instance is mirrored while occupying the least data center, and the mirrored traffic is sent to the designated terminal node, and the mirrored traffic is distinguished at the terminal node. Furthermore, the routing forwarding table on the mirrored gateway can be designed according to the characteristics of the mirrored traffic message sent by the computing node to achieve high-speed processing of the mirrored message.
图1是本申请的一种虚拟实例的流量镜像方法实施例的步骤流程图;FIG1 is a flow chart of a flow mirroring method embodiment of a virtual instance of the present application;
图2是本申请实施例提供的对虚拟实例的出流量流表的构建示意图;
FIG2 is a schematic diagram of constructing an outbound flow table for a virtual instance provided in an embodiment of the present application;
图3是本申请实施例提供的虚拟实例的入流量流表的构建示意图;FIG3 is a schematic diagram of constructing an inflow flow table of a virtual instance provided in an embodiment of the present application;
图4是本申请实施例提供的公有云上虚拟机实例的逻辑网络分布示意图;4 is a schematic diagram of the logical network distribution of a virtual machine instance on a public cloud provided in an embodiment of the present application;
图5是本申请的另一种虚拟实例的流量镜像方法实施例的步骤流程图;FIG5 is a flowchart of another embodiment of a traffic mirroring method for a virtual instance of the present application;
图6是本申请实施例提供的虚拟实例的流量镜像的应用场景示意图;6 is a schematic diagram of an application scenario of traffic mirroring of a virtual instance provided in an embodiment of the present application;
图7是本申请的一种虚拟实例的流量镜像装置实施例的结构框图;7 is a block diagram of a flow mirroring device embodiment of a virtual instance of the present application;
图8是本申请的另一种虚拟实例的流量镜像装置实施例的结构框图。FIG8 is a structural block diagram of another virtual instance of a traffic mirroring device embodiment of the present application.
详细描述Detailed Description
为使本申请的上述目的、特征和优点能够更加明显易懂,下面结合附图和具体实施方式对本申请作进一步详细的说明。In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
在公有云虚拟网络中,用户通常会有对云上虚拟实例(虚拟机或Docker容器)的入出流量进行镜像的需求,镜像流量后导入到用户指定的终端节点进行流量分析及审计。In a public cloud virtual network, users usually need to mirror the inbound and outbound traffic of virtual instances (virtual machines or Docker containers) on the cloud. After mirroring the traffic, it is imported into the user-specified terminal node for traffic analysis and auditing.
为了满足上述需求,本申请实施例在公有云中实现了基于UDP(User Datagram Protocol,用户数据报协议)协议,具体通过VXLAN Tunnel封装的流量流表Open vSwitch所编排的流量镜像。In order to meet the above requirements, the embodiment of the present application implements traffic mirroring based on the UDP (User Datagram Protocol) protocol in the public cloud, specifically through the traffic flow table Open vSwitch encapsulated by the VXLAN Tunnel.
本申请实施例的核心思想在于在虚拟实例的计算节点对虚拟实例的入流量和出流量进行镜像,得到镜像流量,以及可以获取所构建的针对镜像流量的流量流表,并根据镜像流量和流量流表生成镜像流量报文,向目的终端发送镜像流量报文,以便目的终端能够根据镜像流量报文区分端口的入出镜像流量。通过实现虚拟实例的入流量和出流量分别进行镜像,基于设计到报文中的相关信息区分流量方向,让用户可以更精确灵活的对云上实例进行流量镜像,且流量镜像过程在虚拟实例所在的计算节点完成,极大节省数据中心的网络带宽资源,以及不影响用户虚拟实例的主流程,用户镜像后的流量可以通过配置分发到任意一个指定的终端节点(只要三层网络可达),在占用数据中心最少的情况下实现对虚拟实例的流量的镜像,向指定终端节点进行的镜像发送,以及在终端节点对镜像流量进行的区分。进一步地,流量镜像网关根据路由转发表将镜像流量报文基于UDP封装双层Tunnel报文发送到目的终端节点,通过根据计算节点发送出的镜像流量报文特性,设计镜像网关上的路由转发表,实现对镜像报文的高速处理。此外,还可以基于用户配置的流量过滤器过滤策略也在计算节点完成,在源端将不需要的流量过滤出来,过滤器策略支持接受及丢弃操作。The core idea of the embodiment of the present application is to mirror the inbound and outbound traffic of the virtual instance at the computing node of the virtual instance to obtain the mirrored traffic, and to obtain the traffic flow table constructed for the mirrored traffic, and to generate the mirrored traffic message according to the mirrored traffic and the traffic flow table, and to send the mirrored traffic message to the destination terminal, so that the destination terminal can distinguish the inbound and outbound mirrored traffic of the port according to the mirrored traffic message. By implementing the mirroring of the inbound and outbound traffic of the virtual instance respectively, distinguishing the traffic direction based on the relevant information designed into the message, the user can more accurately and flexibly mirror the traffic of the cloud instance, and the traffic mirroring process is completed at the computing node where the virtual instance is located, which greatly saves the network bandwidth resources of the data center, and does not affect the main process of the user's virtual instance. The user's mirrored traffic can be distributed to any designated terminal node (as long as the three-layer network is reachable) through configuration, and the traffic of the virtual instance is mirrored while occupying the least data center, and the mirrored traffic is sent to the designated terminal node, and the mirrored traffic is distinguished at the terminal node. Furthermore, the traffic mirroring gateway sends the mirrored traffic message to the destination terminal node based on the UDP encapsulated double-layer tunnel message according to the routing forwarding table. By designing the routing forwarding table on the mirroring gateway according to the characteristics of the mirrored traffic message sent by the computing node, high-speed processing of the mirrored message is achieved. In addition, the filtering strategy of the traffic filter configured by the user can also be completed on the computing node to filter out the unnecessary traffic at the source end. The filter strategy supports accepting and discarding operations.
参照图1,示出了本申请的一种虚拟实例的流量镜像方法实施例的步骤流程图,应用于虚拟机平台,虚拟机平台包含虚拟实例的计算节点,具体可以包括如下步骤:1, a flowchart of a method for traffic mirroring of a virtual instance of the present application is shown, which is applied to a virtual machine platform, and the virtual machine platform includes a computing node of a virtual instance, and specifically may include the following steps:
步骤101,获取虚拟实例的待镜像流量,虚拟实例的待镜像流量包括入流量和/或出流量;Step 101, obtaining the traffic to be mirrored of the virtual instance, where the traffic to be mirrored of the virtual instance includes inbound traffic and/or outbound traffic;
流量镜像,可以指的是为了流量监控等目的,将待监控端口的流量复制至特定的监控端口的过程,具体可以表现为将虚拟实例的流量复制到目的终端的过程。Traffic mirroring refers to the process of copying the traffic of a monitored port to a specific monitoring port for the purpose of traffic monitoring. Specifically, it can be manifested as the process of copying the traffic of a virtual instance to a destination terminal.
在本申请实施例中,可以通过对计算节点的流量的设计编排,以及通过在计算节点实现对待镜像流量的镜像以及镜像流量报文的生成,将虚拟实例镜像流量的方向设计到报文中,通过报文携带方式从计算节点发送出去,在占用数据中心最少的
情况下实现对虚拟实例的流量的镜像,向指定终端节点进行的镜像发送,以及在终端节点所进行的对镜像流量的区分。In the embodiment of the present application, the direction of the virtual instance mirror traffic can be designed into the message by designing and arranging the traffic of the computing node, and by implementing the mirroring of the mirror traffic and the generation of the mirror traffic message at the computing node, and the message is sent from the computing node through the message carrying method, so as to occupy the least space in the data center. In this case, the traffic of the virtual instance can be mirrored, the mirrored traffic can be sent to the specified terminal node, and the mirrored traffic can be distinguished at the terminal node.
在本申请的一种实施例中,为了实现对虚拟实例的流量镜像,首先可以对虚拟实例的待镜像流量进行获取,所获取的虚拟实例的待镜像流量可以包括该虚拟实例的入流量和/或出流量。示例性地,虚拟实例的入流量可以指的是访问流量或者请求流量等,出流量可以指的是响应流量以及所请求的数据、信息等,本申请实施例对此不加以限制。In one embodiment of the present application, in order to implement traffic mirroring of a virtual instance, the traffic to be mirrored of the virtual instance may first be acquired, and the acquired traffic to be mirrored of the virtual instance may include the inbound traffic and/or outbound traffic of the virtual instance. Exemplarily, the inbound traffic of the virtual instance may refer to access traffic or request traffic, etc., and the outbound traffic may refer to response traffic and requested data, information, etc., which is not limited in the embodiments of the present application.
步骤102,在虚拟实例的计算节点对虚拟实例的入流量和出流量进行镜像,得到镜像流量;Step 102, mirroring the inbound and outbound traffic of the virtual instance at the computing node of the virtual instance to obtain mirrored traffic;
此时可以在虚拟实例的计算节点,分别对虚拟实例的入流量和出流量进行镜像,得到针对入流量的镜像流量和针对出流量的镜像流量,流量镜像过程在虚拟实例所在的计算节点完成,计算节点可以指的是宿主节点,以节省数据中心的网络带宽资源。At this time, the incoming and outgoing traffic of the virtual instance can be mirrored on the computing node of the virtual instance to obtain mirrored traffic for the incoming traffic and mirrored traffic for the outgoing traffic. The traffic mirroring process is completed on the computing node where the virtual instance is located. The computing node can refer to the host node to save network bandwidth resources in the data center.
其中,通过实现虚拟实例的入流量和出流量分别进行镜像,区分流量方向,让用户可以更精确灵活地对云上实例进行流量镜像。Among them, by mirroring the inbound and outbound traffic of the virtual instance separately and distinguishing the traffic direction, users can mirror the traffic of the cloud instance more accurately and flexibly.
在本申请的一些实施例中,在计算节点还可以获取用户所配置的流量过滤器过滤策略,基于用户配置的流量过滤器过滤策略,在源端将不需要的流量过滤出来,以便对过滤后的虚拟实例的流量进行镜像。其中,过滤器策略可以支持接受及丢弃操作。In some embodiments of the present application, the computing node may also obtain the traffic filter filtering policy configured by the user, and based on the traffic filter filtering policy configured by the user, filter out the unnecessary traffic at the source end so as to mirror the traffic of the filtered virtual instance. The filter policy may support accept and discard operations.
步骤103,获取所构建的针对镜像流量的流量流表,根据镜像流量和流量流表生成镜像流量报文;Step 103, obtaining the constructed traffic flow table for the mirrored traffic, and generating a mirrored traffic message according to the mirrored traffic and the traffic flow table;
在分别对虚拟实例的入流量和出流量进行流量镜像得到镜像流量后,此时可以获取所构建的针对镜像流量的流量流表,以基于镜像流量和流量流表生成镜像流量报文,便于通过根据计算节点发送出的镜像流量报文特性,设计镜像网关上的路由转发表,实现对镜像报文的高速处理。After the inbound and outbound traffic of the virtual instance are mirrored to obtain the mirrored traffic, the traffic flow table constructed for the mirrored traffic can be obtained to generate mirrored traffic packets based on the mirrored traffic and the traffic flow table, so as to design the routing forwarding table on the mirrored gateway according to the characteristics of the mirrored traffic packets sent by the computing nodes, so as to realize high-speed processing of the mirrored packets.
具体地,所获取的针对镜像流量的流量流表,主要是通过获取所配置的流量镜像信息,然后采用流量镜像信息构建针对镜像流量的流量流表实现,以对计算节点Open vSwitch的流量进行设计编排,优化网桥上的流表。Specifically, the traffic flow table for the mirrored traffic is obtained mainly by obtaining the configured traffic mirroring information, and then using the traffic mirroring information to construct the traffic flow table for the mirrored traffic, so as to design and arrange the traffic of the computing node Open vSwitch and optimize the flow table on the bridge.
其中,流量镜像信息至少包括流量镜像实例信息、终端节点信息、流量方向信息、流量过滤策略信息以及用户自定义标签信息等,以基于用户配置的流量镜像实例信息、流量方向信息、终端节点信息、流量过滤策略信息以及用户自定义标签信息(例如流量区分标签,镜像后截取的数据包长等)来将用户虚拟实例的网络流量镜像到指定的终端节点,便于后续不同虚拟实例的镜像的流量能够在同一终端节点(如果不同虚拟实例的终端节点信息配置为同一个)根据用户自定义标签信息进行区分,使得虚拟实例的流量报文五元组相同。即可以将前述流量镜像的相关信息设计到报文中,以便后续可以在计算节点按照报文携带的方式实现对这些相关信息的发送。The traffic mirroring information at least includes traffic mirroring instance information, terminal node information, traffic direction information, traffic filtering policy information, and user-defined label information, etc., so as to mirror the network traffic of the user virtual instance to the designated terminal node based on the traffic mirroring instance information, traffic direction information, terminal node information, traffic filtering policy information, and user-defined label information (such as traffic differentiation label, length of data packet intercepted after mirroring, etc.) configured by the user, so that the traffic of the mirrors of different virtual instances can be distinguished at the same terminal node (if the terminal node information of different virtual instances is configured as the same) according to the user-defined label information, so that the traffic message quintuple of the virtual instance is the same. That is, the relevant information of the aforementioned traffic mirroring can be designed into the message, so that the relevant information can be sent to the computing node in the form of message carrying.
在实际应用中,由于镜像流量包括针对入流量的入镜像流量和针对出流量的出镜像流量,此时可以采用流量镜像实例信息、流量方向信息、终端节点信息、流量
过滤策略信息以及用户自定义标签信息,分别构建针对入镜像流量的入流量流表,以及针对出镜像流量的出流量流表。In actual applications, since the mirrored traffic includes inbound mirrored traffic for inbound traffic and outbound mirrored traffic for outbound traffic, traffic mirroring instance information, traffic direction information, terminal node information, and traffic The filtering policy information and the user-defined label information are used to construct an inbound flow table for inbound mirrored traffic and an outbound flow table for outbound mirrored traffic.
具体地,参照图2,示出了本申请实施例提供的对虚拟实例的出流量流表的构建示意图,主要可以表现为在正常编排的流表Pipeline中再次添加三个table,table指的用于存储流表项的表。需要说明的是,table id可以根据实际情况进行确定,本申请实施例对此不加以限制。Specifically, referring to FIG. 2, a schematic diagram of constructing an outbound flow table for a virtual instance provided by an embodiment of the present application is shown, which can be mainly manifested as adding three tables again in the normally arranged flow table Pipeline, where table refers to a table for storing flow table entries. It should be noted that the table id can be determined according to actual conditions, and the embodiment of the present application does not limit this.
正常编排的流表Pipeline中,原先可以包含假设为table0、table6、tableIn a normal orchestration flow table Pipeline, it can originally contain table0, table6, table
10等的table表,此时可以添加假设为table7,table8,table180的table表。其中,table0、table6、table10等的table表可以进行正常的流表处理流程,table=6功能可以为添加处理镜像的端口,对于新添加的三个table,table=7功能可以为处理镜像过滤策略,table=8功能可以为处理流量镜像方向,table=180功能可以为将镜像后的流量基于UDP协议封装VXLAN发送出去,以封装VXLAN出计算节点,送达镜像网关节点。10 and other tables, at this time, you can add tables such as table7, table8, and table180. Among them, table0, table6, table10 and other tables can perform normal flow table processing procedures, table=6 can add ports for processing mirroring, and for the three newly added tables, table=7 can process mirroring filtering policies, table=8 can process traffic mirroring directions, and table=180 can encapsulate the mirrored traffic based on the UDP protocol and send it out to encapsulate VXLAN out of the computing node and deliver it to the mirroring gateway node.
示例性地,具体的出方向各流表的详细设计可以如下所示:For example, the detailed design of each outbound flow table may be as follows:
#reg1为方向,reg2为是否镜像flag(对于reg2具体值的设定,可以基于入方向值为1,出方向值为2的策略进行设定)#reg1 is the direction, reg2 is the flag for whether to mirror (the specific value of reg2 can be set based on the policy that the inbound value is 1 and the outbound value is 2)
#虚拟实例出镜像
table=6,priority=100,in_port={in_port}actions=goto_table:7#Virtual instance mirroring
table=6,priority=100,in_port={in_port}actions=goto_table:7
table=6,priority=100,in_port={in_port}actions=goto_table:7#Virtual instance mirroring
table=6,priority=100,in_port={in_port}actions=goto_table:7
#需要镜像的port过镜像流量filter table,priority优先级设置比正常的流量高,假设对于需要镜像的端口的priority优先级设置为100,不需要过镜像的端口的priority优先级设置为10,此时执行table:7的相关操作,即过镜像流量过程中的功能处理过滤器策略,以便基于流量过滤策略信息在源端将不需要的流量过滤出来,过滤器策略支持接受及丢弃操作
table=6,priority=10,actions=goto_table:10#The port that needs to be mirrored passes the mirrored traffic filter table, and the priority is set higher than the normal traffic. Assume that the priority of the port that needs to be mirrored is set to 100, and the priority of the port that does not need to be mirrored is set to 10. At this time, the relevant operations of table:7 are executed, that is, the function processing filter strategy in the process of mirroring traffic, so as to filter out the unnecessary traffic at the source end based on the traffic filtering strategy information. The filter strategy supports accepting and discarding operations
table=6,priority=10,actions=goto_table:10
table=6,priority=10,actions=goto_table:10#The port that needs to be mirrored passes the mirrored traffic filter table, and the priority is set higher than the normal traffic. Assume that the priority of the port that needs to be mirrored is set to 100, and the priority of the port that does not need to be mirrored is set to 10. At this time, the relevant operations of table:7 are executed, that is, the function processing filter strategy in the process of mirroring traffic, so as to filter out the unnecessary traffic at the source end based on the traffic filtering strategy information. The filter strategy supports accepting and discarding operations
table=6,priority=10,actions=goto_table:10
#默认不需要过镜像流量走正常流量,即此时可以执行table:10的相关操作,进行正常的流表处理流程#By default, normal traffic does not need to be sent through mirror traffic. That is, at this time, you can perform the relevant operations of table:10 and perform normal flow table processing.
#table=7功能处理过滤器策略,基于action设置的reg1标识以确定是否需要镜像,假设0x1为需要镜像,如果关闭该端口的镜像开关,则设置reg1的流表不下发。在过滤过程中,可以基于过滤策略协议的不同进行流量过滤,具体表现如下:
table=7,priority=150,tcp,in_port={in_port},nw_dst=192.168.50.6,tp_dst=80
actions=set_field:0x1->reg1,goto_table:8#table=7 function processing filter strategy, based on the action set reg1 flag to determine whether mirroring is needed, assuming 0x1 needs mirroring, if the mirroring switch of the port is turned off, the flow table of reg1 is set not to be sent. In the filtering process, traffic filtering can be performed based on different filtering strategy protocols, as shown below:
table=7,priority=150,tcp,in_port={in_port},nw_dst=192.168.50.6,tp_dst=80
actions=set_field:0x1->reg1,goto_table:8
table=7,priority=150,tcp,in_port={in_port},nw_dst=192.168.50.6,tp_dst=80
actions=set_field:0x1->reg1,goto_table:8#table=7 function processing filter strategy, based on the action set reg1 flag to determine whether mirroring is needed, assuming 0x1 needs mirroring, if the mirroring switch of the port is turned off, the flow table of reg1 is set not to be sent. In the filtering process, traffic filtering can be performed based on different filtering strategy protocols, as shown below:
table=7,priority=150,tcp,in_port={in_port},nw_dst=192.168.50.6,tp_dst=80
actions=set_field:0x1->reg1,goto_table:8
#假设镜像流量的过滤策略协议为tcp,目的192.168.50.6,端口为80
table=7,priority=140,arp,in_port={in_port},arp_tpa=192.168.50.6actions=set_field:
0x1->reg1,goto_table:8#Assume that the filtering policy protocol of the mirrored traffic is tcp, the destination is 192.168.50.6, and the port is 80
table=7,priority=140,arp,in_port={in_port},arp_tpa=192.168.50.6actions=set_field:
0x1->reg1,goto_table:8
table=7,priority=140,arp,in_port={in_port},arp_tpa=192.168.50.6actions=set_field:
0x1->reg1,goto_table:8#Assume that the filtering policy protocol of the mirrored traffic is tcp, the destination is 192.168.50.6, and the port is 80
table=7,priority=140,arp,in_port={in_port},arp_tpa=192.168.50.6actions=set_field:
0x1->reg1,goto_table:8
#假设镜像流量的过滤策略协议为arp,目的192.168.50.6
table=7,priority=130,icmp,in_port={in_port},nw_dst=192.168.50.6
actions=goto_table:8#Assume that the filtering policy protocol of the mirrored traffic is arp and the destination is 192.168.50.6
table=7,priority=130,icmp,in_port={in_port},nw_dst=192.168.50.6
actions=goto_table:8
table=7,priority=130,icmp,in_port={in_port},nw_dst=192.168.50.6
actions=goto_table:8#Assume that the filtering policy protocol of the mirrored traffic is arp and the destination is 192.168.50.6
table=7,priority=130,icmp,in_port={in_port},nw_dst=192.168.50.6
actions=goto_table:8
#假设镜像流量的过滤策略协议为icmp,目的192.168.50.6
table=7,priority=100,actions=goto_table:8#Assume that the filtering policy protocol of the mirrored traffic is icmp and the destination is 192.168.50.6
table=7,priority=100,actions=goto_table:8
table=7,priority=100,actions=goto_table:8#Assume that the filtering policy protocol of the mirrored traffic is icmp and the destination is 192.168.50.6
table=7,priority=100,actions=goto_table:8
#默认走正常的table#Default is to go to normal table
#table=8功能处理镜像的方向,将match到需要镜像的流量(表现为match reg1=0x1);然后在action中复用寄存器reg1进行设置流量镜像的方向,然后将流量进行镜像,镜像后的流量流转到table=180处理,正常流量继续走table=10
table=8,priority=100,reg1=0x1
actions=set_field:0x2->reg1,resubmit(,10),resubmit(,180)#table=8 functions to process the mirroring direction, matching the traffic to be mirrored (expressed as match reg1=0x1); then reuse register reg1 in action to set the direction of traffic mirroring, and then mirror the traffic. The mirrored traffic flows to table=180 for processing, and normal traffic continues to flow through table=10
table=8,priority=100,reg1=0x1
actions=set_field:0x2->reg1,resubmit(,10),resubmit(,180)
table=8,priority=100,reg1=0x1
actions=set_field:0x2->reg1,resubmit(,10),resubmit(,180)#table=8 functions to process the mirroring direction, matching the traffic to be mirrored (expressed as match reg1=0x1); then reuse register reg1 in action to set the direction of traffic mirroring, and then mirror the traffic. The mirrored traffic flows to table=180 for processing, and normal traffic continues to flow through table=10
table=8,priority=100,reg1=0x1
actions=set_field:0x2->reg1,resubmit(,10),resubmit(,180)
#假设reg1=0x2为出方向。如关闭port的开关,本流量不下发#Assume that reg1=0x2 is the outbound direction. If the port switch is turned off, this traffic will not be sent down.
table=8,priority=10actions=goto_table:10table=8,priority=10actions=goto_table:10
#默认走正常Pipeline流程#Default is to follow the normal Pipeline process
#table=180,通过匹配镜像port的镜像方向,所属虚拟私有云及源物理地址,将port的出方向的镜像流量发送到镜像网关,封装VXLAN隧道发送出去,并将方向信息携带在数据包中(内层源mac的高24比特位)
table=180,priority=200,reg1=0x2,reg5={vni},dl_src={port_src_mac}
actions=set_field:0x4163e->reg2,move:NXM_NX_REG2[0..23]->NXM_OF_ETH_SRC[24..47],set_field:{vni}->tun_id,group:101##出方向
table=180,priority=100,actions=drop#table=180, by matching the mirroring direction of the mirroring port, the virtual private cloud to which it belongs, and the source physical address, the mirrored traffic in the outbound direction of the port is sent to the mirroring gateway, encapsulated in the VXLAN tunnel and sent out, and the direction information is carried in the data packet (the upper 24 bits of the inner source MAC)
table=180, priority=200, reg1=0x2, reg5={vni}, dl_src={port_src_mac}
actions=set_field:0x4163e->reg2,move:NXM_NX_REG2[0..23]->NXM_OF_ETH_SRC[24..47],set_field:{vni}->tun_id,group:101##Outbound direction
table=180,priority=100,actions=drop
table=180,priority=200,reg1=0x2,reg5={vni},dl_src={port_src_mac}
actions=set_field:0x4163e->reg2,move:NXM_NX_REG2[0..23]->NXM_OF_ETH_SRC[24..47],set_field:{vni}->tun_id,group:101##出方向
table=180,priority=100,actions=drop#table=180, by matching the mirroring direction of the mirroring port, the virtual private cloud to which it belongs, and the source physical address, the mirrored traffic in the outbound direction of the port is sent to the mirroring gateway, encapsulated in the VXLAN tunnel and sent out, and the direction information is carried in the data packet (the upper 24 bits of the inner source MAC)
table=180, priority=200, reg1=0x2, reg5={vni}, dl_src={port_src_mac}
actions=set_field:0x4163e->reg2,move:NXM_NX_REG2[0..23]->NXM_OF_ETH_SRC[24..47],set_field:{vni}->tun_id,group:101##Outbound direction
table=180,priority=100,actions=drop
参照图3,示出了本申请实施例提供的虚拟实例的入流量流表的构建示意图,主要表现为在正常编排的流表Pipeline中添加三个table,table指的用于存储流表项的表。需要说明的是,table id可以根据实际情况进行确定,本申请实施例对此不加以限制。Referring to FIG. 3 , a schematic diagram of constructing an inflow flow table of a virtual instance provided in an embodiment of the present application is shown, which is mainly manifested in adding three tables to the normally arranged flow table Pipeline, where table refers to a table for storing flow table entries. It should be noted that the table id can be determined according to actual conditions, and the embodiment of the present application does not limit this.
正常编排的流表Pipeline中,原先可以包含假设为table86、table90等的table表,此时可以添加假设为table87,table88,table180的table表。其中,table86、table90等的table表可以进行正常的流表处理流程,table=86功能可以为添加入镜像的端口,table=90功能可以为流表将流量送到虚拟实例的端口port中,table=87功能可以为处理镜像过滤策略,table=88功能可以为处理流量镜像方向,table=180功能可以为将镜像后的流量基于UDP协议封装VXLAN发送出去,封装VXLAN出计算节点,送达镜像网关节点。In the normally arranged flow table Pipeline, it may originally contain tables such as table86, table90, etc., and at this time, it may add tables such as table87, table88, and table180. Among them, tables such as table86, table90, etc. may perform normal flow table processing procedures, table=86 may be used to add mirrored ports, table=90 may be used to send traffic to the port of the virtual instance, table=87 may be used to process mirrored filtering policies, table=88 may be used to process traffic mirroring directions, and table=180 may be used to encapsulate the mirrored traffic in VXLAN based on the UDP protocol and send it out, encapsulate VXLAN out of the computing node, and deliver it to the mirrored gateway node.
示例性地,具体入方向的各个流表的详细设计可以如下所示:For example, the detailed design of each flow table in the specific inbound direction may be as follows:
#镜像流量入方向
table=86,priority=100,reg7={in_port}actions=goto_table:87#Mirror traffic inbound direction
table=86,priority=100,reg7={in_port}actions=goto_table:87
table=86,priority=100,reg7={in_port}actions=goto_table:87#Mirror traffic inbound direction
table=86,priority=100,reg7={in_port}actions=goto_table:87
#需要镜像的port过入镜像流量filter table,priority优先级设置比正常的流量高,假设对于需要镜像的端口的priority优先级设置为100,不需要经过镜像的端口的priority优先级设置为10,此时执行table:87的相关操作,即过镜像流量过程中的功能处理过滤器策略,以便基于流量过滤策略信息在源端将不需要的流量过滤出来,过滤器策略支持接受及丢弃操作
table=86,priority=10,actions=goto_table:90 #The port that needs to be mirrored passes through the mirror traffic filter table, and the priority is set higher than the normal traffic. Assume that the priority of the port that needs to be mirrored is set to 100, and the priority of the port that does not need to be mirrored is set to 10. At this time, the relevant operations of table:87 are executed, that is, the function processing filter strategy during the mirror traffic process, so that the unnecessary traffic can be filtered out at the source end based on the traffic filtering strategy information. The filter strategy supports accepting and discarding operations
table=86,priority=10,actions=goto_table:90
table=86,priority=10,actions=goto_table:90 #The port that needs to be mirrored passes through the mirror traffic filter table, and the priority is set higher than the normal traffic. Assume that the priority of the port that needs to be mirrored is set to 100, and the priority of the port that does not need to be mirrored is set to 10. At this time, the relevant operations of table:87 are executed, that is, the function processing filter strategy during the mirror traffic process, so that the unnecessary traffic can be filtered out at the source end based on the traffic filtering strategy information. The filter strategy supports accepting and discarding operations
table=86,priority=10,actions=goto_table:90
#不需要镜像的直接走正常流程,即此时可以执行table:90的相关操作,进行正常的流表处理流程
table=87,priority=150,tcp,reg7={in_port},nw_dst=192.168.50.6,tp_dst=80
actions=set_field:0x1->reg1,goto_table:88#No need to mirror, just follow the normal process, that is, you can execute the related operations of table:90 at this time and perform the normal flow table processing process
table=87,priority=150,tcp,reg7={in_port},nw_dst=192.168.50.6,tp_dst=80
actions=set_field:0x1->reg1,goto_table:88
table=87,priority=150,tcp,reg7={in_port},nw_dst=192.168.50.6,tp_dst=80
actions=set_field:0x1->reg1,goto_table:88#No need to mirror, just follow the normal process, that is, you can execute the related operations of table:90 at this time and perform the normal flow table processing process
table=87,priority=150,tcp,reg7={in_port},nw_dst=192.168.50.6,tp_dst=80
actions=set_field:0x1->reg1,goto_table:88
#根据过滤器策略过滤出需要镜像的流量
table=87,priority=140,arp,reg7={in_port},arp_tpa=192.168.50.6
actions=set_field:0x1->reg1,goto_table:88#Filter the traffic that needs to be mirrored according to the filter policy
table=87,priority=140,arp,reg7={in_port},arp_tpa=192.168.50.6
actions=set_field:0x1->reg1,goto_table:88
table=87,priority=140,arp,reg7={in_port},arp_tpa=192.168.50.6
actions=set_field:0x1->reg1,goto_table:88#Filter the traffic that needs to be mirrored according to the filter policy
table=87,priority=140,arp,reg7={in_port},arp_tpa=192.168.50.6
actions=set_field:0x1->reg1,goto_table:88
#根据过滤器策略过滤出需要镜像的流量
table=87,priority=130,icmp,reg7={in_port},nw_dst=192.168.50.6
actions=goto_table:88#Filter the traffic that needs to be mirrored according to the filter policy
table=87,priority=130,icmp,reg7={in_port},nw_dst=192.168.50.6
actions=goto_table:88
table=87,priority=130,icmp,reg7={in_port},nw_dst=192.168.50.6
actions=goto_table:88#Filter the traffic that needs to be mirrored according to the filter policy
table=87,priority=130,icmp,reg7={in_port},nw_dst=192.168.50.6
actions=goto_table:88
#根据过滤器策略过滤出不需要镜像的流量,不设置reg1
table=87,priority=100,actions=goto_table:88#Filter out traffic that does not need to be mirrored according to the filter policy, and do not set reg1
table=87,priority=100,actions=goto_table:88
table=87,priority=100,actions=goto_table:88#Filter out traffic that does not need to be mirrored according to the filter policy, and do not set reg1
table=87,priority=100,actions=goto_table:88
#不符合过滤策略的流量默认跳到table88
table=88,priority=100,reg1=0x1
actions=set_field:0x1->reg1,resubmit(,90),resubmit(,180)# Traffic that does not meet the filtering policy will jump to table88 by default
table=88,priority=100,reg1=0x1
actions=set_field:0x1->reg1,resubmit(,90),resubmit(,180)
table=88,priority=100,reg1=0x1
actions=set_field:0x1->reg1,resubmit(,90),resubmit(,180)# Traffic that does not meet the filtering policy will jump to table88 by default
table=88,priority=100,reg1=0x1
actions=set_field:0x1->reg1,resubmit(,90),resubmit(,180)
#将符合过滤策略的流量进行镜像,设置流量镜像方向。ox1代表入方向
table=88,priority=10actions=goto_table:90#Mirror the traffic that meets the filtering policy and set the traffic mirroring direction. ox1 represents the inbound direction
table=88,priority=10actions=goto_table:90
table=88,priority=10actions=goto_table:90#Mirror the traffic that meets the filtering policy and set the traffic mirroring direction. ox1 represents the inbound direction
table=88,priority=10actions=goto_table:90
##默认走正常流程##Default to normal process
#table=180通过匹配镜像port的镜像方向,所属虚拟私有云及目的物理地址,将port的入方向的镜像流量发送到镜像网关,封装VXLAN隧道发送出去,并将方向信息携带在数据包中#table=180 matches the mirroring direction of the mirrored port, the virtual private cloud to which it belongs, and the destination physical address, sends the mirrored traffic in the port's inbound direction to the mirrored gateway, encapsulates it through a VXLAN tunnel, and sends it out, carrying the direction information in the data packet.
table=180,priority=200,reg1=0x1,reg5={vni},dl_dst={port_dst_mac}actions=set_field:0x2163e->reg2,move:NXM_NX_REG2[0..23]->NXM_OF_ETH_SRC[24..47],set_field:{vni}->tun_id,group:101#入方向
table=180,priority=100,actions=droptable=180, priority=200, reg1=0x1, reg5={vni}, dl_dst={port_dst_mac}actions=set_field:0x2163e->reg2, move:NXM_NX_REG2[0..23]->NXM_OF_ETH_SRC[24..47] ,set_field:{vni}->tun_id,group:101#Inbound direction
table=180,priority=100,actions=drop
table=180,priority=100,actions=droptable=180, priority=200, reg1=0x1, reg5={vni}, dl_dst={port_dst_mac}actions=set_field:0x2163e->reg2, move:NXM_NX_REG2[0..23]->NXM_OF_ETH_SRC[24..47] ,set_field:{vni}->tun_id,group:101#Inbound direction
table=180,priority=100,actions=drop
需要说明的是,上述虚拟实例的出入流量的镜像在镜像点(例如table6和table86)可以基于用户根据实际情况进行选择,一般而言,出流量的镜像点会选择在过完port的Qos限速流表后,过安全组流表之前;入流量的镜像点会选择在过完安全组和port的Qos限速流量之后。以及,对于将镜像流量的方向标记携带到报文的位置及值也可以自由选择,例如在上述示例中可以将方向携带在报文内存的源端的物理地址mac中,出标记值设置为0x4163e,入标记值设置为0x2163e,本申请实施例对此不加以限制。It should be noted that the mirroring of the inbound and outbound traffic of the above virtual instance can be selected based on the user's actual situation at the mirroring point (such as table6 and table86). Generally speaking, the mirroring point of the outbound traffic will be selected after passing the port's Qos speed limit flow table and before passing the security group flow table; the mirroring point of the inbound traffic will be selected after passing the security group and port's Qos speed limit traffic. In addition, the location and value of carrying the direction mark of the mirrored traffic to the message can also be freely selected. For example, in the above example, the direction can be carried in the physical address mac of the source end of the message memory, the outbound mark value is set to 0x4163e, and the inbound mark value is set to 0x2163e. This embodiment of the present application does not limit this.
在本申请的一些实施例中,虚拟实例位于虚拟私有云,虚拟私有云在镜像网关具有所创建的相应的流量镜像网关实例,用于承载不同流量镜像网关实例的镜像网关组包括多个镜像网关节点。示例性地,如图4所示,虚拟实例1(即VM1)和虚拟实例2(即VM2)位于用户VPC1(Virtual Private Cloud,虚拟私有云)中子网2
(即subnet2)中,虚拟实例3(即VM3)位于用户VPC2中的子网1(即subnet1)中,每个VPC均可以在镜像网关上创建一个流量镜像网关实例(例如流量镜像网关实例1mrgw-VPC1、流量镜像网关实例2mrgw-VPC2等),而一个镜像网关组中可以包含多个镜像网关节点来承载不同VPC的流量镜像网关实例,其中不同的镜像网关节点可以通过基于多台物理服务器作为节点实现。In some embodiments of the present application, the virtual instance is located in a virtual private cloud, the virtual private cloud has a corresponding traffic mirror gateway instance created in the mirror gateway, and the mirror gateway group for carrying different traffic mirror gateway instances includes multiple mirror gateway nodes. For example, as shown in FIG4, virtual instance 1 (i.e., VM1) and virtual instance 2 (i.e., VM2) are located in subnet 2 of user VPC1 (Virtual Private Cloud). (i.e., subnet2), virtual instance 3 (i.e., VM3) is located in subnet 1 (i.e., subnet1) in user VPC2, and each VPC can create a traffic mirroring gateway instance on the mirroring gateway (for example, traffic mirroring gateway instance 1mrgw-VPC1, traffic mirroring gateway instance 2mrgw-VPC2, etc.), and a mirroring gateway group can contain multiple mirroring gateway nodes to carry traffic mirroring gateway instances of different VPCs, where different mirroring gateway nodes can be implemented based on multiple physical servers as nodes.
在生成镜像流量报文时,可以在虚拟实例的计算节点构建得到镜像流量后,通过镜像网关组的镜像网关节点接收镜像流量和流量流表,然后通过采用镜像流量和流量流表生成镜像流量报文实现。在具体实现中,还可以通过镜像网关节点获取路由转发表,并根据路由转发表和流量流表对镜像流量报文进行报文处理,生成镜像流量包。When generating a mirrored traffic message, after the computing node of the virtual instance constructs the mirrored traffic, the mirrored traffic and the traffic flow table can be received through the mirrored gateway node of the mirrored gateway group, and then the mirrored traffic message is generated by using the mirrored traffic and the traffic flow table. In a specific implementation, the routing forwarding table can also be obtained through the mirrored gateway node, and the mirrored traffic message is processed according to the routing forwarding table and the traffic flow table to generate a mirrored traffic packet.
在实际应用中,当虚拟实例的镜像流量从计算节点发出后,可以发送到镜像网关组中的镜像网关节点,例如host,目的IP地址可以是镜像网关组的anycast IP地址,当流量到达镜像网关的镜像网关节点host后,镜像网关节点host上的转发程序将会根据路由转发表对报文处理。In actual applications, when the mirror traffic of the virtual instance is sent from the computing node, it can be sent to the mirror gateway node in the mirror gateway group, such as the host. The destination IP address can be the anycast IP address of the mirror gateway group. When the traffic reaches the mirror gateway node host of the mirror gateway, the forwarding program on the mirror gateway node host will process the message according to the routing forwarding table.
具体的报文处理过程可以表现为获取流量流表的流量镜像信息,以及获取路由转发表的路由转发信息,然后响应流量流表的流量镜像信息分别与路由转发信息匹配成功,采用路由转发信息对镜像流量报文进行封装,得到镜像流量包。The specific message processing process can be manifested as obtaining the traffic mirroring information of the traffic flow table and obtaining the routing forwarding information of the routing forwarding table, and then responding to the successful matching of the traffic mirroring information of the traffic flow table with the routing forwarding information, and using the routing forwarding information to encapsulate the mirrored traffic message to obtain a mirrored traffic packet.
路由转发表可以基于匹配域的路由转发信息,以及基于动作域的路由转发信息得到。其中,匹配域的路由转发信息主要用于与流量流表的流量镜像信息进行匹配,动作域的路由转发信息主要用于在匹配成功的情况下,实现的报文发送操作。The routing forwarding table can be obtained based on the routing forwarding information of the matching domain and the routing forwarding information of the action domain. Among them, the routing forwarding information of the matching domain is mainly used to match the traffic mirroring information of the traffic flow table, and the routing forwarding information of the action domain is mainly used to implement the message sending operation when the match is successful.
匹配域的路由转发信息可以包括Vni(Vni可以是一种类似于VLAN ID的用于标识Virtual Network Instance虚拟网络实例的用户标识)、流量方向、端口物理地址portmac信息,此时可以根据报文的Vni、流量方向、portmac信息与路由转发表中的Vni、流量方向、portmac信息进行匹配,如果匹配不成功进行丢弃处理,此时若数据报文命中路由转发表后,则可以根据路由转发表的路由转发信息进行转发处理,并对镜像流量报文进行封装发送出去。The routing forwarding information of the matching domain may include Vni (Vni can be a user ID similar to VLAN ID for identifying a Virtual Network Instance), traffic direction, port physical address portmac information. At this time, the Vni, traffic direction, and portmac information of the message can be matched with the Vni, traffic direction, and portmac information in the routing forwarding table. If the match is unsuccessful, the message will be discarded. At this time, if the data message hits the routing forwarding table, it can be forwarded according to the routing forwarding information of the routing forwarding table, and the mirrored traffic message can be encapsulated and sent out.
示例性地,路由转发表可以如下表1所示:
For example, the routing table may be as shown in Table 1 below:
For example, the routing table may be as shown in Table 1 below:
表1Table 1
匹配域的路由转发信息可以包括内部目的物理地址InnerDstMac、内部源物理地址InnerSrcMac、内部源逻辑地址innerSrcIp、内部目的逻辑地址innerDstIp、内部虚拟网络实例标识InnerVni、外部目的逻辑地址OuterDstIp以及外部网络实例标识OuterVni,在基于路由转发表进行报文转发时,主要可以表现为根据动作域的InnerDstMac、InnerSrcMac、innerSrcIp、innerDstIp、InnerVni封装中间层VXLAN信
息,然后根据OuterDstIp和OuterVni在封装最外层的VXLAN信息将报文从流量镜像网关发送到镜像终端节点。其中InnerVni可通过用户自行定义,用于在镜像终端节点进行流量区分。The routing forwarding information of the matching domain may include the internal destination physical address InnerDstMac, the internal source physical address InnerSrcMac, the internal source logical address innerSrcIp, the internal destination logical address innerDstIp, the internal virtual network instance identifier InnerVni, the external destination logical address OuterDstIp and the external network instance identifier OuterVni. When forwarding messages based on the routing forwarding table, it can be mainly manifested as encapsulating the intermediate layer VXLAN information according to the InnerDstMac, InnerSrcMac, innerSrcIp, innerDstIp, and InnerVni of the action domain. Then, according to the VXLAN information in the outermost layer of the OuterDstIp and OuterVni encapsulation, the message is sent from the traffic mirroring gateway to the mirroring terminal node. InnerVni can be defined by the user and is used to distinguish traffic at the mirroring terminal node.
步骤104,向目的终端发送镜像流量报文,以便目的终端根据镜像流量报文区分端口的入出镜像流量。Step 104: Send the mirrored traffic message to the destination terminal so that the destination terminal can distinguish the inbound and outbound mirrored traffic of the port according to the mirrored traffic message.
在向目的终端发送镜像流量报文时,可以表现为通过镜像网关获取路由转发表并获取路由转发表的目的网关地址,然后基于目的网关地址确定将目的终端的目的终端节点,并向目的终端节点发送镜像流量报文,即流量镜像网关能够根据路由转发表将镜像流量报文基于UDP封装双层Tunnel报文发送到目的终端节点。When sending a mirrored traffic message to a destination terminal, it can be manifested as obtaining a routing forwarding table and a destination gateway address of the routing forwarding table through a mirrored gateway, and then determining the destination terminal node of the destination terminal based on the destination gateway address, and sending the mirrored traffic message to the destination terminal node, that is, the traffic mirroring gateway can send the mirrored traffic message to the destination terminal node based on a UDP encapsulated double-layer tunnel message according to the routing forwarding table.
在本申请的一些实施例中,在生成镜像流量报文之前,将会接收用户目的终端发送的访问请求,目的终端可以是在预设虚拟私有云中预设虚拟实例。其中,访问请求包括所要访问的虚拟实例,虚拟实例在镜像网关具有所创建的相应的流量镜像网关实例。In some embodiments of the present application, before generating the mirrored traffic message, an access request sent by a user's destination terminal will be received, and the destination terminal may be a virtual instance preset in a preset virtual private cloud. The access request includes the virtual instance to be accessed, and the virtual instance has a corresponding traffic mirroring gateway instance created in the mirroring gateway.
在向目的终端节点发送镜像流量报文时,还可以表现为获取所要访问的流量镜像网关实例当前所在的虚拟实例,向所要访问的流量镜像网关实例当前所在的虚拟实例,所对应的流量镜像网关实例转发路由转发表,以便基于所对应的流量镜像网关实例基于路由转发表将镜像流量报文转发至目的终端节点。When sending a mirrored traffic message to a destination terminal node, it can also be manifested as obtaining the virtual instance where the traffic mirroring gateway instance to be accessed is currently located, and forwarding the routing forwarding table of the traffic mirroring gateway instance corresponding to the virtual instance where the traffic mirroring gateway instance to be accessed is currently located, so as to forward the mirrored traffic message to the destination terminal node based on the routing forwarding table of the corresponding traffic mirroring gateway instance.
在实际应用中,向目的终端发送镜像流量报文,目的终端能够基于镜像流量报文中所携带发送的相关信息对镜像流量进行区分,此相关信息为与镜像流量的相关信息,至少包括流量镜像实例信息、终端节点信息、流量方向信息、流量过滤策略信息以及用户自定义标签信息等,此时可以基于流量流表中的流量方向信息和/或流量镜像实例信息对镜像流量进行区分。具体可以表现为基于镜像流量包所携带的流量方向信息,区分镜像流量的入镜像流量和出镜像流量,对入流量和出流量进行分析;和/或基于镜像流量包的流量镜像实例信息和流量方向区分与流量镜像实例信息相应虚拟实例的入镜像流量和出镜像流量,对与流量镜像实例信息相应虚拟实例的入流量和出流量进行分析;和/或基于镜像流量包的流量镜像实例信息区分与不同流量镜像实例信息相应虚拟实例的镜像流量,对不同虚拟实例的镜像流量进行分析。In actual applications, a mirrored traffic message is sent to a destination terminal, and the destination terminal can distinguish the mirrored traffic based on the relevant information carried and sent in the mirrored traffic message. The relevant information is related to the mirrored traffic, and includes at least traffic mirroring instance information, terminal node information, traffic direction information, traffic filtering policy information, and user-defined label information, etc. At this time, the mirrored traffic can be distinguished based on the traffic direction information and/or traffic mirroring instance information in the traffic flow table. Specifically, it can be manifested as distinguishing the incoming mirrored traffic and outgoing mirrored traffic of the mirrored traffic based on the traffic direction information carried by the mirrored traffic packet, and analyzing the incoming traffic and outgoing traffic; and/or distinguishing the incoming mirrored traffic and outgoing mirrored traffic of the virtual instance corresponding to the traffic mirroring instance information based on the traffic mirroring instance information and traffic direction of the mirrored traffic packet, and analyzing the incoming traffic and outgoing traffic of the virtual instance corresponding to the traffic mirroring instance information; and/or distinguishing the mirrored traffic of virtual instances corresponding to different traffic mirroring instance information based on the traffic mirroring instance information of the mirrored traffic packet, and analyzing the mirrored traffic of different virtual instances.
在本申请实施例中,在虚拟实例的计算节点对虚拟实例的入流量和出流量进行镜像,得到镜像流量,以及可以获取所构建的针对镜像流量的流量流表,并根据镜像流量和流量流表生成镜像流量报文,向目的终端发送镜像流量报文,以便目的终端能够根据镜像流量报文区分端口的入出镜像流量。通过对计算节点的流量的设计编排,以及通过在计算节点实现对待镜像流量的镜像以及镜像流量报文的生成,将虚拟实例镜像流量的相关信息设计到报文中,通过报文携带方式从计算节点发送出去,在占用数据中心最少的情况下实现对虚拟实例的流量的镜像,向指定终端节点进行的镜像发送,以及在终端节点对镜像流量进行的区分。进一步地,还可以通过根据计算节点发送出的镜像流量报文特性,设计镜像网关上的路由转发表,实现对镜像报文的高速处理。In an embodiment of the present application, the inbound and outbound traffic of the virtual instance is mirrored at the computing node of the virtual instance to obtain the mirrored traffic, and the traffic flow table constructed for the mirrored traffic can be obtained, and the mirrored traffic message is generated according to the mirrored traffic and the traffic flow table, and the mirrored traffic message is sent to the destination terminal, so that the destination terminal can distinguish the inbound and outbound mirrored traffic of the port according to the mirrored traffic message. By designing and arranging the traffic of the computing node, and by implementing the mirroring of the mirrored traffic and the generation of the mirrored traffic message at the computing node, the relevant information of the virtual instance mirrored traffic is designed into the message, and sent from the computing node through the message carrying method, the mirroring of the traffic of the virtual instance is realized while occupying the least data center, the mirrored sending to the designated terminal node, and the differentiation of the mirrored traffic at the terminal node. Furthermore, the routing forwarding table on the mirrored gateway can be designed according to the characteristics of the mirrored traffic message sent by the computing node to realize high-speed processing of the mirrored message.
参照图5,示出了本申请的另一种虚拟实例的流量镜像方法实施例的步骤流程
图,应用于虚拟机平台,虚拟机平台包含虚拟实例的计算节点,具体可以包括如下步骤:5, there is shown a flow chart of another embodiment of a traffic mirroring method for a virtual instance of the present invention. FIG. 1 is applied to a virtual machine platform, where the virtual machine platform includes a computing node of a virtual instance, and specifically may include the following steps:
步骤501,接收虚拟实例的计算节点发送的镜像流量报文;Step 501, receiving a mirrored traffic message sent by a computing node of a virtual instance;
流量镜像,可以指的是为了流量监控等目的,将待监控端口的流量复制至特定的监控端口的过程,具体可以表现为将虚拟实例的流量复制到目的终端的过程。Traffic mirroring refers to the process of copying the traffic of a monitored port to a specific monitoring port for the purpose of traffic monitoring. Specifically, it can be manifested as the process of copying the traffic of a virtual instance to a destination terminal.
在本申请实施例中,可以通过对计算节点的流量的设计编排,以及通过在计算节点实现对待镜像流量的镜像以及镜像流量报文的生成,将虚拟实例镜像流量的相关信息设计到报文中,通过报文携带方式从计算节点发送出去,在占用数据中心最少的情况下实现对虚拟实例的流量的镜像,向指定终端节点进行的镜像发送,以及实现在终端节点对镜像流量进行的区分。In an embodiment of the present application, by designing and arranging the traffic of the computing nodes, and by implementing mirroring of the mirrored traffic and generation of mirrored traffic messages at the computing nodes, relevant information of the virtual instance mirrored traffic can be designed into the message, and sent from the computing nodes through message carrying, thereby implementing mirroring of the traffic of the virtual instance with minimal occupation of the data center, mirroring transmission to the designated terminal node, and differentiation of the mirrored traffic at the terminal node.
在本申请的一种实施例中,目的终端可以接收虚拟实例的计算节点发送的镜像流量报文,以便根据镜像流量报文区分端口的入出镜像流量,例如基于所携带的流量流表中包含的流量方向信息区分镜像流量。In one embodiment of the present application, the destination terminal can receive the mirrored traffic message sent by the computing node of the virtual instance, so as to distinguish the inbound and outbound mirrored traffic of the port according to the mirrored traffic message, for example, distinguish the mirrored traffic based on the traffic direction information contained in the carried traffic flow table.
具体地,所接收的镜像流量报文可以基于镜像流量和流量流表生成,其中,镜像流量基于对虚拟实例的入流量和出流量进行镜像得到。Specifically, the received mirrored traffic message may be generated based on the mirrored traffic and the traffic flow table, wherein the mirrored traffic is obtained based on mirroring the inbound traffic and the outbound traffic of the virtual instance.
流量镜像信息至少包括流量镜像实例信息、终端节点信息、流量方向信息、流量过滤策略信息以及用户自定义标签信息等,以基于用户配置的流量镜像实例信息、流量方向信息、终端节点信息、流量过滤策略信息以及用户自定义标签信息(例如流量区分标签,镜像后截取的数据包长等)来将用户虚拟实例的网络流量镜像到指定的终端节点,便于后续不同虚拟实例的镜像的流量能够在同一终端节点(如果不同虚拟实例的终端节点信息配置为同一个)根据用户自定义标签信息进行区分,即使得虚拟实例的流量报文五元组相同。以及还可以通过实现虚拟实例的入流量和出流量分别进行镜像,区分流量方向,让用户可以更精确灵活地对云上实例进行流量镜像。Traffic mirroring information at least includes traffic mirroring instance information, terminal node information, traffic direction information, traffic filtering policy information, and user-defined label information, etc., to mirror the network traffic of the user's virtual instance to the specified terminal node based on the user-configured traffic mirroring instance information, traffic direction information, terminal node information, traffic filtering policy information, and user-defined label information (such as traffic differentiation label, length of data packet intercepted after mirroring, etc.), so that the traffic of subsequent mirrors of different virtual instances can be distinguished at the same terminal node (if the terminal node information of different virtual instances is configured as the same) according to the user-defined label information, that is, the traffic message quintuple of the virtual instance is the same. It is also possible to mirror the inbound and outbound traffic of the virtual instance separately and distinguish the traffic direction, so that users can more accurately and flexibly mirror the traffic of cloud instances.
步骤502,根据镜像流量报文区分端口的入出镜像流量。Step 502: Differentiate the inbound and outbound mirrored traffic of the port according to the mirrored traffic message.
在实际应用中,具体可以基于镜像流量报文所携带的流量方向信息区分端口的入出镜像流量,还可以基于镜像流量报文所携带的流量镜像实例信息区分端口的入出镜像流量,以及还可以基于镜像流量报文所携带的流量方向信息和流量镜像实例信息区分端口的入出镜像流量。需要说明的是,所借助的用于区分端口入出镜像流量的相关信息,除了前述信息以外,还可以是报文中其他携带的信息;以及,所借助的用于区分端口入出镜像流量的相关信息,具体可以基于报文中所设计携带的信息确定,本申请实施例对此不加以限制。In practical applications, the inbound and outbound mirrored traffic of a port can be distinguished based on the traffic direction information carried by the mirrored traffic message, the inbound and outbound mirrored traffic of a port can be distinguished based on the traffic mirroring instance information carried by the mirrored traffic message, and the inbound and outbound mirrored traffic of a port can be distinguished based on the traffic direction information and traffic mirroring instance information carried by the mirrored traffic message. It should be noted that the relevant information used to distinguish the inbound and outbound mirrored traffic of a port, in addition to the aforementioned information, can also be other information carried in the message; and the relevant information used to distinguish the inbound and outbound mirrored traffic of a port can be specifically determined based on the information designed to be carried in the message, and the embodiments of the present application do not limit this.
在进行镜像流量区分时,在一种情况下,可以基于镜像流量包的流量方向信息区分镜像流量的入镜像流量和出镜像流量,对入流量和出流量进行分析;在另一种情况下,可以基于镜像流量包的流量镜像实例信息和流量方向区分与流量镜像实例信息相应虚拟实例的入镜像流量和出镜像流量,对与流量镜像实例信息相应虚拟实例的入流量和出流量进行分析;在又一种情况下,还可以基于镜像流量包的流量镜像实例信息区分与不同流量镜像实例信息相应虚拟实例的镜像流量,对不同虚拟实例的镜像流量进行分析。
When distinguishing mirrored traffic, in one case, the incoming mirrored traffic and the outgoing mirrored traffic of the mirrored traffic can be distinguished based on the traffic direction information of the mirrored traffic packet, and the incoming traffic and the outgoing traffic can be analyzed; in another case, the incoming mirrored traffic and the outgoing mirrored traffic of the virtual instance corresponding to the traffic mirrored instance information can be distinguished based on the traffic mirrored instance information and the traffic direction of the mirrored traffic packet, and the incoming traffic and the outgoing traffic of the virtual instance corresponding to the traffic mirrored instance information can be analyzed; in yet another case, the mirrored traffic of the virtual instances corresponding to different traffic mirrored instance information can also be distinguished based on the traffic mirrored instance information of the mirrored traffic packet, and the mirrored traffic of different virtual instances can be analyzed.
在本申请实施例中,通过实现虚拟实例的入流量和出流量分别进行镜像,区分流量方向,让用户可以更精确灵活地对云上实例进行流量镜像,且流量镜像过程在虚拟实例所在的计算节点完成,极大节省数据中心的网络带宽资源,以及不影响用户虚拟实例的主流程,用户镜像后的流量可以通过配置分发到任意一个指定的终端节点(只要三层网络可达),在占用数据中心最少的情况下实现对虚拟实例的流量的镜像,向指定终端节点进行的镜像发送,以及实现在终端节点对镜像流量进行的区分。进一步地,流量镜像网关根据路由转发表将镜像流量报文基于UDP封装双层Tunnel报文发送到目的终端节点,通过根据计算节点发送出的镜像流量报文特性,设计镜像网关上的路由转发表,实现对镜像报文的高速处理。此外,还可以基于用户配置的流量过滤器过滤策略也在计算节点完成,在源端将不需要的流量过滤出来,过滤器策略支持接受及丢弃操作。In the embodiment of the present application, by implementing the mirroring of the inbound and outbound traffic of the virtual instance respectively and distinguishing the traffic direction, the user can more accurately and flexibly mirror the traffic of the cloud instance, and the traffic mirroring process is completed at the computing node where the virtual instance is located, which greatly saves the network bandwidth resources of the data center and does not affect the main process of the user's virtual instance. The traffic after the user's mirroring can be distributed to any designated terminal node (as long as the three-layer network is reachable) through configuration, and the traffic of the virtual instance is mirrored while occupying the least data center, and the mirroring is sent to the designated terminal node, and the mirroring traffic is distinguished at the terminal node. Further, the traffic mirroring gateway sends the mirrored traffic message to the destination terminal node based on the UDP encapsulated double-layer Tunnel message according to the routing forwarding table, and designs the routing forwarding table on the mirroring gateway according to the characteristics of the mirrored traffic message sent by the computing node, so as to realize high-speed processing of the mirrored message. In addition, the filtering strategy of the traffic filter configured by the user can also be completed at the computing node, and the unnecessary traffic is filtered out at the source end, and the filter strategy supports accepting and discarding operations.
参照图6,示出了本申请实施例提供的虚拟实例的流量镜像的应用场景示意图,本申请实施例在公有云中实现了基于UDP协议,具体通过VXLAN Tunnel封装的流量流表Open vSwitch所编排的流量镜像。Referring to Figure 6, a schematic diagram of the application scenario of traffic mirroring of a virtual instance provided in an embodiment of the present application is shown. The embodiment of the present application implements traffic mirroring based on the UDP protocol in a public cloud, specifically through traffic flow table Open vSwitch encapsulated by VXLAN Tunnel.
公有云上待镜像虚拟机实例的逻辑网络分布可以如图4所示,假设虚拟实例1(即VM1)和虚拟实例2(即VM2)位于用户VPC1中子网2(即subnet2)中,虚拟实例3(即VM3)位于用户VPC2中的子网1(即subnet1)中,每个VPC均可以在镜像网关上创建一个流量镜像网关实例(例如mrgw-VPC1、mrgw-VPC2等),而一个镜像网关组中可以包含多个镜像网关节点来承载不同VPC的流量镜像网关实例,其中不同的镜像网关节点可以通过基于多台物理服务器作为节点实现。The logical network distribution of the virtual machine instances to be mirrored on the public cloud can be shown in Figure 4. Assume that virtual instance 1 (i.e. VM1) and virtual instance 2 (i.e. VM2) are located in subnet 2 (i.e. subnet2) in user VPC1, and virtual instance 3 (i.e. VM3) is located in subnet 1 (i.e. subnet1) in user VPC2. Each VPC can create a traffic mirroring gateway instance (such as mrgw-VPC1, mrgw-VPC2, etc.) on the mirroring gateway, and a mirroring gateway group can contain multiple mirroring gateway nodes to carry traffic mirroring gateway instances of different VPCs, where different mirroring gateway nodes can be implemented based on multiple physical servers as nodes.
假设用户对VPC2中subnet1的虚拟实例3(VM3)的入或出流量进行镜像,并配置流量过滤策略,将入或出镜像的流量发送到指定的终端节点VPC1中subnet2中的虚拟实例2(VM2)中,当用户在VPC1中subnet2的虚拟实例1对镜像虚拟实例3(VM3)进行访问时,可以实现数据流量的转发。Assume that the user mirrors the inbound or outbound traffic of virtual instance 3 (VM3) in subnet1 in VPC2, and configures a traffic filtering policy to send the inbound or outbound mirrored traffic to the specified endpoint virtual instance 2 (VM2) in subnet2 in VPC1. When the user accesses the mirrored virtual instance 3 (VM3) from virtual instance 1 in subnet2 in VPC1, data traffic forwarding can be achieved.
具体表现为,如图6所示的虚线1为VM1访问VM3的访问流量,虚线2为VM1访问VM3的响应流量,对VM3而言,此时访问流量可以为入流量,响应流量可以为出流量,用户对VM3配置了入(出)流量的镜像功能,那么将在VM3所在的宿主节点(计算节点2)的Open vSwitch上的br-int网桥上下发相应的编排流表,将入(出)流量镜像出来通过UDP协议发送到镜像网关组的镜像节点上。同时还会在镜像网关组给VPC2的镜像网关实例(即mrgw-VPC2)下发转发路由表,而镜像网关实例根据下发的转发路由表将流量转发到终端节点(即VPC1中虚拟实例VM2)上,以便终端节点能够基于镜像流量报文的流量流表中流量方向信息区分镜像流量。Specifically, as shown in Figure 6, dotted line 1 is the access traffic of VM1 accessing VM3, and dotted line 2 is the response traffic of VM1 accessing VM3. For VM3, the access traffic can be the inbound traffic, and the response traffic can be the outbound traffic. If the user configures the inbound (outbound) traffic mirroring function for VM3, the corresponding orchestration flow table will be sent up and down on the br-int bridge on the Open vSwitch of the host node (compute node 2) where VM3 is located, and the inbound (outbound) traffic will be mirrored and sent to the mirror node of the mirror gateway group through the UDP protocol. At the same time, the mirror gateway group will send a forwarding routing table to the mirror gateway instance of VPC2 (i.e., mrgw-VPC2), and the mirror gateway instance will forward the traffic to the terminal node (i.e., the virtual instance VM2 in VPC1) according to the sent forwarding routing table, so that the terminal node can distinguish the mirror traffic based on the traffic direction information in the traffic flow table of the mirror traffic message.
在本申请实施例中,通过实现虚拟实例的入流量和出流量分别进行镜像,区分流量方向,让用户可以更精确灵活地对云上实例进行流量镜像,且流量镜像过程在虚拟实例所在的计算节点完成,极大节省数据中心的网络带宽资源,以及不影响用户虚拟实例的主流程,用户镜像后的流量可以通过配置分发到任意一个指定的终端节点(只要三层网络可达),在占用数据中心最少的情况下实现对虚拟实例的流量的镜像,向指定终端节点进行的镜像发送,以及实现在终端节点对镜像流量进行的
区分。进一步地,流量镜像网关根据路由转发表将镜像流量报文基于UDP封装双层Tunnel报文发送到目的终端节点,通过根据计算节点发送出的镜像流量报文特性,设计镜像网关上的路由转发表,实现对镜像报文的高速处理。此外,还可以基于用户配置的流量过滤器过滤策略也在计算节点完成,在源端将不需要的流量过滤出来,过滤器策略支持接受及丢弃操作。In the embodiment of the present application, by respectively mirroring the inbound and outbound traffic of the virtual instance and distinguishing the traffic direction, the user can more accurately and flexibly mirror the traffic of the cloud instance, and the traffic mirroring process is completed on the computing node where the virtual instance is located, which greatly saves the network bandwidth resources of the data center and does not affect the main process of the user's virtual instance. The user's mirrored traffic can be distributed to any specified terminal node (as long as the three-layer network is reachable) through configuration, and the traffic of the virtual instance can be mirrored while occupying the least data center, and the mirrored traffic can be sent to the specified terminal node, and the mirrored traffic can be mirrored at the terminal node. Distinguish. Furthermore, the traffic mirroring gateway sends the mirrored traffic message to the destination terminal node based on the UDP encapsulated double-layer tunnel message according to the routing forwarding table. By designing the routing forwarding table on the mirroring gateway according to the characteristics of the mirrored traffic message sent by the computing node, high-speed processing of the mirrored message is achieved. In addition, the filtering strategy based on the user-configured traffic filter is also completed on the computing node to filter out unnecessary traffic at the source end. The filter strategy supports accepting and discarding operations.
需要说明的是,对于方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请实施例并不受所描述的动作顺序的限制,因为依据本申请实施例,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作并不一定是本申请实施例所必须的。It should be noted that, for the method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present application are not limited by the described action sequence, because according to the embodiments of the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present application.
参照图7,示出了本申请的一种虚拟实例的流量镜像装置实施例的结构框图,应用于虚拟机平台,虚拟机平台包含虚拟实例的计算节点,具体可以包括如下模块:7, a block diagram of a flow mirroring device of a virtual instance of the present application is shown, which is applied to a virtual machine platform. The virtual machine platform includes a computing node of a virtual instance, and specifically may include the following modules:
待镜像流量获取模块701,用于获取虚拟实例的待镜像流量,虚拟实例的待镜像流量包括入流量和/或出流量;The to-be-mirrored traffic acquisition module 701 is used to acquire the to-be-mirrored traffic of the virtual instance, where the to-be-mirrored traffic of the virtual instance includes inbound traffic and/or outbound traffic;
流量镜像模块702,用于在虚拟实例的计算节点对虚拟实例的入流量和出流量进行镜像,得到镜像流量;The traffic mirroring module 702 is used to mirror the inbound and outbound traffic of the virtual instance at the computing node of the virtual instance to obtain mirrored traffic;
镜像流量报文生成模块703,用于获取所构建的针对镜像流量的流量流表,根据镜像流量和流量流表生成镜像流量报文;The mirrored traffic message generation module 703 is used to obtain the constructed traffic flow table for the mirrored traffic and generate the mirrored traffic message according to the mirrored traffic and the traffic flow table;
镜像流量报文发送模块704,用于向目的终端发送镜像流量报文,以便目的终端根据镜像流量报文区分端口的入出镜像流量。The mirrored traffic message sending module 704 is used to send the mirrored traffic message to the destination terminal so that the destination terminal can distinguish the inbound and outbound mirrored traffic of the port according to the mirrored traffic message.
在本申请的一种实施例中,本申请实施例提出的装置还可以包括如下模块:In one embodiment of the present application, the device provided in the embodiment of the present application may further include the following modules:
流量流表构建模块,用于获取所配置的流量镜像信息,采用流量镜像信息构建针对镜像流量的流量流表;其中,流量镜像信息至少包括流量方向信息、流量镜像实例信息、终端节点信息、流量过滤策略信息以及用户自定义标签信息。The traffic flow table construction module is used to obtain the configured traffic mirroring information and use the traffic mirroring information to construct a traffic flow table for the mirrored traffic; wherein the traffic mirroring information at least includes traffic direction information, traffic mirroring instance information, terminal node information, traffic filtering policy information and user-defined label information.
在本申请的一种实施例中,镜像流量包括针对入流量的入镜像流量和针对出流量的出镜像流量;流量流表构建模块可以包括如下子模块:In one embodiment of the present application, the mirrored traffic includes inbound mirrored traffic for inbound traffic and outbound mirrored traffic for outbound traffic; the traffic flow table construction module may include the following submodules:
流量流表构建子模块,用于采用流量镜像实例信息、流量方向信息、终端节点信息、流量过滤策略信息以及用户自定义标签信息,分别构建入镜像流量的入流量流表,以及出镜像流量的出流量流表。The traffic flow table construction submodule is used to use traffic mirroring instance information, traffic direction information, terminal node information, traffic filtering policy information and user-defined label information to respectively construct an inbound traffic flow table for incoming mirrored traffic and an outbound traffic flow table for outgoing mirrored traffic.
在本申请的一种实施例中,虚拟实例位于虚拟私有云,虚拟私有云在镜像网关具有所创建的相应的流量镜像网关实例,用于承载不同流量镜像网关实例的镜像网关组包括多个镜像网关节点。In one embodiment of the present application, the virtual instance is located in a virtual private cloud, and the virtual private cloud has a corresponding traffic mirroring gateway instance created in the mirroring gateway. The mirroring gateway group for carrying different traffic mirroring gateway instances includes multiple mirroring gateway nodes.
在本申请的一种实施例中,镜像流量报文生成模块703可以包括如下子模块:In one embodiment of the present application, the mirrored traffic packet generation module 703 may include the following submodules:
镜像流量接收子模块,用于在虚拟实例的计算节点构建得到镜像流量后,通过镜像网关组的镜像网关节点接收镜像流量和流量流表;The mirror traffic receiving submodule is used to receive the mirror traffic and traffic flow table through the mirror gateway node of the mirror gateway group after the computing node of the virtual instance builds the mirror traffic;
镜像流量报文生成子模块,用于采用镜像流量和流量流表生成镜像流量报文。The mirrored traffic message generation submodule is used to generate a mirrored traffic message using the mirrored traffic and the traffic flow table.
在本申请的一种实施例中,镜像流量报文生成模块703还可以包括如下子模块:In one embodiment of the present application, the mirrored traffic message generation module 703 may further include the following submodules:
镜像流量包生成子模块,用于通过镜像网关节点获取路由转发表,并根据路由
转发表和流量流表对镜像流量报文进行报文处理,生成镜像流量包。The mirror traffic packet generation submodule is used to obtain the routing forwarding table through the mirror gateway node and The forwarding table and traffic flow table process the mirrored traffic packets and generate mirrored traffic packets.
在本申请的一种实施例中,镜像流量包生成子模块可以包括如下单元:In one embodiment of the present application, the mirrored traffic packet generation submodule may include the following units:
路由转发信息获取单元,用于获取流量流表的流量镜像信息,以及获取路由转发表的路由转发信息;A routing forwarding information acquisition unit, used to acquire traffic mirroring information of a traffic flow table and acquire routing forwarding information of a routing forwarding table;
镜像流量包生成单元,用于响应流量流表的流量镜像信息分别与路由转发信息匹配成功,采用路由转发信息对镜像流量报文进行封装,得到镜像流量包。The mirror traffic packet generating unit is used to respond to the traffic mirror information of the traffic flow table being matched successfully with the routing forwarding information, and to encapsulate the mirror traffic message using the routing forwarding information to obtain the mirror traffic packet.
在本申请的一种实施例中,在根据镜像流量和流量流表生成镜像流量报文之前,本申请实施例提出的装置还可以包括如下模块:In one embodiment of the present application, before generating a mirrored traffic message according to the mirrored traffic and the traffic flow table, the device proposed in the embodiment of the present application may further include the following modules:
访问请求接收模块,用于接收用户目的终端发送的访问请求;其中,访问请求包括所要访问的虚拟实例,虚拟实例在镜像网关具有所创建的相应的流量镜像网关实例。The access request receiving module is used to receive the access request sent by the user's destination terminal; wherein the access request includes the virtual instance to be accessed, and the virtual instance has a corresponding traffic mirroring gateway instance created in the mirroring gateway.
在本申请的一种实施例中,镜像流量报文发送模块704可以包括如下子模块:In one embodiment of the present application, the mirrored traffic message sending module 704 may include the following submodules:
目标网关地址获取子模块,用于通过镜像网关获取路由转发表并获取路由转发表的目的网关地址;The target gateway address acquisition submodule is used to obtain the routing forwarding table through the mirror gateway and obtain the destination gateway address of the routing forwarding table;
镜像流量报文发送子模块,用于基于目的网关地址确定将目的终端的目的终端节点,并向目的终端节点发送镜像流量报文。The mirrored traffic message sending submodule is used to determine the destination terminal node of the destination terminal based on the destination gateway address and send the mirrored traffic message to the destination terminal node.
在本申请的一种实施例中,镜像流量报文发送子模块可以包括如下单元:In one embodiment of the present application, the mirrored traffic message sending submodule may include the following units:
镜像流量报文发送单元,用于获取所要访问的流量镜像网关实例当前所在的虚拟实例,向所要访问的流量镜像网关实例当前所在的虚拟实例,所对应的流量镜像网关实例转发路由转发表,以便基于所对应的流量镜像网关实例基于路由转发表将镜像流量报文转发至目的终端节点。The mirrored traffic message sending unit is used to obtain the virtual instance where the traffic mirroring gateway instance to be accessed is currently located, and forward the routing forwarding table to the traffic mirroring gateway instance corresponding to the virtual instance where the traffic mirroring gateway instance to be accessed is currently located, so as to forward the mirrored traffic message to the destination terminal node based on the routing forwarding table based on the corresponding traffic mirroring gateway instance.
在本申请实施例中,本申请实施例提供的虚拟实例的流量镜像装置可以在虚拟实例的计算节点对虚拟实例的入流量和出流量进行镜像,得到镜像流量,以及可以获取所构建的针对镜像流量的流量流表,并根据镜像流量和流量流表生成镜像流量报文,向目的终端发送镜像流量报文,以便目的终端能够根据镜像流量报文区分端口的入出镜像流量。通过对计算节点的流量的设计编排,以及通过在计算节点实现对待镜像流量的镜像以及镜像流量报文的生成,将虚拟实例镜像流量的相关信息设计到报文中,通过报文携带方式从计算节点发送出去,在占用数据中心最少的情况下实现对虚拟实例的流量的镜像,向指定终端节点进行的镜像发送,以及实现在终端节点对镜像流量进行的区分。进一步地,还可以通过根据计算节点发送出的镜像流量报文特性,设计镜像网关上的路由转发表,实现对镜像报文的高速处理。In the embodiment of the present application, the flow mirroring device of the virtual instance provided in the embodiment of the present application can mirror the inbound and outbound flows of the virtual instance at the computing node of the virtual instance to obtain the mirrored flow, and can obtain the constructed flow flow table for the mirrored flow, and generate the mirrored flow message according to the mirrored flow and the flow flow table, and send the mirrored flow message to the destination terminal, so that the destination terminal can distinguish the inbound and outbound mirrored flows of the port according to the mirrored flow message. By designing and arranging the flow of the computing node, and by implementing the mirroring of the mirrored flow and the generation of the mirrored flow message at the computing node, the relevant information of the virtual instance mirrored flow is designed into the message, and sent from the computing node through the message carrying method, the mirroring of the flow of the virtual instance is realized under the condition of occupying the least data center, the mirroring is sent to the designated terminal node, and the distinction of the mirrored flow is realized at the terminal node. Further, the routing forwarding table on the mirrored gateway can be designed according to the characteristics of the mirrored flow message sent by the computing node to realize high-speed processing of the mirrored message.
参照图8,示出了本申请的另一种虚拟实例的流量镜像装置实施例的结构框图,应用于目的终端,目的终端与虚拟机平台通信连接,虚拟机平台包含虚拟实例的计算节点,具体可以包括如下模块:8, a structural block diagram of another embodiment of a traffic mirroring device of a virtual instance of the present application is shown, which is applied to a destination terminal, the destination terminal is connected to a virtual machine platform for communication, and the virtual machine platform includes a computing node of a virtual instance, and specifically may include the following modules:
镜像流量报文接收模块801,用于接收虚拟实例的计算节点发送的镜像流量报文;镜像流量报文基于镜像流量和流量流表生成,其中,镜像流量基于对虚拟实例的入流量和出流量进行镜像得到;The mirrored traffic message receiving module 801 is used to receive the mirrored traffic message sent by the computing node of the virtual instance; the mirrored traffic message is generated based on the mirrored traffic and the traffic flow table, wherein the mirrored traffic is obtained based on mirroring the inbound and outbound traffic of the virtual instance;
镜像流量区分模块802,用于根据镜像流量报文区分端口的入出镜像流量。
The mirrored traffic distinguishing module 802 is used to distinguish the inbound and outbound mirrored traffic of the port according to the mirrored traffic messages.
在本申请的一种实施例中,流量流表基于所配置的流量镜像信息构建,流量镜像信息至少包括流量方向信息和/或流量镜像实例信息;镜像流量区分模块802可以包括如下子模块:In one embodiment of the present application, the traffic flow table is constructed based on the configured traffic mirroring information, and the traffic mirroring information includes at least traffic direction information and/or traffic mirroring instance information; the mirrored traffic differentiation module 802 may include the following submodules:
第一镜像流量区分子模块,用于基于镜像流量包的流量方向信息区分镜像流量的入镜像流量和出镜像流量,对入流量和出流量进行分析;A first mirrored traffic distinguishing submodule is used to distinguish incoming mirrored traffic and outgoing mirrored traffic of the mirrored traffic based on traffic direction information of the mirrored traffic packet, and analyze the incoming traffic and the outgoing traffic;
第二镜像流量区分子模块,用于基于镜像流量包的流量镜像实例信息和流量方向区分与流量镜像实例信息相应虚拟实例的入镜像流量和出镜像流量,对与流量镜像实例信息相应虚拟实例的入流量和出流量进行分析;The second mirrored traffic distinguishing submodule is used to distinguish the incoming mirrored traffic and the outgoing mirrored traffic of the virtual instance corresponding to the traffic mirrored instance information based on the traffic mirrored instance information and the traffic direction of the mirrored traffic packet, and analyze the incoming traffic and the outgoing traffic of the virtual instance corresponding to the traffic mirrored instance information;
第三镜像流量区分子模块,用于基于镜像流量包的流量镜像实例信息区分与不同流量镜像实例信息相应虚拟实例的镜像流量,对不同虚拟实例的镜像流量进行分析。The third mirrored traffic distinguishing submodule is used to distinguish the mirrored traffic of virtual instances corresponding to different traffic mirroring instance information based on the traffic mirroring instance information of the mirrored traffic packet, and analyze the mirrored traffic of different virtual instances.
在本申请实施例中,本申请实施例提供的虚拟实例的流量镜像装置通过实现虚拟实例的入流量和出流量分别进行镜像,区分流量方向,让用户可以更精确灵活地对云上实例进行流量镜像,且流量镜像过程在虚拟实例所在的计算节点完成,极大节省数据中心的网络带宽资源,以及不影响用户虚拟实例的主流程,用户镜像后的流量可以通过配置分发到任意一个指定的终端节点(只要三层网络可达),在占用数据中心最少的情况下实现对虚拟实例的流量的镜像,向指定终端节点进行的镜像发送,以及实现在终端节点对镜像流量进行的区分。进一步地,流量镜像网关根据路由转发表将镜像流量报文基于UDP封装双层Tunnel报文发送到目的终端节点,通过根据计算节点发送出的镜像流量报文特性,设计镜像网关上的路由转发表,实现对镜像报文的高速处理。此外,还可以基于用户配置的流量过滤器过滤策略也在计算节点完成,在源端将不需要的流量过滤出来,过滤器策略支持接受及丢弃操作。In the embodiment of the present application, the traffic mirroring device of the virtual instance provided by the embodiment of the present application realizes the mirroring of the inflow and outflow of the virtual instance respectively, distinguishes the traffic direction, and allows users to more accurately and flexibly mirror the traffic of the cloud instance, and the traffic mirroring process is completed at the computing node where the virtual instance is located, which greatly saves the network bandwidth resources of the data center, and does not affect the main process of the user's virtual instance. The traffic after the user's mirroring can be distributed to any designated terminal node (as long as the three-layer network is reachable) through configuration, and the traffic of the virtual instance is mirrored while occupying the least data center, and the mirroring is sent to the designated terminal node, and the mirroring traffic is distinguished at the terminal node. Further, the traffic mirroring gateway sends the mirrored traffic message to the destination terminal node based on the UDP encapsulated double-layer Tunnel message according to the routing forwarding table, and the routing forwarding table on the mirroring gateway is designed according to the characteristics of the mirrored traffic message sent by the computing node, so as to realize high-speed processing of the mirrored message. In addition, the filtering strategy of the traffic filter configured by the user can also be completed at the computing node, and the unnecessary traffic is filtered out at the source end, and the filter strategy supports acceptance and discarding operations.
对于装置实施例而言,由于其与方法实施例基本相似,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
本申请实施例还提供了一种虚拟机平台,包括:The embodiment of the present application also provides a virtual machine platform, including:
包括处理器、存储器及存储在存储器上并能够在处理器上运行的计算机程序,该计算机程序被处理器执行时实现上述虚拟实例的流量镜像方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, each process of the traffic mirroring method embodiment of the above virtual instance is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
本申请实施例还提供了一种计算机可读存储介质,计算机可读存储介质上存储计算机程序,计算机程序被处理器执行时实现上述虚拟实例的流量镜像方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, each process of the traffic mirroring method embodiment of the above-mentioned virtual instance is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
本说明书中的各个实施例均采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似的部分互相参见即可。The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
本领域内的技术人员应明白,本申请实施例的实施例可提供为方法、装置、或计算机程序产品。因此,本申请实施例可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请实施例可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, devices, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
本申请实施例是参照根据本申请实施例的方法、终端设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理终端设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理终端设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present application embodiment is described with reference to the flowchart and/or block diagram of the method, terminal device (system) and computer program product according to the embodiment of the present application. It should be understood that each process and/or box in the flowchart and/or block diagram, and the combination of the process and/or box in the flowchart and/or block diagram can be realized by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing terminal device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device produce a device for realizing the function specified in one process or multiple processes in the flowchart and/or one box or multiple boxes in the block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理终端设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理终端设备上,使得在计算机或其他可编程终端设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程终端设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce computer-implemented processing, so that the instructions executed on the computer or other programmable terminal device provide steps for implementing the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
尽管已描述了本申请实施例的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例做出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本申请实施例范围的所有变更和修改。Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.
最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者终端设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者终端设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括要素的过程、方法、物品或者终端设备中还存在另外的相同要素。Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
以上对本申请所提供的一种虚拟实例的流量镜像方法、一种虚拟实例的流量镜像装置、相应的一种虚拟机平台以及相应的一种计算机可读存储介质,进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上,本说明书内容不应理解为对本申请的限制。
The above is a detailed introduction to a traffic mirroring method for a virtual instance, a traffic mirroring device for a virtual instance, a corresponding virtual machine platform and a corresponding computer-readable storage medium provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims (15)
- 一种虚拟实例的流量镜像方法,其特征在于,应用于虚拟机平台,所述虚拟机平台包含所述虚拟实例的计算节点,所述方法包括:A traffic mirroring method for a virtual instance, characterized in that it is applied to a virtual machine platform, the virtual machine platform includes a computing node of the virtual instance, and the method comprises:获取所述虚拟实例的待镜像流量,所述虚拟实例的待镜像流量包括入流量和/或出流量;Acquire the traffic to be mirrored of the virtual instance, where the traffic to be mirrored of the virtual instance includes inbound traffic and/or outbound traffic;在所述虚拟实例的计算节点对所述虚拟实例的入流量和出流量进行镜像,得到镜像流量;Mirroring the inbound and outbound traffic of the virtual instance on the computing node of the virtual instance to obtain mirrored traffic;获取所构建的针对所述镜像流量的流量流表,根据所述镜像流量和所述流量流表生成镜像流量报文;Acquire the constructed traffic flow table for the mirrored traffic, and generate a mirrored traffic message according to the mirrored traffic and the traffic flow table;向目的终端发送所述镜像流量报文,以便所述目的终端根据所述镜像流量报文区分端口的入出镜像流量。The mirrored traffic message is sent to a destination terminal so that the destination terminal can distinguish inbound and outbound mirrored traffic of a port according to the mirrored traffic message.
- 根据权利要求1所述的方法,其特征在于,所述获取所构建的针对所述镜像流量的流量流表,还包括:The method according to claim 1, characterized in that the step of obtaining the constructed traffic flow table for the mirrored traffic further comprises:获取所配置的流量镜像信息,采用所述流量镜像信息构建针对所述镜像流量的流量流表;其中,所述流量镜像信息至少包括流量方向信息、流量镜像实例信息、终端节点信息、流量过滤策略信息以及用户自定义标签信息。The configured traffic mirroring information is obtained, and the traffic mirroring information is used to construct a traffic flow table for the mirrored traffic; wherein the traffic mirroring information includes at least traffic direction information, traffic mirroring instance information, terminal node information, traffic filtering policy information, and user-defined label information.
- 根据权利要求2所述的方法,其特征在于,所述镜像流量包括针对入流量的入镜像流量和针对出流量的出镜像流量;所述采用所述流量镜像信息构建针对所述镜像流量的流量流表,包括:The method according to claim 2 is characterized in that the mirrored traffic includes inbound mirrored traffic for inbound traffic and outbound mirrored traffic for outbound traffic; and the step of using the traffic mirroring information to construct a traffic flow table for the mirrored traffic comprises:采用所述流量镜像实例信息、流量方向信息、终端节点信息、流量过滤策略信息以及用户自定义标签信息,分别构建入镜像流量的入流量流表,以及出镜像流量的出流量流表。The traffic mirroring instance information, traffic direction information, terminal node information, traffic filtering policy information and user-defined label information are used to construct an inbound traffic flow table for inbound mirrored traffic and an outbound traffic flow table for outbound mirrored traffic.
- 根据权利要求1所述的方法,其特征在于,所述虚拟实例位于虚拟私有云,所述虚拟私有云在镜像网关具有所创建的相应的流量镜像网关实例,用于承载不同流量镜像网关实例的镜像网关组包括多个镜像网关节点。The method according to claim 1 is characterized in that the virtual instance is located in a virtual private cloud, and the virtual private cloud has a corresponding traffic mirroring gateway instance created in the mirroring gateway, and the mirroring gateway group for carrying different traffic mirroring gateway instances includes multiple mirroring gateway nodes.
- 根据权利要求4所述的方法,其特征在于,所述根据所述镜像流量和所述流量流表生成镜像流量报文,包括:The method according to claim 4, characterized in that the generating the mirrored traffic message according to the mirrored traffic and the traffic flow table comprises:在所述虚拟实例的计算节点构建得到镜像流量后,通过所述镜像网关组的镜像网关节点接收所述镜像流量和所述流量流表;After the computing node of the virtual instance constructs the mirrored traffic, the mirrored traffic and the traffic flow table are received through the mirrored gateway node of the mirrored gateway group;采用所述镜像流量和所述流量流表生成镜像流量报文;Generate a mirrored traffic message using the mirrored traffic and the traffic flow table;还包括:Also includes:通过所述镜像网关节点获取路由转发表,并根据所述路由转发表和所述流量流表对所述镜像流量报文进行报文处理,生成镜像流量包。The routing forwarding table is obtained through the mirror gateway node, and the mirror traffic message is processed according to the routing forwarding table and the traffic flow table to generate a mirror traffic packet.
- 根据权利要求5所述的方法,其特征在于,所述根据所述路由转发表和所述流量流表对所述镜像流量报文进行报文处理,生成镜像流量包,包括:The method according to claim 5 is characterized in that the processing of the mirrored traffic message according to the routing forwarding table and the traffic flow table to generate a mirrored traffic packet comprises:获取所述流量流表的流量镜像信息,以及获取所述路由转发表的路由转发信息;Obtaining traffic mirroring information of the traffic flow table and obtaining routing forwarding information of the routing forwarding table;响应所述流量流表的流量镜像信息分别与所述路由转发信息匹配成功,采用所 述路由转发信息对所述镜像流量报文进行封装,得到镜像流量包。The traffic mirroring information of the traffic flow table is matched successfully with the routing forwarding information, and the The mirrored traffic message is encapsulated using the routing forwarding information to obtain a mirrored traffic packet.
- 根据权利要求1或4所述的方法,其特征在于,在所述根据所述镜像流量和所述流量流表生成镜像流量报文之前,还包括:The method according to claim 1 or 4, characterized in that before generating the mirrored traffic message according to the mirrored traffic and the traffic flow table, it also includes:接收用户所述目的终端发送的访问请求;其中,所述访问请求包括所要访问的虚拟实例,所述虚拟实例在镜像网关具有所创建的相应的流量镜像网关实例。An access request sent by the destination terminal of the user is received; wherein the access request includes the virtual instance to be accessed, and the virtual instance has a corresponding traffic mirroring gateway instance created in the mirroring gateway.
- 根据权利要求7所述的方法,其特征在于,所述向目的终端发送所述镜像流量报文,包括:The method according to claim 7, characterized in that the sending of the mirrored traffic message to the destination terminal comprises:通过镜像网关获取路由转发表并获取所述路由转发表的目的网关地址;Obtaining a routing forwarding table through a mirrored gateway and obtaining a destination gateway address of the routing forwarding table;基于所述目的网关地址确定将所述目的终端的目的终端节点,并向所述目的终端节点发送所述镜像流量报文。A destination terminal node of the destination terminal is determined based on the destination gateway address, and the mirrored traffic message is sent to the destination terminal node.
- 根据权利要求8所述的方法,其特征在于,所述向所述目的终端节点发送所述镜像流量报文,包括:The method according to claim 8, characterized in that the sending of the mirrored traffic message to the destination terminal node comprises:获取所要访问的流量镜像网关实例当前所在的虚拟实例,向所述所要访问的流量镜像网关实例当前所在的虚拟实例,所对应的流量镜像网关实例转发所述路由转发表,以便基于所对应的流量镜像网关实例基于所述路由转发表将所述镜像流量报文转发至目的终端节点。Obtain the virtual instance where the traffic mirroring gateway instance to be accessed is currently located, and forward the routing forwarding table to the traffic mirroring gateway instance corresponding to the virtual instance where the traffic mirroring gateway instance to be accessed is currently located, so that the mirrored traffic message is forwarded to the destination terminal node based on the routing forwarding table based on the corresponding traffic mirroring gateway instance.
- 一种虚拟实例的流量镜像方法,其特征在于,应用于目的终端,所述目的终端与虚拟机平台通信连接,所述虚拟机平台包含所述虚拟实例的计算节点,所述方法包括:A traffic mirroring method for a virtual instance, characterized in that it is applied to a destination terminal, the destination terminal is communicatively connected to a virtual machine platform, the virtual machine platform includes a computing node of the virtual instance, and the method comprises:接收所述虚拟实例的计算节点发送的镜像流量报文;所述镜像流量报文基于镜像流量和流量流表生成,其中,所述镜像流量基于对虚拟实例的入流量和出流量进行镜像得到;Receiving a mirrored traffic message sent by a computing node of the virtual instance; the mirrored traffic message is generated based on the mirrored traffic and a traffic flow table, wherein the mirrored traffic is obtained based on mirroring the inbound and outbound traffic of the virtual instance;根据所述镜像流量报文区分端口的入出镜像流量。The inbound and outbound mirrored traffic of the port is distinguished according to the mirrored traffic message.
- 根据权利要求10所述的方法,其特征在于,所述流量流表基于所配置的流量镜像信息构建,所述流量镜像信息至少包括流量方向信息和/或流量镜像实例信息;The method according to claim 10 is characterized in that the traffic flow table is constructed based on the configured traffic mirroring information, and the traffic mirroring information at least includes traffic direction information and/or traffic mirroring instance information;所述根据所述镜像流量报文区分端口的入出镜像流量,包括:The step of distinguishing the inbound and outbound mirrored traffic of a port according to the mirrored traffic message includes:基于所述镜像流量包的流量方向信息区分所述镜像流量的入镜像流量和出镜像流量,对所述入流量和出流量进行分析;Distinguishing incoming mirrored traffic and outgoing mirrored traffic of the mirrored traffic based on traffic direction information of the mirrored traffic packet, and analyzing the incoming traffic and outgoing traffic;和/或,基于所述镜像流量包的流量镜像实例信息和所述流量方向区分与所述流量镜像实例信息相应虚拟实例的入镜像流量和出镜像流量,对与所述流量镜像实例信息相应虚拟实例的入流量和出流量进行分析;And/or, based on the traffic mirroring instance information and the traffic direction of the mirrored traffic packet, distinguishing the incoming mirrored traffic and the outgoing mirrored traffic of the virtual instance corresponding to the traffic mirroring instance information, and analyzing the incoming traffic and the outgoing traffic of the virtual instance corresponding to the traffic mirroring instance information;和/或,基于所述镜像流量包的流量镜像实例信息区分与不同流量镜像实例信息相应虚拟实例的镜像流量,对不同虚拟实例的镜像流量进行分析。And/or, based on the traffic mirroring instance information of the mirrored traffic packet, the mirrored traffic of the virtual instances corresponding to different traffic mirroring instance information is distinguished, and the mirrored traffic of the different virtual instances is analyzed.
- 一种虚拟实例的流量镜像装置,其特征在于,应用于虚拟机平台,所述虚拟机平台包含所述虚拟实例的计算节点,所述装置包括:A traffic mirroring device for a virtual instance, characterized in that it is applied to a virtual machine platform, the virtual machine platform includes a computing node of the virtual instance, and the device includes:待镜像流量获取模块,用于获取所述虚拟实例的待镜像流量,所述虚拟实例的待镜像流量包括入流量和/或出流量; A to-be-mirrored traffic acquisition module, used to acquire the to-be-mirrored traffic of the virtual instance, where the to-be-mirrored traffic of the virtual instance includes inbound traffic and/or outbound traffic;流量镜像模块,用于在所述虚拟实例的计算节点对所述虚拟实例的入流量和出流量进行镜像,得到镜像流量;A traffic mirroring module, used for mirroring the inbound and outbound traffic of the virtual instance on the computing node of the virtual instance to obtain mirrored traffic;镜像流量报文生成模块,用于获取所构建的针对所述镜像流量的流量流表,根据所述镜像流量和所述流量流表生成镜像流量报文;A mirrored traffic message generation module, used to obtain the constructed traffic flow table for the mirrored traffic, and generate a mirrored traffic message according to the mirrored traffic and the traffic flow table;镜像流量报文发送模块,用于向目的终端发送所述镜像流量报文,以便所述目的终端根据所述镜像流量报文区分端口的入出镜像流量。The mirrored traffic message sending module is used to send the mirrored traffic message to the destination terminal so that the destination terminal can distinguish the inbound and outbound mirrored traffic of the port according to the mirrored traffic message.
- 一种虚拟实例的流量镜像装置,其特征在于,应用于目的终端,所述目的终端与虚拟机平台通信连接,所述虚拟机平台包含所述虚拟实例的计算节点,所述装置包括:A traffic mirroring device for a virtual instance, characterized in that it is applied to a destination terminal, the destination terminal is communicatively connected to a virtual machine platform, the virtual machine platform includes a computing node of the virtual instance, and the device comprises:镜像流量报文接收模块,用于接收所述虚拟实例的计算节点发送的镜像流量报文;所述镜像流量报文基于镜像流量和流量流表生成,其中,所述镜像流量基于对虚拟实例的入流量和出流量进行镜像得到;A mirrored traffic message receiving module, used to receive a mirrored traffic message sent by a computing node of the virtual instance; the mirrored traffic message is generated based on the mirrored traffic and a traffic flow table, wherein the mirrored traffic is obtained based on mirroring the inbound and outbound traffic of the virtual instance;镜像流量区分模块,用于根据所述镜像流量报文区分端口的入出镜像流量。The mirrored traffic distinguishing module is used to distinguish the inbound and outbound mirrored traffic of the port according to the mirrored traffic message.
- 一种虚拟机平台,其特征在于,包括:处理器、存储器及存储在所述存储器上并能够在所述处理器上运行的计算机程序,所述计算机程序被所述处理器执行时实现如权利要求1至9或权利要求10至11中任一项所述虚拟实例的流量镜像方法。A virtual machine platform, characterized in that it includes: a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, a traffic mirroring method for a virtual instance as described in any one of claims 1 to 9 or claims 10 to 11 is implemented.
- 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储计算机程序,所述计算机程序被处理器执行时实现如权利要求1至9或权利要求10至11中任一项所述虚拟实例的流量镜像方法。 A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, a traffic mirroring method of a virtual instance as described in any one of claims 1 to 9 or claims 10 to 11 is implemented.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310050246.9 | 2023-02-01 | ||
CN202310050246.9A CN115865802B (en) | 2023-02-01 | 2023-02-01 | Flow mirroring method and device of virtual instance, virtual machine platform and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2024159962A1 true WO2024159962A1 (en) | 2024-08-08 |
Family
ID=85657442
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2023/140326 WO2024159962A1 (en) | 2023-02-01 | 2023-12-20 | Traffic mirroring method and apparatus for virtual instance, virtual machine platform, and storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN115865802B (en) |
WO (1) | WO2024159962A1 (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115865802B (en) * | 2023-02-01 | 2023-06-23 | 天翼云科技有限公司 | Flow mirroring method and device of virtual instance, virtual machine platform and storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102546390A (en) * | 2011-11-17 | 2012-07-04 | 杭州华三通信技术有限公司 | Method and device for remote mirror image |
CN108092845A (en) * | 2017-11-06 | 2018-05-29 | 中国银联股份有限公司 | The differentiation and positioning of mirror image flow |
CN114172854A (en) * | 2021-11-30 | 2022-03-11 | 新华三大数据技术有限公司 | Message mirror image, mirror image configuration method, virtual switch and mirror image configuration device |
CN114615174A (en) * | 2022-03-10 | 2022-06-10 | 奇安信科技集团股份有限公司 | Flow monitoring method and device |
CN115865802A (en) * | 2023-02-01 | 2023-03-28 | 天翼云科技有限公司 | Virtual instance flow mirroring method and device, virtual machine platform and storage medium |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US11516050B2 (en) * | 2019-06-21 | 2022-11-29 | Amazon Technologies, Inc. | Monitoring network traffic using traffic mirroring |
CN114531380B (en) * | 2020-10-30 | 2024-11-08 | 中国移动通信有限公司研究院 | Mirror image quality checking method and device and electronic equipment |
CN113709017B (en) * | 2021-08-17 | 2022-10-04 | 中盈优创资讯科技有限公司 | Method and device for acquiring virtualization traffic |
-
2023
- 2023-02-01 CN CN202310050246.9A patent/CN115865802B/en active Active
- 2023-12-20 WO PCT/CN2023/140326 patent/WO2024159962A1/en unknown
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102546390A (en) * | 2011-11-17 | 2012-07-04 | 杭州华三通信技术有限公司 | Method and device for remote mirror image |
CN108092845A (en) * | 2017-11-06 | 2018-05-29 | 中国银联股份有限公司 | The differentiation and positioning of mirror image flow |
CN114172854A (en) * | 2021-11-30 | 2022-03-11 | 新华三大数据技术有限公司 | Message mirror image, mirror image configuration method, virtual switch and mirror image configuration device |
CN114615174A (en) * | 2022-03-10 | 2022-06-10 | 奇安信科技集团股份有限公司 | Flow monitoring method and device |
CN115865802A (en) * | 2023-02-01 | 2023-03-28 | 天翼云科技有限公司 | Virtual instance flow mirroring method and device, virtual machine platform and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN115865802B (en) | 2023-06-23 |
CN115865802A (en) | 2023-03-28 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8630294B1 (en) | Dynamic bypass mechanism to alleviate bloom filter bank contention | |
KR102586898B1 (en) | Message processing method and apparatus, and relevant devices | |
US10735325B1 (en) | Congestion avoidance in multipath routed flows | |
US20220078114A1 (en) | Method and Apparatus for Providing Service for Traffic Flow | |
EP2926513B1 (en) | Packet prioritization in a software-defined network implementing openflow | |
EP3481015B1 (en) | Variable-based forwarding path construction for packet processing within a network device | |
Rosen | Linux kernel networking: Implementation and theory | |
US8799507B2 (en) | Longest prefix match searches with variable numbers of prefixes | |
US10693790B1 (en) | Load balancing for multipath group routed flows by re-routing the congested route | |
US20080002663A1 (en) | Virtual network interface card loopback fastpath | |
US20140098669A1 (en) | Method and apparatus for accelerating forwarding in software-defined networks | |
US10097467B1 (en) | Load balancing for multipath groups routed flows by re-associating routes to multipath groups | |
WO2016206511A1 (en) | Method and device for implementing nat | |
WO2017107814A1 (en) | Method, apparatus and system for propagating qos policies | |
US10616105B1 (en) | Extending virtual routing and forwarding using source identifiers | |
US10819640B1 (en) | Congestion avoidance in multipath routed flows using virtual output queue statistics | |
US20210273915A1 (en) | Multi-access interface for internet protocol security | |
WO2016150296A1 (en) | Method and device for sending and receiving flow specification rule | |
CN114301868B (en) | Method for quickly generating virtual container floating IP and method and device for network direct connection | |
KR20130126833A (en) | The method of high-speed switching for network virtualization and the high-speed virtual switch architecture | |
EP3879757B1 (en) | Network traffic steering among cpu cores using forwarding path elements | |
WO2024159962A1 (en) | Traffic mirroring method and apparatus for virtual instance, virtual machine platform, and storage medium | |
US9898069B1 (en) | Power reduction methods for variable sized tables | |
WO2024093478A1 (en) | Data processing method and apparatus based on policy-based routing, device and storage medium | |
CN115834472B (en) | Message processing method, forwarding strategy acquisition method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 23919524 Country of ref document: EP Kind code of ref document: A1 |