[go: up one dir, main page]

CN111224899A - Method, device, equipment and medium for mirroring flow of virtual port - Google Patents

Method, device, equipment and medium for mirroring flow of virtual port Download PDF

Info

Publication number
CN111224899A
CN111224899A CN201911053741.5A CN201911053741A CN111224899A CN 111224899 A CN111224899 A CN 111224899A CN 201911053741 A CN201911053741 A CN 201911053741A CN 111224899 A CN111224899 A CN 111224899A
Authority
CN
China
Prior art keywords
virtual
port
virtual port
target
virtual machine
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201911053741.5A
Other languages
Chinese (zh)
Inventor
张兆增
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Inspur Data Technology Co Ltd
Original Assignee
Beijing Inspur Data Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Inspur Data Technology Co Ltd filed Critical Beijing Inspur Data Technology Co Ltd
Priority to CN201911053741.5A priority Critical patent/CN111224899A/en
Publication of CN111224899A publication Critical patent/CN111224899A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/20Support for services
    • H04L49/208Port mirroring
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/70Virtual switches

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application discloses a flow mirroring method for a virtual port, which comprises the following steps: when a source virtual port of a virtual machine to be configured needs to be mirrored to a destination virtual port, storing a target mapping relation between the source virtual port and the destination virtual port to a virtual switch connected with the virtual machine to be configured; detecting whether all virtual ports corresponding to the target mapping relation exist or not; if not, monitoring all virtual ports corresponding to the target mapping relation in real time, and sending an operation instruction for configuring the target mapping relation to an operating system of a host where the virtual machine to be configured is located when all the virtual ports corresponding to the target mapping relation exist, so that the flow of the source virtual port is mirrored to the target virtual port by using the virtual switch. By using the method, the phenomenon that the port flow mirror images of the source virtual port and the destination virtual port are invalid can be avoided under the condition that the running state of the virtual machine where the source virtual port or the destination virtual port is located is changed.

Description

