Message mirroring method, electronic device and storage medium

By using loopback ports and vlan broadcasting methods in network devices, packet mirroring is simplified, the problems of high complexity and difficult to achieve remote mirroring in the prior art are solved, and efficient multi-destination port mirroring is achieved.

CN119766824APending Publication Date: 2025-04-04ZTE CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311281997.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-28
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

In the prior art, the message mirroring is complex and requires external equipment, which leads to trouble networking and cannot effectively solve the problem of remote mirroring.

Method used

The mirrored packet is looped back to the virtual LAN vlan through the first loopback port of the network device, and then the mirrored packet is broadcasted through the vlan to achieve the mirroring of the target mirrored port.

Benefits of technology

Message mirroring is implemented without external devices, reducing the complexity of message mirroring and supporting local and remote multi-destination port mirroring at the same time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119766824A_ABST
    Figure CN119766824A_ABST
Patent Text Reader

Abstract

The embodiment of the present application relates to a message mirroring method, an electronic device and a storage medium, the method comprising: looping back the mirrored message of the network device to the virtual local area network (VLAN) of the network device through the first loopback port of the network device; broadcasting the mirrored message through the VLAN, and mirroring the mirrored message to the target mirroring port. Thus, message mirroring can be realized without connecting other external devices, reducing the complexity of message mirroring.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a message mirroring method, electronic device and storage medium. Background Art

[0002] Port mirroring technology is to mirror the traffic of a certain port to the destination port completely or according to certain conditions, so that the server or observation device connected to the destination port can monitor the traffic of the port.

[0003] In the related art, the traffic sent from the local mirror destination port can be decomposed by means of an optical splitter or an external device, but this method requires other external devices, which is more troublesome for networking.

[0004] It can be seen that how to reduce the complexity of message mirroring is a technical issue worthy of attention. Summary of the invention

[0005] In view of this, in order to solve some or all of the above technical problems, an embodiment of the present application provides a message mirroring method, an electronic device and a storage medium.

[0006] In a first aspect, an embodiment of the present application provides a method for mirroring a message, the method comprising:

[0007] Looping back the mirrored message of the network device to the virtual local area network (vlan) of the network device through the first loopback port of the network device;

[0008] The mirrored message is broadcasted through the vlan, and the mirrored message is mirrored to the target mirrored port.

[0009] In a second aspect, an embodiment of the present application provides an electronic device, including:

[0010] Memory for storing computer programs;

[0011] The processor is used to execute the computer program stored in the memory, and when the computer program is executed, the method of any embodiment of the method for mirroring a message in the first aspect of the present application is implemented.

[0012] In a third aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method of any embodiment of the method for mirroring a message in the first aspect described above is implemented.

[0013] In a fourth aspect, an embodiment of the present application provides a computer program, which includes a computer-readable code. When the computer-readable code is executed on a device, a processor in the device implements a method as in any embodiment of the method for mirroring a message in the first aspect described above.

[0014] The message mirroring method provided in the embodiment of the present application can loop back the mirrored message of the network device to the virtual local area network VLAN of the network device through the first loopback port of the network device, and then broadcast the mirrored message through the VLAN so as to mirror the mirrored message to the target mirroring port. Thus, message mirroring can be realized without connecting other external devices, which reduces the complexity of message mirroring. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0016] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0017] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.

[0018] Figure 1 A schematic diagram of a flow chart of a method for mirroring a message provided in an embodiment of the present application;

[0019] Figure 2 A flowchart of another method for mirroring a message provided in an embodiment of the present application;

[0020] Figure 3 A flowchart of another method for mirroring a message provided in an embodiment of the present application;

[0021] Figure 4 A schematic diagram of a mirroring method for processing a message provided in an embodiment of the present application;

[0022] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0023] Various exemplary embodiments of the present application will now be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. It should be noted that unless otherwise specifically stated, the relative arrangement of the components and steps, the numerical expressions and the numerical values ​​described in these embodiments do not limit the scope of the present application.

[0024] Those skilled in the art will understand that the terms "first" and "second" in the embodiments of the present application are only used to distinguish between different steps, devices, modules and other objects, and do not represent any specific technical meanings, nor do they indicate the logical order between them.

[0025] It should also be understood that in this embodiment, “plurality” may refer to two or more than two, and “at least one” may refer to one, two or more than two.