Method, device, equipment and medium for mirroring flow of virtual port
Technical Field
The present invention relates to the field of virtual network technologies, and in particular, to a method, an apparatus, a device, and a medium for mirroring traffic of a virtual port.
Background
Port Mirroring (Port Mirroring) refers to forwarding data traffic of one or more source virtual ports in a virtual machine to a certain destination virtual Port through a switch or a router, so that the destination virtual Port can monitor the source virtual Port in real time. However, if the running state of the virtual machine in which the source virtual port or the destination virtual port is located changes, for example: when the virtual machine where the source virtual port or the destination virtual port is located is shut down or restarted, the source virtual port and the destination virtual port are deleted, and in this case, port images corresponding to the source virtual port and the destination virtual port are lost. Moreover, when the virtual machines in which the source virtual port and the destination virtual port are located are restarted, the mirroring relationship between the source virtual port and the destination virtual port is re-created, and even if the names of the source virtual port and the destination virtual port are set to be consistent with the names before restarting, the previously configured port traffic mirroring between the source virtual port and the destination virtual port is also caused to fail. At present, no effective solution exists for the technical problem.
Therefore, it is obvious that a technical problem to be solved by those skilled in the art is to be solved how to avoid the phenomenon that the port traffic mirrors of the source virtual port and the destination virtual port fail even when the running state of the virtual machine in which the source virtual port or the destination virtual port is located changes.
Disclosure of Invention
In view of this, an object of the present invention is to provide a method, an apparatus, a device, and a medium for mirroring traffic of a virtual port, so as to avoid a failure phenomenon of port traffic mirroring of a source virtual port and a destination virtual port even when a running state of a virtual machine in which the source virtual port or the destination virtual port is located changes. The specific scheme is as follows:
a traffic mirroring method for a virtual port comprises the following steps:
when a source virtual port of a virtual machine to be configured needs to be mirrored to a destination virtual port, storing a target mapping relation between the source virtual port and the destination virtual port to a virtual switch connected with the virtual machine to be configured;
detecting whether all virtual ports corresponding to the target mapping relation exist or not;
if not, monitoring all virtual ports corresponding to the target mapping relationship in real time, and sending an operation instruction for configuring the target mapping relationship to an operating system of a host where the virtual machine to be configured is located when all the virtual ports corresponding to the target mapping relationship are monitored to be present, so that the virtual switch is utilized to mirror the flow of the source virtual port to the target virtual port.
Preferably, the number of the source virtual ports is one or more.
Preferably, after the process of detecting whether all virtual ports corresponding to the target mapping relationship exist, the method further includes:
if so, sending an operation instruction for configuring the target mapping relation to an operating system of a host where the virtual machine to be configured is located, so as to utilize a virtual switch connected with the virtual machine to be configured to mirror the flow of the source virtual port to the destination virtual port.
Preferably, the method further comprises the following steps:
and if the virtual machines where the virtual machine to be configured and the target virtual port are located are both in a starting state, judging that all the virtual ports corresponding to the target mapping relation exist.
Preferably, the destination virtual port is a virtual port on the target virtual machine; and the target virtual machine is a virtual machine except the virtual machine to be configured in the host.
Preferably, the destination virtual port is a virtual port on a remote virtual machine.
Correspondingly, the invention also discloses a flow mirroring device of the virtual port, which comprises the following components:
the port storage module is used for storing a target mapping relation between a source virtual port and a target virtual port to a virtual switch connected with a virtual machine to be configured when the source virtual port of the virtual machine to be configured needs to be mirrored to the target virtual port;
a port detection module, configured to detect whether all virtual ports corresponding to the target mapping relationship exist;
and the port configuration module is used for monitoring all virtual ports corresponding to the target mapping relationship in real time when the judgment result of the port detection module is negative, and sending an operation instruction for configuring the target mapping relationship to an operating system of a host where the virtual machine to be configured is located until all the virtual ports corresponding to the target mapping relationship are monitored to exist, so that the virtual switch is utilized to mirror the flow of the source virtual port to the target virtual port.
Correspondingly, the invention also discloses a flow mirroring device of the virtual port, which comprises:
a memory for storing a computer program;
a processor for implementing the steps of a traffic mirroring method for a virtual port as disclosed in the foregoing when executing the computer program.
Accordingly, the present invention also discloses a computer readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the steps of the traffic mirroring method for a virtual port as disclosed in the foregoing.
It can be seen that, in the present invention, when a source virtual port of a virtual machine to be configured needs to be mirrored to a destination virtual port, a target mapping relationship between the source virtual port and the destination virtual port is firstly stored in a virtual switch connected to the virtual machine to be configured, and whether all virtual ports corresponding to the target mapping relationship exist is detected, if not, it indicates that the running state of the virtual machine to be configured or the virtual machine to which the destination virtual port belongs has changed. In this case, all the virtual ports corresponding to the target mapping relationship are monitored in real time, and when it is monitored that all the virtual ports corresponding to the target mapping relationship exist, it is indicated that the virtual machines where the source virtual port and the target virtual port are located are in a normal operating state, and at this time, an operation instruction for configuring the target mapping relationship is sent to the operating system of the host where the virtual machine to be configured is located, so that the traffic of the source virtual port is mirrored to the target virtual port. Obviously, the method for mirroring the traffic of the virtual port provided by the present invention is equivalent to interrupt the configuration operation related to the target mapping relationship when the running state of the virtual machine where the source virtual port or the destination virtual port is located changes, and only when it is monitored that the virtual machines where the source virtual port and the destination virtual port are located are both in the normal running state, the target mapping relationship is configured in the operating system of the host where the virtual machine to be configured is located, so that the phenomenon that the port traffic mirrors of the source virtual port and the destination virtual port fail can be avoided under the condition that the running state of the virtual machine where the source virtual port or the destination virtual port is located changes. Correspondingly, the traffic mirroring device, the equipment and the medium of the virtual port, which are provided by the invention, also have the beneficial effects.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a traffic mirroring method for a virtual port according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a port mirror;
fig. 3 is a schematic structural diagram of a state monitoring module, a virtual machine to be configured, and a virtual switch;
fig. 4 is a schematic flow mirror diagram of a virtual port according to an embodiment of the present invention;
fig. 5 is a structural diagram of a traffic mirroring apparatus for a virtual port according to an embodiment of the present invention;
fig. 6 is a structural diagram of a traffic mirroring device of a virtual port according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, fig. 1 is a flowchart of a traffic mirroring method for a virtual port according to an embodiment of the present invention, where the traffic mirroring method includes:
step S11: when a source virtual port of a virtual machine to be configured needs to be mirrored to a destination virtual port, storing a target mapping relation between the source virtual port and the destination virtual port to a virtual switch connected with the virtual machine to be configured;
step S12: detecting whether all virtual ports corresponding to the target mapping relation exist or not;
step S13: if not, monitoring all virtual ports corresponding to the target mapping relationship in real time, and sending an operation instruction for configuring the target mapping relationship to an operating system of a host where the virtual machine to be configured is located when all the virtual ports corresponding to the target mapping relationship are monitored to mirror the flow of the source virtual port to the target virtual port by using a virtual switch connected with the virtual machine to be configured.
In this embodiment, a traffic mirroring method for a virtual port is provided, which can avoid a phenomenon that port traffic mirroring of a source virtual port and a destination virtual port fails when an operating state of a virtual machine where the source virtual port or the destination virtual port is located changes.
Specifically, when a source virtual port of the virtual machine to be configured needs to be mirrored to a destination virtual port, the target mapping relationship between the source virtual port and the destination virtual port is stored in the virtual switch connected to the virtual machine to be configured. Obviously, the purpose of this step is to enable the virtual switch to which the virtual machine to be configured is connected to mirror the traffic of the source virtual port of the virtual machine to be configured to the destination virtual port.
In order to enable those skilled in the art to better understand the mirroring relationship between the source virtual port and the destination virtual port, a specific example is illustrated here. Referring to fig. 2, fig. 2 is a schematic diagram of port mirroring, assuming that a virtual port 1 in a virtual machine 1 needs to be mirrored to a virtual port 2 in a virtual machine 2, that is, the virtual port 2 can receive the same traffic as the virtual port 1, at this time, the traffic flowing through the virtual port 1 needs to be sent to the virtual port 2 by copying, so that the virtual port 2 can monitor and analyze the traffic of the virtual port 1. When the mirror relationship between the virtual port 1 and the virtual port 2 is determined, the mapping relationship between the virtual port 1 and the virtual port 2 is stored in the virtual switch in the virtual machine 1.
When the target mapping relation between the source virtual port and the target virtual port is stored in the virtual switch of the virtual machine to be configured, then, whether all the virtual ports corresponding to the target mapping relation exist is detected.
Specifically, in this embodiment, a state monitoring module is configured in a host where a virtual machine to be configured is located to detect, in real time, a state change condition of all virtual ports corresponding to a target mapping relationship. Referring to fig. 3, fig. 3 is a schematic structural diagram of a status monitoring module, a virtual machine to be configured, and a virtual switch.
It can be understood that, in practical applications, no matter how many practical application scenarios the virtual machine is to be configured, such as: however, the application scenarios corresponding to the source virtual port and the destination virtual port only have two states, that is, existence or nonexistence, so in this embodiment, the state monitoring module is used to detect state change conditions of all virtual ports corresponding to the target mapping relationship, and perform corresponding actions when sensing that the states of all virtual ports corresponding to the target mapping relationship change.
Conceivably, if the virtual machine to be configured is shut down, the source virtual port in the virtual machine to be configured is deleted, and at this time, the mirror image related to the source virtual port needs to be deleted; if the virtual machine to be configured is started, a source virtual machine port in the virtual machine to be configured is created, under the circumstance, whether mirror image ports related to the source virtual port exist or not needs to be detected, and if the mirror image ports related to the source virtual port exist, the flow of the source virtual port can be mirrored to a target virtual port by using a virtual switch connected with the virtual machine to be configured; if all the virtual ports corresponding to the target mapping relationship are detected not to exist, it is indicated that the virtual machine where the source virtual port or the target virtual port is located is in an abnormal operating state, at this time, if an operation instruction for configuring the target mapping relationship is sent to an operating system of a host where the virtual machine to be configured is located, a phenomenon that the operating system of the host where the virtual machine to be configured is located cannot find the source virtual port or the target virtual port occurs, and a configured mirror relationship between the source virtual port and the target virtual port fails.
In order to avoid the foregoing phenomenon, in this embodiment, when it is detected that all the virtual ports corresponding to the target mapping relationship do not exist, all the virtual ports corresponding to the target mapping relationship are monitored in real time, until it is detected that all the virtual ports corresponding to the target mapping relationship exist, an operation instruction for configuring the target mapping relationship is sent to an operating system of a host where the virtual machine to be configured is located, that is, when it is detected that both the source virtual port and the target virtual port exist, an operation instruction for configuring the target mapping relationship is automatically sent to the operating system of the host where the virtual machine to be configured is located.
It can be thought that, when the operating system of the host where the virtual machine to be configured is located receives the operation instruction for configuring the target mapping relationship, the operating system of the host where the virtual machine to be configured is located may configure the target mapping relationship between the source virtual port and the destination virtual port, so that the virtual switch connected to the virtual machine to be configured may be used to mirror the traffic of the source virtual port to the destination virtual port, and thus the destination virtual port may analyze and monitor the traffic on the source virtual port.
Obviously, with the traffic mirroring method provided in this embodiment, only when it is monitored that all the virtual ports corresponding to the target mapping relationship exist, the operation instruction for configuring the target mapping relationship is automatically sent to the operating system of the host where the virtual machine to be configured is located, so that it is ensured that the traffic mirroring relationship between the source virtual port and the target virtual port is configured only when the virtual machines corresponding to the source virtual port and the target virtual port are in the normal operating state, and thus, the phenomenon that the port traffic mirrors of the source virtual port and the target virtual port fail when the operating state of the virtual machine where the source virtual port or the target virtual port is located changes can be avoided.
It can be seen that, in this embodiment, when a source virtual port of a virtual machine to be configured needs to be mirrored to a destination virtual port, first, a target mapping relationship between the source virtual port and the destination virtual port is stored in a virtual switch connected to the virtual machine to be configured, and whether all virtual ports corresponding to the target mapping relationship exist is detected, and if not, it indicates that the running state of the virtual machine to be configured or a virtual machine to which the destination virtual port belongs has changed. In this case, all the virtual ports corresponding to the target mapping relationship are monitored in real time, and when it is monitored that all the virtual ports corresponding to the target mapping relationship exist, it is indicated that the virtual machines where the source virtual port and the target virtual port are located are in a normal operating state, and at this time, an operation instruction for configuring the target mapping relationship is sent to the operating system of the host where the virtual machine to be configured is located, so that the traffic of the source virtual port is mirrored to the target virtual port. Obviously, the traffic mirroring method for a virtual port provided by this embodiment is equivalent to interrupt the configuration operation related to the target mapping relationship when the running state of the virtual machine where the source virtual port or the destination virtual port is located changes, and only when it is monitored that the virtual machines where the source virtual port and the destination virtual port are located are both in the normal running state, configure the target mapping relationship in the operating system of the host where the virtual machine to be configured is located, thereby avoiding the phenomenon that the traffic mirroring of the ports corresponding to the source virtual port and the destination virtual port fails when the running state of the virtual machine where the source virtual port or the destination virtual port is located changes.
Based on the above embodiments, this embodiment further describes and optimizes the technical solution, and specifically, the number of the source virtual ports is one or more.
In practical applications, a virtual machine to be configured generally has a plurality of virtual ports, and when a traffic mirroring relationship between a source virtual port and a destination virtual port is configured, one source virtual port may be mirrored to one destination virtual port, or a plurality of source virtual ports may be mirrored to one destination virtual port. Therefore, in this embodiment, one or more source virtual ports in the virtual machine to be configured are set, so that the technical scheme provided by the present application can be applied to more practical application scenarios.
Based on the foregoing embodiments, this embodiment further describes and optimizes the technical solution, specifically, in step S12: after the process of detecting whether all the virtual ports corresponding to the target mapping relationship exist, the method further includes:
if so, sending an operation instruction for configuring the target mapping relation to an operating system of a host where the virtual machine to be configured is located, so as to utilize a virtual switch connected with the virtual machine to be configured to mirror the flow of the source virtual port to the destination virtual port.
In this embodiment, if the target mapping relationship between the source virtual port and the destination virtual port is stored in the virtual switch connected to the virtual machine to be configured, and it is detected that all the virtual ports corresponding to the target mapping relationship exist, at this time, the operation instruction for configuring the target mapping relationship may be directly sent to the operating system of the host where the virtual machine to be configured is located, so as to mirror the traffic of the source virtual port to the destination virtual port by using the virtual switch connected to the virtual machine to be configured. It is conceivable that, after the traffic mirroring relationship between the source virtual port and the destination virtual port is validated, the destination virtual port may be used to monitor and analyze the traffic flowing through the source virtual port.
Obviously, by the technical scheme provided by the embodiment, the traffic mirroring method of the virtual port provided by the application can be more comprehensive and complete.
Based on the foregoing embodiment, this embodiment further describes and optimizes the technical solution, and as a preferred implementation, the traffic mirroring method for the virtual port further includes:
and if the virtual machines where the virtual machine to be configured and the target virtual port are located are both in the starting state, judging that all the virtual ports corresponding to the target mapping relation exist.
It is understood that, because the target mapping relationship refers to a mapping relationship between a source virtual port and a destination virtual port, the virtual ports corresponding to the target mapping relationship include two types of virtual ports, one is the source virtual port and the other is the destination virtual port, and whether the source virtual port and the destination virtual port exist is determined by the on-off state of the virtual machine in which the source virtual port and the destination virtual port are located.
Therefore, when detecting that the virtual machines corresponding to the source virtual port and the destination virtual port are both in the boot state, it can be determined that all the virtual ports corresponding to the target mapping relationship exist. And the virtual machine where the source virtual port is located is the virtual machine to be configured, so that when the virtual machines where the virtual machine to be configured and the destination virtual port are located are detected to be in the starting state, all the virtual ports corresponding to the target mapping relation can be judged to exist. Obviously, through such an operation mode, a tedious step of detecting the source virtual port and the destination virtual port one by one can be avoided, so that the detection process for detecting whether the virtual port exists is simpler, more convenient and more efficient.
Based on the foregoing embodiments, this embodiment further describes and optimizes the technical solution, and as a preferred implementation, the target virtual port is specifically a virtual port on the target virtual machine;
the target virtual machine is a virtual machine except the virtual machine to be configured in the host.
Specifically, in this embodiment, the destination virtual port may be set as a virtual port on the target virtual machine, that is, the destination virtual port is set as a virtual port on a virtual machine other than the virtual machine to be configured in the host. Referring to fig. 4, fig. 4 is a schematic view illustrating a traffic mirroring of a virtual port according to an embodiment of the present invention, in fig. 4, when it is required to mirror a virtual port 1 on a virtual machine 1 in a host 1 to a virtual port 2 on a virtual machine 2 in the host 1, a virtual switch in the host 1 is directly used to mirror traffic in the virtual port 1 to the virtual port 2.
Obviously, because the source virtual port is located in the virtual machine to be configured, the destination virtual port is located in the target virtual machine, and the virtual machine to be configured and the target virtual machine belong to the same host, when the destination virtual port mirrors the traffic in the source virtual port, the time for mirroring the traffic in the source virtual port to the destination virtual port can be relatively shortened, and thus the traffic mirroring efficiency of the destination virtual machine port to the source virtual port is improved.
Based on the foregoing embodiments, this embodiment further describes and optimizes the technical solution, and as a preferred implementation, the target virtual port is specifically a virtual port on the remote virtual machine.
In practical applications, the destination virtual port may also be set as a virtual port on a remote virtual machine. Referring to fig. 4, fig. 4 is a schematic view illustrating a traffic mirroring of a virtual port according to an embodiment of the present invention, in fig. 4, when it is required to mirror a virtual port 1 on a virtual machine 1 in a host 1 to a virtual port 3 on a virtual machine 3 in a remote host 2, a connection is first established through network cards on the host 1 and the host 2, and then, a virtual switch in the host 1 mirrors traffic in the virtual port 1 to the virtual port 3.
When the destination virtual port is set as the virtual port on the remote virtual machine, the worker can check the traffic change condition on the source virtual port through the virtual port on the remote virtual machine, so that the user experience of the worker in the process of using the traffic mirroring method of the virtual port can be further improved.
In addition, in practical application, the remote virtual machine may be a virtual machine corresponding to a remote notebook computer, or a virtual machine corresponding to a remote physical switch, as long as the requirement of practical application can be met, and is not specifically limited herein.
Referring to fig. 5, fig. 5 is a structural diagram of a traffic mirroring apparatus for a virtual port according to an embodiment of the present invention, where the traffic mirroring apparatus includes:
the port storage module 21 is configured to, when a source virtual port of a virtual machine to be configured needs to be mirrored to a destination virtual port, store a target mapping relationship between the source virtual port and the destination virtual port to a virtual switch to which the virtual machine to be configured is connected;
a port detection module 22, configured to detect whether all virtual ports corresponding to the target mapping relationship exist;
the port configuration module 23 is configured to, when the determination result of the port detection module 22 is negative, monitor all virtual ports corresponding to the target mapping relationship in real time, and send an operation instruction for configuring the target mapping relationship to an operating system of a host where the virtual machine to be configured is located when it is monitored that all virtual ports corresponding to the target mapping relationship exist, so as to mirror the traffic of the source virtual port to the destination virtual port by using the virtual switch.
The flow mirroring device of the virtual port provided by the embodiment of the invention has the beneficial effects of the flow mirroring method of the virtual port disclosed by the embodiment.
Referring to fig. 6, fig. 6 is a structural diagram of a traffic mirroring device of a virtual port according to an embodiment of the present invention, where the traffic mirroring device includes:
a memory 31 for storing a computer program;
a processor 32 for implementing the steps of a traffic mirroring method for a virtual port as disclosed in the foregoing when executing the computer program.
The flow mirroring device of the virtual port provided by the embodiment of the invention has the beneficial effects of the flow mirroring method of the virtual port disclosed by the embodiment.
Correspondingly, the embodiment of the present invention also discloses a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the traffic mirroring method for a virtual port as disclosed above are implemented.
The computer-readable storage medium provided by the embodiment of the invention has the beneficial effects of the flow mirroring method of the virtual port disclosed in the foregoing.
The embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The method, the apparatus, the device and the medium for mirroring the traffic of the virtual port provided by the present invention are described in detail above, and a specific example is applied in the present disclosure to explain the principle and the implementation of the present invention, and the description of the above embodiment is only used to help understanding the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (9)