[0026] It should also be understood that any component, data or structure mentioned in the embodiments of the present application can generally be understood as one or more, unless explicitly limited or otherwise indicated in the context.

[0027] In addition, the term "and / or" in this application is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this application generally indicates that the associated objects before and after are in an "or" relationship.

[0028] It should also be understood that the description of the various embodiments in this application focuses on the differences between the various embodiments, and the same or similar aspects thereof can be referenced to each other, and for the sake of brevity, they will not be described one by one.

[0029] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the present application, its application, or uses.

[0030] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the above-mentioned technologies, methods, and equipment should be considered as part of the specification.

[0031] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.

[0032] It should be noted that, in the absence of conflict, the embodiments in this application and the features in the embodiments can be combined with each other. To facilitate the understanding of the embodiments of the present application, the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0033] In order to solve the technical problem of how to simplify the complexity of message mirroring in the prior art, the present application provides a message mirroring method, which can simplify the complexity of message mirroring.

[0034] Figure 1 A flow chart of a method for mirroring a message provided in an embodiment of the present application. The method can be applied to one or more electronic devices such as routers and switches. In addition, the execution subject of the method can be hardware or software. When the above-mentioned execution subject is hardware, the execution subject can be one or more of the above-mentioned electronic devices. For example, a single electronic device can execute the method, or multiple electronic devices can cooperate with each other to execute the method. When the above-mentioned execution subject is software, the method can be implemented as multiple software or software modules, or as a single software or software module. No specific limitation is made here.

[0035] like Figure 1 As shown, the method specifically includes:

[0036] Step 101: looping back the mirrored message of the network device to the virtual local area network (vlan) of the network device through the first loopback port of the network device.

[0037] In this embodiment, the network device may be a switch, a router or other device.

[0038] The first loopback port can be any port in the network device that is configured as a loopback port. The loopback port can be a logical, virtual interface (i.e., port) on the above network device. In practice, one or more loopback ports can be created as needed. These loopback ports are treated the same as physical interfaces on the network device. For example, they can be assigned addressing information, including their network numbers in the network device selection update, and even IP (Internet Protocol) connections can be terminated on them. The loopback port can occupy an IP address exclusively.

[0039] Step 102: broadcast the mirrored message through the VLAN, and mirror the mirrored message to the target mirrored port.

[0040] In this embodiment, the target mirror port may be one or more destination ports. As an example, the target mirror port may include one or more local ports of a network device, and / or the target mirror port may also include one or more ports of a remote device. The remote device may be another network device other than the above network device.

[0041] In some implementations of this embodiment, the ingress VLAN check function of the first loopback port is configured to be in a closed state.

[0042] It can be understood that in the above implementation, the ingress VLAN check function of the first loopback port is configured to be in a closed state, which can prevent the mirrored message carrying the VLAN header from being discarded by the VLAN check process.

[0043] In some implementations of this embodiment, before the mirrored message of the network device is looped back to the virtual local area network (VLAN) of the network device through the first loopback port of the network device, the first loopback port is configured as: a member port of the VLAN and a destination port of a mirrored source port, wherein the mirrored source port is a source port for sending the mirrored message.

[0044] It can be understood that for the local mirror port of the network device, after the mirror source port of the network device is configured, the source port can mirror the message. At this time, the mirror destination port of the mirror source port of the network device can be configured as the first loopback port, and the mirror message is looped back through the first loopback port. At this time, the first loopback port belongs to a certain vlan, and other locally required mirror destination ports (that is, target mirror ports) are configured as member ports of this vlan. After the looped-back message enters this vlan, the message will be broadcast and sent within the vlan, so that all subsequent locally required mirror destination ports of the network device can receive this mirror message, so that the same mirror message can be mirrored to one or more different local ports at the same time.

[0045] The message mirroring method provided in the embodiment of the present application can loop back the mirrored message of the network device to the virtual local area network VLAN of the network device through the first loopback port of the network device, and then broadcast the mirrored message through the VLAN so as to mirror the mirrored message to the target mirroring port. Thus, message mirroring can be realized without connecting other external devices, which reduces the complexity of message mirroring.

[0046] Figure 2 A flowchart of another method for mirroring a message provided in an embodiment of the present application. Figure 2 As shown, the method specifically includes:

[0047] Step 201: looping back the mirrored message of the network device to the virtual local area network (vlan) of the network device through the first loopback port of the network device.

[0048] In this embodiment, step 201 and Figure 1 Step 101 in the corresponding embodiment is basically the same and will not be described again here.

[0049] Step 202, when the target mirror port is a local port of the network device, broadcast the mirror message through the VLAN, and directly mirror the mirror message to the local port.

[0050] In this embodiment, the local port may be one or more local ports of the network device.

[0051] In some implementations of this embodiment, the member port of the VLAN is configured with the local port.

[0052] Attach Figure 4 For example, if a network device has a mirror source (either a single port or multiple ports), and needs to be mirrored to the local destination port 1 and destination port 2 of the network device, then the local multi-destination port mirroring can be configured as follows:

[0053] 1. Set the destination port of the mirror source (for example, any destination port) as the first loopback port.

[0054] 2. Add the first loopback port to the internal VLAN used for multi-port mirroring. For example, if VLAN 100 is used, add the first loopback port to VLAN 100.

[0055] 3. Disable the ingress VLAN check function of the first loopback port to prevent the mirrored message from being discarded by the VLAN check function when it carries a VLAN header.

[0056] 4. Add multiple local destination ports 2 and 3 to vlan100.

[0057] 5. At this time, the mirrored traffic of the mirrored source will be looped back to vlan100 through the first loopback port, and vlan100 will broadcast and send the message to multiple local destination mirrored ports.

[0058] It should be noted that, in addition to the above contents, this embodiment may also include Figure 1 The corresponding technical features described in the corresponding embodiments are realized Figure 1 For details, please refer to the technical effect of the mirroring method of the message shown. Figure 1 For the sake of brevity, the relevant description is not repeated here.

[0059] The message mirroring method provided in the embodiment of the present application, for the local mirror port of the network device, after the mirror source port of the network device is configured, the source port can mirror the message out, and at this time the mirror destination port of the network device can be configured as the first loopback port, and the mirror message is looped back through the first loopback port. At this time, the first loopback port belongs to a certain VLAN, and other locally required mirror destination ports (that is, target mirror ports) are configured as member ports of this VLAN. After the looped-back message enters this VLAN, the message will be broadcast and sent within the VLAN, thereby, all locally required mirror destination ports of the network device can receive the mirror message, so that the same mirror message can be mirrored to one or more different local ports at the same time.

[0060] Figure 3 A flowchart of another method for mirroring a message provided in an embodiment of the present application is shown below. Figure 3 As shown, the method specifically includes:

[0061] Step 301: looping back the mirrored message of the network device to the virtual local area network (vlan) of the network device through the first loopback port of the network device.

[0062] In this embodiment, step 301 and Figure 1 Step 101 in the corresponding embodiment is basically the same and will not be described again here.

[0063] Step 302: when the target mirror port is a port of a remote device, broadcast the mirror message through the VLAN.

[0064] In this embodiment, the remote device may be one or more other network devices except the above network devices.

[0065] 303. Send the mirrored message to the second loopback port through the VLAN, wherein the second loopback port is a loopback port in the network device corresponding to the remote device.

[0066] In this embodiment, the second loopback port may be any loopback port in the network device that is different from the first loopback port.

[0067] 304 , encapsulate the mirrored message through the second loopback port, and loop back the encapsulated message to the forwarding chip of the network device.

[0068] 305 , mirroring the mirrored message to the port of the remote device through the forwarding chip.

[0069] In this embodiment, for the port of the remote device, message encapsulation (such as SPAN, ERSPAN and other mirroring methods) is required, and at this time, it corresponds to the required encapsulation type of the remote loopback. At this time, a mirror message will be sent to the second loopback port, and the message type that needs to be encapsulated is configured on the inlet side of the second loopback port. After the mirror stream passes through the second loopback port, it will be encapsulated with the message header of the remote mirror. At this time, the forwarding chip can be used to look up the table, and it can be sent to the remote device according to the path required by the mirror port of the remote device (that is, the above-mentioned target mirror port).

[0070] In some implementations of this embodiment, the member ports of the VLAN include the second loopback port, the encapsulation type configured on the second loopback port is the encapsulation type corresponding to the remote device, and only one encapsulation type is configured on each second loopback port.

[0071] As an example, you can use the following method to set up multi-destination port mirroring on a remote device:

[0072] 1. If the remote mirroring destination is ERSPAN mirroring.

[0073] 2. Set the second loopback port as a vlan100 member port.

[0074] 3. Disable the ingress VLAN check function of the second loopback port to prevent the mirrored message from being discarded by the VLAN check function when it carries a VLAN header.