1. A traffic mirroring method for a virtual port, comprising:
when a source virtual port of a virtual machine to be configured needs to be mirrored to a destination virtual port, storing a target mapping relation between the source virtual port and the destination virtual port to a virtual switch connected with the virtual machine to be configured;
detecting whether all virtual ports corresponding to the target mapping relation exist or not;
if not, monitoring all virtual ports corresponding to the target mapping relationship in real time, and sending an operation instruction for configuring the target mapping relationship to an operating system of a host where the virtual machine to be configured is located when all the virtual ports corresponding to the target mapping relationship are monitored to be present, so that the virtual switch is utilized to mirror the flow of the source virtual port to the target virtual port.
2. The traffic mirroring method according to claim 1, wherein the number of the source virtual ports is one or more.
3. The traffic mirroring method according to claim 1, wherein after the step of detecting whether all the virtual ports corresponding to the target mapping relationship exist, the method further comprises:
if so, sending an operation instruction for configuring the target mapping relation to an operating system of a host where the virtual machine to be configured is located, so as to utilize a virtual switch connected with the virtual machine to be configured to mirror the flow of the source virtual port to the destination virtual port.
4. The traffic mirroring method of claim 1, further comprising:
and if the virtual machines where the virtual machine to be configured and the target virtual port are located are both in a starting state, judging that all the virtual ports corresponding to the target mapping relation exist.
5. The traffic mirroring method according to any one of claims 1 to 4, wherein the destination virtual port is specifically a virtual port on a target virtual machine; and the target virtual machine is a virtual machine except the virtual machine to be configured in the host.
6. The traffic mirroring method according to any one of claims 1 to 4, wherein the destination virtual port is specifically a virtual port on a remote virtual machine.
7. An apparatus for traffic mirroring of a virtual port, comprising:
the port storage module is used for storing a target mapping relation between a source virtual port and a target virtual port to a virtual switch connected with a virtual machine to be configured when the source virtual port of the virtual machine to be configured needs to be mirrored to the target virtual port;
a port detection module, configured to detect whether all virtual ports corresponding to the target mapping relationship exist;
and the port configuration module is used for monitoring all virtual ports corresponding to the target mapping relationship in real time when the judgment result of the port detection module is negative, and sending an operation instruction for configuring the target mapping relationship to an operating system of a host where the virtual machine to be configured is located until all the virtual ports corresponding to the target mapping relationship are monitored to exist, so that the virtual switch is utilized to mirror the flow of the source virtual port to the target virtual port.
8. A traffic mirroring apparatus for a virtual port, comprising:
a memory for storing a computer program;
a processor for implementing the steps of a method of traffic mirroring of a virtual port as claimed in any one of claims 1 to 6 when executing said computer program.
9. A computer-readable storage medium, having stored thereon a computer program which, when executed by a processor, performs the steps of a method for traffic mirroring of a virtual port as claimed in any one of claims 1 to 6.
CN201911053741.5A 2019-10-31 2019-10-31 Method, device, equipment and medium for mirroring flow of virtual port Pending CN111224899A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911053741.5A CN111224899A (en) 2019-10-31 2019-10-31 Method, device, equipment and medium for mirroring flow of virtual port

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911053741.5A CN111224899A (en) 2019-10-31 2019-10-31 Method, device, equipment and medium for mirroring flow of virtual port