[0075] 4. Set the second loopback port ERSPAN to encapsulate the remote device IP address and other information.

[0076] 5. Set the chip routing table related remote ERSPAN routing and other information.

[0077] 6. At this time, the mirrored message of the mirrored source will be looped back to vlan100 through the first loopback port, and vlan100 will broadcast the message to the second loopback port. The second loopback port will loop back and add the ERSPAN message header information. After the forwarding chip searches the chip routing table, it will find the remote device route and forward it from the current network device to the remote device.

[0078] 7. If there is another remote device 2 (that is, another remote device) and SPAN remote mirror encapsulation is required, the third loopback port loopback3 is added to the vlan in the same way, and the SPAN encapsulation configuration is configured on loopback3. The message will be looped back to vlan100 through the first loopback port in the same way, and vlan100 will broadcast the message to the third loopback port. The third loopback port will loop back and add the SPAN message header information. After the forwarding chip searches the chip routing table, it will find the remote device route and forward it from the current network device to the remote device 2.

[0079] 8. Similar to step 7, if more remote devices need to be added, just add the corresponding loopback ports and configure them in vlan100, and configure the encapsulation information related to the added loopback ports on the loopback ports.

[0080] It can be understood that for the port of the remote device, since it is necessary to perform message encapsulation (such as SPAN, ERSPAN and other mirroring methods for encapsulation), at this time, it corresponds to the required encapsulation type of the remote loopback. Therefore, the second loopback port can be configured to belong to the member port for the local destination port broadcast VLAN mentioned above. At this time, a mirror message will be sent to the second loopback port. At this time, the message type that needs to be encapsulated is configured on the inlet side of the second loopback port. After the mirror stream passes through the second loopback port, it will be encapsulated with the message header of the remote mirror. At this time, the forwarding chip can be used to look up the table, and it can be sent to the remote device according to the path required by the port of the remote device.

[0081] In some implementations of this embodiment, the mirrored message may be mirrored to the port of the remote device through the forwarding chip in the following manner:

[0082] First, according to the encapsulation type of the mirror message, the target device address of the remote device is determined through the routing table in the forwarding chip.

[0083] The target device address may be an address of a remote device.

[0084] The routing table includes a correspondence between encapsulation types and device addresses of remote devices, and each remote device corresponds to one encapsulation type.

[0085] Afterwards, the mirrored message is sent to the remote device via the target device address.

[0086] It can be understood that in the above implementation, the correspondence between the encapsulation type and the device address of the remote device is determined by the routing table, thereby, the mirrored message can be mirrored to the port of the remote device through the encapsulation address corresponding to the encapsulation type configured on the second loopback port.

[0087] It should be noted that, in addition to the above contents, this embodiment may also include Figure 1 The corresponding technical features described in the corresponding embodiments are realized Figure 1 For details, please refer to the technical effect of the mirroring method of the message shown. Figure 1 For the sake of brevity, the relevant description is not repeated here.

[0088] The message mirroring method provided in the embodiment of the present application can send the mirrored message to one or more remote devices according to the address required by the port of the remote device through a table lookup by a forwarding chip.

[0089] The following is an illustrative description of the embodiments of the present application, but it should be noted that the embodiments of the present application may have the features described below, but the following description does not constitute a limitation on the scope of protection of the embodiments of the present application.

[0090] First, the technical terms involved in this application are explained as follows:

[0091] Port mirroring technology is to mirror the traffic (i.e., messages) of a port to the destination port completely or according to certain conditions, so that the server or observation device connected to the destination port can monitor the traffic of the port. Mirroring technology can be generally divided into local mirroring and remote mirroring. Local mirroring is to directly mirror the port data on the network device to the destination port, and remote mirroring is to encapsulate the port data on the network device and send it to the remote device for mirroring processing.

[0092] Generally, in the related technologies, the port mirroring function mainly adopts one-to-one mirroring or many-to-one mirroring, that is, there are one or more source ports and only one destination port. In some technologies, the destination port can be an aggregation link port, but although there are multiple aggregation link ports, the mirrored data stream is still one copy, but the bandwidth of the destination port is expanded by means of the aggregation link.

[0093] However, as operators are placing increasingly high demands on the reliability of network equipment, they need to monitor the port traffic of certain network devices in multiple ways at the same time. Therefore, they may access ports through multiple devices for mirroring, and some devices may even be local devices while others are remote devices, and the traffic of a certain port needs to be monitored at the same time.

[0094] In the related art, the traffic sent from the local mirroring destination port can be further decomposed by means of a splitter or external devices, but this method requires other external devices, which is troublesome for networking and cannot solve the problem of simultaneous remote mirroring.

[0095] In view of this, this method enables a mirrored data stream (i.e. the mirrored message) to be sent to multiple destination ports, and the destination ports can be different remote mirrored ports (i.e. the ports of the remote device). This method can be used to observe the mirrored traffic of network devices both locally and remotely, without adding any other external auxiliary equipment.

[0096] This method uses the loopback port inside the device (that is, the first loopback port mentioned above) to introduce the mirrored message into the loopback port, and then sends it from the loopback port to the VLAN for broadcasting, thereby completing local multi-port mirroring. If there is a port that requires remote mirroring, another loopback port (that is, the second loopback port mentioned above) can be added to the VLAN, and the message sent back from the loopback port can be forwarded to the required remote mirror port in the manner of remote message mirroring.

[0097] Specifically, first, for the local mirror port (that is, the local port mentioned above), after setting the mirror source port, the source port can mirror the traffic. At this time, the mirror destination port is set to loopback port 1 (that is, the first loopback port mentioned above). Loopback port 1 needs to be configured not to perform VLAN check (to prevent the mirror message carrying the VLAN header from being discarded by the VLAN check process). The message is looped back through loopback port 1. At this time, the loopback port is set to belong to a certain VLAN, and other locally required mirror destination ports are set as member ports of this VLAN. After the looped-back message enters this VLAN, the message will be broadcast and sent within the VLAN, so that all locally required mirror destination ports can receive this mirror traffic.

[0098] As for the remote port, since message encapsulation is required (such as SPAN, ERSPAN and other mirroring methods), at this time, corresponding to the required encapsulation type of the remote loopback, the configuration loopback port 2 (that is, the second loopback port mentioned above) belongs to the member port used for the local destination port broadcast VLAN mentioned above. At this time, a mirror message will be sent to the loopback port 2. At this time, the message type that needs to be encapsulated is configured on the inlet side of the loopback port 2. After the mirror stream passes through the loopback port 2, the message header of the encapsulated remote mirror can be sent to the remote device according to the path required by the remote mirror port (that is, the above-mentioned target device address) by looking up the table through the switching chip (that is, the above-mentioned forwarding chip).

[0099] Through the above two methods, it is possible to process local multi-port mirroring and remote port mirroring in the network device at the same time. The loopback port resources that need to be consumed can be configured by using the idle ports of the network device itself for internal loopback configuration, or directly using the built-in loopback port resources of certain chips, both of which can achieve the effect of this method.

[0100] The above completes the configuration and implementation of the multi-destination port of the message mirror. The multi-destination port mirroring implemented in this way does not require the use of new external devices, and can complete the processing of multiple remote mirror ports without increasing the computing resource consumption of the network device. It is a very simple and practical mirror processing method.

[0101] Specifically, the application environment of this method is mainly used for the scenario aggregation where the traffic of network devices requires multiple servers to perform mirror monitoring.

[0102] In order to illustrate the effectiveness process and steps of this mechanism, it is further explained in two steps.

[0103] Attach Figure 4 For example, a network device has a mirror source (single port or multiple ports), and needs to mirror to the local destination port 1, destination port 2 of the device, and the port of the remote device:

[0104] The first step is to set up local multi-destination port mirroring:

[0105] 1. Set the destination port of the mirror source to the first loopback port.

[0106] 2. Add the first loopback port to the internal VLAN used for multi-port mirroring. For example, if VLAN 100 is used, add the first loopback port to VLAN 100.

[0107] 3. Disable the ingress VLAN check function of the first loopback port to prevent the mirrored message from being discarded by the VLAN check function when it carries a VLAN header.

[0108] 4. Add multiple local mirror destination ports 2 and 3 to vlan100.

[0109] 5. At this time, the mirrored traffic of the mirrored source will be looped back to vlan100 through the first loopback port, and vlan100 will broadcast and send the message to multiple local destination mirrored ports.

[0110] The second step is to set up remote multi-destination port mirroring:

[0111] 1. If the remote mirroring destination is ERSPAN mirroring.

[0112] 2. Set the second loopback port as a vlan100 member port.