Publications (1)

Publication Number Publication Date
CN111224899A true CN111224899A (en) 2020-06-02

Family

ID=70830534

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911053741.5A Pending CN111224899A (en) 2019-10-31 2019-10-31 Method, device, equipment and medium for mirroring flow of virtual port

Country Status (1)

Country Link
CN (1) CN111224899A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114327262A (en) * 2021-12-10 2022-04-12 山东云海国创云计算装备产业创新中心有限公司 Method and device for maintaining port mapping for intelligent network card
CN114884905A (en) * 2022-04-18 2022-08-09 深信服科技股份有限公司 Flow mirroring method, device, equipment and computer storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101051948A (en) * 2007-05-17 2007-10-10 中兴通讯股份有限公司 System and method for realizing multiple link point-to-point silent interception by port image
US20120082162A1 (en) * 2009-06-11 2012-04-05 Zte Corporation Method and Router for Implementing Mirroring
CN105743734A (en) * 2016-01-22 2016-07-06 北京航空航天大学 Virtual machine mirror image flow transmission control method and virtual machine mirror image flow transmission control device
US20160294731A1 (en) * 2015-04-01 2016-10-06 Brocade Communications Systems, Inc. Techniques For Facilitating Port Mirroring In Virtual Networks
US20180241610A1 (en) * 2017-02-21 2018-08-23 Nicira, Inc. Port mirroring in a virtualized computing environment
US20190306084A1 (en) * 2017-01-16 2019-10-03 Fujitsu Limited Computer-readable recording medium recording port switching program and port switching method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101051948A (en) * 2007-05-17 2007-10-10 中兴通讯股份有限公司 System and method for realizing multiple link point-to-point silent interception by port image
US20120082162A1 (en) * 2009-06-11 2012-04-05 Zte Corporation Method and Router for Implementing Mirroring
US20160294731A1 (en) * 2015-04-01 2016-10-06 Brocade Communications Systems, Inc. Techniques For Facilitating Port Mirroring In Virtual Networks
CN105743734A (en) * 2016-01-22 2016-07-06 北京航空航天大学 Virtual machine mirror image flow transmission control method and virtual machine mirror image flow transmission control device
US20190306084A1 (en) * 2017-01-16 2019-10-03 Fujitsu Limited Computer-readable recording medium recording port switching program and port switching method
US20180241610A1 (en) * 2017-02-21 2018-08-23 Nicira, Inc. Port mirroring in a virtualized computing environment

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114327262A (en) * 2021-12-10 2022-04-12 山东云海国创云计算装备产业创新中心有限公司 Method and device for maintaining port mapping for intelligent network card
CN114327262B (en) * 2021-12-10 2024-03-08 山东云海国创云计算装备产业创新中心有限公司 Method and device for maintaining port mapping of intelligent network card
CN114884905A (en) * 2022-04-18 2022-08-09 深信服科技股份有限公司 Flow mirroring method, device, equipment and computer storage medium
CN114884905B (en) * 2022-04-18 2023-11-07 深信服科技股份有限公司 Traffic mirroring method, traffic mirroring device, traffic mirroring equipment and computer storage medium