[0113] 3. Disable the ingress VLAN check function of the second loopback port to prevent the mirrored message from being discarded by the VLAN check function when it carries a VLAN header.

[0114] 4. Set the second loopback port ERSPAN to encapsulate the remote device IP address and other information.

[0115] 5. Set the chip routing table related remote ERSPAN routing and other information.

[0116] 6. At this time, the mirrored message of the mirrored source will be looped back to vlan100 through the first loopback port, and vlan100 will broadcast the message to the second loopback port. The second loopback port will loop back and add the ERSPAN message header information. After the forwarding chip searches the chip routing table, it will find the remote device route and forward it from the current network device to the remote device.

[0117] 7. If there is another remote mirroring destination device 2 (that is, another remote device) and SPAN remote mirroring encapsulation is required, then the third loopback port loopback3 is added to the vlan in the same way, and the SPAN encapsulation configuration is configured on loopback3. Then the message will be looped back to vlan100 through the first loopback port in the same way, and vlan100 will broadcast the message to the third loopback port. The third loopback port will loop back and add the SPAN message header information. After the forwarding chip searches the chip routing table, it will find the remote device route and forward it from the current network device to the remote device 2.

[0118] 8. Similar to step 7, if more remote devices need to be added, just add the corresponding loopback ports and configure them in vlan100, and configure the encapsulation information related to the added loopback ports on the loopback ports.

[0119] The above is the processing of setting up multiple local and remote destination mirror ports in the device at the same time. According to this method, you only need to perform corresponding configuration on the device to conveniently complete the forwarding of multiple local destination ports and multiple remote destination mirror devices at the same time. And multiple remote destination mirror devices can support different remote encapsulation forms.

[0120] It should be noted that, in addition to the contents recorded above, this embodiment may also include the technical features described in the above embodiments, so as to achieve the technical effect of the mirroring method of the message shown above. For details, please refer to the above description. For the sake of brevity, it will not be repeated here.

[0121] The mirroring method of the message provided in the embodiment of the present application can simultaneously complete the local multi-purpose mirroring processing through an external device. In addition, the method only needs to perform the relevant configuration of the loopback port and VLAN on the network device to complete the processing of the multi-purpose ports of a certain mirrored traffic, and can simultaneously complete the processing of the local destination mirroring port and the remote destination mirroring port. In addition, during the processing, there is no need to add new equipment, and it will not cause a large load and impact on the network equipment. It is a simple and convenient multi-purpose mirroring implementation method. The use of this technology can improve the maintainability and observability of the network, and has a richer application effect on the mirroring function of the network device. In combination with this technology, it can be applied in various network environments that require mirroring, and this technology can be used in flow mirroring, that is, the mirrored source traffic is finely processed, and the setting of the multi-purpose port is consistent with the processing method of this solution. This method allows the mirroring destination port of the network device to be changed from a traditional port to multiple ports, that is, a same mirrored traffic can be mirrored to multiple different ports at the same time, so that simultaneous observation effects can be provided for multiple different observation service servers. The use of this method can improve the maintainability and observability of the network, and has a richer application effect on the mirroring function of the network device.

[0122] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application, Figure 5 The electronic device 500 shown includes: at least one processor 501, a memory 502, at least one network interface 504 and other user interfaces 503. The various components in the electronic device 500 are coupled together via a bus system 505. It is understood that the bus system 505 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 505 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 505 is not shown in FIG. Figure 5 Various buses are labeled as bus system 505 .

[0123] The user interface 503 may include a display, a keyboard, or a pointing device (eg, a mouse, a trackball, a touch pad, or a touch screen).

[0124] It can be understood that the memory 502 in the embodiment of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct RAM bus random access memory (DRRAM). The memory 502 described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0125] In some implementations, the memory 502 stores the following elements, executable units or data structures, or a subset thereof, or an extended set thereof: an operating system 5021 and an application program 5022 .

[0126] Among them, the operating system 5021 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., which are used to implement various basic services and process hardware-based tasks. The application 5022 includes various application programs, such as a media player (Media Player), a browser (Browser), etc., which are used to implement various application services. The program for implementing the method of the embodiment of the present application can be included in the application 5022.

[0127] In this embodiment, by calling the program or instruction stored in the memory 502, specifically, the program or instruction stored in the application 5022, the processor 501 is used to execute the method steps provided by each method embodiment, for example, including:

[0128] Looping back the mirrored message of the network device to the virtual local area network (vlan) of the network device through the first loopback port of the network device;

[0129] The mirrored message is broadcasted through the vlan, and the mirrored message is mirrored to the target mirrored port.

[0130] The method disclosed in the above embodiment of the present application can be applied to the processor 501, or implemented by the processor 501. The processor 501 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 501. The above processor 501 can be a general processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to execute, or the hardware and software units in the decoding processor can be executed. The software unit can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 502, and the processor 501 reads the information in the memory 502 and completes the steps of the above method in combination with its hardware.

[0131] It is understood that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit may be implemented in one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPDevice, DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), general purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the above functions of the present application, or a combination thereof.

[0132] For software implementation, the technology described above in this article can be implemented by a unit that performs the functions described above in this article. The software code can be stored in a memory and executed by a processor. The memory can be implemented in the processor or outside the processor.

[0133] The electronic device provided in this embodiment may be Figure 5 The electronic device shown in can execute all steps of the mirroring method of each message described above, thereby achieving the technical effect of the mirroring method of each message described above. Please refer to the above related description for details. For the sake of concise description, it will not be repeated here.

[0134] The embodiment of the present application also provides a storage medium (computer-readable storage medium). The storage medium here stores one or more programs. The storage medium may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a read-only memory, a flash memory, a hard disk or a solid-state drive; the memory may also include a combination of the above-mentioned types of memory.

[0135] When one or more programs in the storage medium can be executed by one or more processors, the above-mentioned message mirroring method executed on the electronic device side can be implemented.

[0136] The processor is used to execute the message mirroring program stored in the memory to implement the following steps of the message mirroring method executed on the electronic device side:

[0137] Looping back the mirrored message of the network device to the virtual local area network (vlan) of the network device through the first loopback port of the network device;

[0138] The mirrored message is broadcasted through the vlan, and the mirrored message is mirrored to the target mirrored port.

[0139] The professionals should also be further aware that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0140] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0141] It should be understood that the terms used herein are only for the purpose of describing specific example embodiments and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used herein may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.

[0142] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A message mirroring method, comprising: Looping back the mirrored message of the network device to the virtual local area network (vlan) of the network device through the first loopback port of the network device; The mirrored message is broadcasted through the vlan, and the mirrored message is mirrored to the target mirrored port.

2. The method according to claim 1, characterized in that: In a case where the target mirror port is a local port of the network device, mirroring the mirrored message to the target mirror port includes: The mirrored message is directly mirrored to the local port.

3. The method according to claim 2, characterized in that The member port of the vlan is configured with the local port.

4. The method according to claim 1, characterized in that In a case where the target mirror port is a port of a remote device, mirroring the mirrored message to the target mirror port includes: Sending the mirrored message to a second loopback port through the vlan, wherein the second loopback port is a loopback port in the network device corresponding to the remote device, and the remote device is a network device other than the network device; Encapsulating the mirrored message through the second loopback port, and looping the encapsulated message back to the forwarding chip of the network device; The mirrored message is mirrored to the port of the remote device through the forwarding chip.

5. The method according to claim 4, characterized in that The member ports of the vlan include the second loopback port, the encapsulation type configured on the second loopback port is the encapsulation type corresponding to the remote device, and only one encapsulation type is configured on each of the second loopback ports.

6. The method according to claim 4, characterized in that The mirroring of the mirrored message to the port of the remote device through the forwarding chip includes: According to the encapsulation type of the mirrored message, the target device address of the remote device is determined through the routing table in the forwarding chip, wherein the routing table includes a correspondence between the encapsulation type and the device address of the remote device, and each remote device corresponds to one encapsulation type; The mirrored message is sent to the remote device via the target device address.

7. The method according to any one of claims 1 to 6, characterized in that: The ingress VLAN check function of the first loopback port is configured to be in a closed state.

8. The method according to any one of claims 1 to 6, characterized in that: Before looping back the mirrored message of the network device to the virtual local area network (VLAN) of the network device through the first loopback port of the network device, the first loopback port is configured as: a member port of the VLAN and a destination port of a mirrored source port, wherein the mirrored source port is a source port for sending the mirrored message.

9. A network device, characterized in that: include: Memory for storing computer programs; A processor, configured to execute a computer program stored in the memory, and when the computer program is executed, implement the method described in any one of claims 1 to 8.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method described in any one of claims 1 to 8 is implemented.