Similar Documents

Publication Publication Date Title
CN105095001A (en) Virtual machine exception recovery method under distributed environment
CN111478796B (en) A cluster expansion exception handling method for AI platform
CN104486108A (en) Node configuration method base on Zookeeper and node configuration system based on Zookeeper
WO2018095414A1 (en) Method and apparatus for detecting and recovering fault of virtual machine
CN102891762B (en) The system and method for network data continuously
US10102088B2 (en) Cluster system, server device, cluster system management method, and computer-readable recording medium
CN106407045A (en) Data disaster recovery method and system, and server virtualization system
CN106547645B (en) Method for automatically restoring image file and server system
CN111224899A (en) Method, device, equipment and medium for mirroring flow of virtual port
CN108933706B (en) A method, device and system for monitoring data flow
CN105049284A (en) Linux system-based network redundancy testing method and device
CN102523209B (en) Dynamic adjustment method and device of safety inspection virtual machines
CN110798347B (en) Service state detection method, device, equipment and storage medium
EP3240233A1 (en) Power fail safeguard method, device and system thereof
CN106911508B (en) DNS configuration recovery method and device
GB2532076A (en) Backup method, pre-testing method for environment updating and system thereof
CN116820686B (en) Physical machine deployment method, virtual machine and container unified monitoring method and device
CN117632354A (en) Container fault processing method, device, equipment and computer storage medium
CN106330537B (en) SDN network equipment control surface management device and method
CN116974834A (en) Virtual cloud desktop fault detection method, device, equipment and readable storage medium
CN106533818B (en) Monitoring method and communication method, system and equipment based on NFV resource pool
CN110188007B (en) Distributed data repair method, device, network node and storage medium
CN114356810A (en) Communication connection method, device, equipment and medium for host and storage system
CN115665035A (en) An information processing method, device, first node, and storage medium
CN110297741B (en) Background task monitoring method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20200602

RJ01 Rejection of invention patent application after publication