Message mirroring method, network device and storage medium
By setting a mirror destination port outside the multicast group and using the multicast replication process, the problem of network processor forwarding resource occupation is solved, efficient message mirroring is achieved, and the forwarding performance of the network processor is improved.
Patent Information
- Application Number
- CN202010543257.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-15
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2040-06-15
AI Technical Summary
The existing port mirroring function is implemented through additional lines of code of the network processor, which occupies forwarding resources and causes the forwarding performance of the network processor to degrade.
By obtaining the target message to be mirrored, determining the multicast group to forward the target message, setting the port outside the multicast group as the mirror destination port, and using the existing multicast replication process for mirroring, the forwarding resources of the network processor are avoided from being occupied.
Without occupying the forwarding resources of the network processor, message mirroring is achieved, which relieves the forwarding resource pressure of the network processor and improves forwarding performance.
Smart Images

Figure CN113810315B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a message mirroring method, network equipment and storage medium. Background Art
[0002] Port mirroring monitors the network by forwarding packets from a specific port on a switch or router to a designated port. The mirrored port is called the "source port," and the designated port is called the "destination port." Without affecting the normal throughput of the source port, the mirrored port allows for monitoring and analysis of network traffic. Using port mirroring within an enterprise effectively monitors and manages internal network data, allowing for rapid fault location in the event of a network failure.
[0003] However, the existing port mirroring function is implemented by a network processor through additional lines of code, which occupies the forwarding resources of the network processor and reduces the forwarding performance of the network processor. Summary of the Invention
[0004] The following is a summary of the subject matter described in detail herein. This summary is not intended to limit the scope of the claims.
[0005] The embodiments of the present invention provide a message mirroring method, a network device, and a storage medium, which can alleviate the forwarding resource pressure of a network processor and improve the forwarding performance of the network processor.
[0006] In a first aspect, an embodiment of the present invention provides a message mirroring method, the method comprising:
[0007] Obtaining a target message to be mirrored and determining a multicast group to forward the target message;
[0008] Setting at least one port outside the multicast group as a destination port for mirroring the target message, and adding the destination port as an egress port of the multicast group;
[0009] Perform multicast replication on the target message.
[0010] In a second aspect, an embodiment of the present invention further provides a network device comprising at least one processor and a memory for communicating with the at least one processor; the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the message mirroring method as described in the first aspect.
[0011] In a third aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the message mirroring implementation method described in the first aspect.
[0012] An embodiment of the present invention includes: obtaining a target message to be mirrored, determining a multicast group to forward the target message, setting at least one port outside the multicast group as a destination port for mirroring the target message, adding the destination port as an egress port of the multicast group, and performing multicast replication on the target message. Therefore, the target message can be replicated using the existing multicast replication process in the multicast group and then sent to the destination port, thereby achieving the purpose of mirroring without occupying the forwarding resources of a network processor, thereby alleviating the forwarding resource pressure of the network processor and improving the forwarding performance of the network processor.
[0013] Other features and advantages of the present invention will be described in the following description, and in part will become apparent from the description, or will be understood by practicing the present invention. The purposes and other advantages of the present invention can be realized and obtained through the structures particularly pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The accompanying drawings are used to provide a further understanding of the technical solution of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the technical solution of the present invention and do not constitute a limitation to the technical solution of the present invention.
[0015] Figure 1 This is a flowchart of the steps of the message mirroring method provided by an embodiment of the present invention;
[0016] Figure 2 This is a flowchart of the specific steps for determining a multicast group to which a target message is forwarded, provided by an embodiment of the present invention;
[0017] Figure 3 This is a flowchart of the specific steps for determining a multicast group for forwarding a target message based on a network location when a source port is located on a local network device, provided by an embodiment of the present invention;
[0018] Figure 4 This is a flowchart of the specific steps for determining the multicast group to which a source port belongs, provided by an embodiment of the present invention;
[0019] Figure 5 This is a flowchart of the specific steps for determining a multicast group to which a target message is forwarded based on a network location when a source port is located on a remote network device, provided by an embodiment of the present invention;
[0020] Figure 6This is a flowchart of the specific steps for adding a destination port as an egress port of a multicast group when the number of destination ports can be multiple, provided by an embodiment of the present invention;
[0021] Figure 7 This is an overall flow chart of the effectiveness of the message mirroring method provided by an embodiment of the present invention;
[0022] Figure 8 This is a flow chart of source port determination of a message mirroring method provided by an embodiment of the present invention;
[0023] Figure 9 This is a flow chart of target message duplication of a message mirroring method provided by an embodiment of the present invention;
[0024] Figure 10 This is a schematic diagram of a network architecture for one-to-one mirroring of target messages of a multicast group inbound port provided by an embodiment of the present invention;
[0025] Figure 11 1. This is a schematic diagram of a one-to-many mirroring network architecture for target messages of a multicast group inbound port provided by an embodiment of the present invention;
[0026] Figure 12 This is a schematic diagram of a network architecture for one-to-one mirroring of multiple target messages provided by an embodiment of the present invention;
[0027] Figure 13 Schematic diagram of the network architecture of remote mirroring of a multicast group inbound port provided by an embodiment of the present invention;
[0028] Figure 14 It is a structural diagram of a network device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0029] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0030] It should be understood that in the description of the embodiments of the present invention, "multiple" (or multiple) means more than two, "greater than," "less than," and "exceed" are understood to exclude the number itself, and "above," "below," and "within" are understood to include the number itself. The terms "first," "second," and so on are used solely to distinguish technical features and are not to be construed as indicating or implying relative importance, or implicitly indicating the number of the indicated technical features, or implicitly indicating the order of the indicated technical features.
[0031] The embodiments of the present invention provide a message mirroring method, a network device, and a storage medium, which can alleviate the forwarding resource pressure of a network processor and improve the forwarding performance of the network processor.
[0032] Reference Figure 1 The embodiment of the present invention provides a message mirroring method, which is exemplarily applied to a network device, which may be, but is not limited to, a switch, a router, and the like. The following description will be made using a switch as an example.
[0033] The message mirroring method includes but is not limited to the following steps 101 to 103:
[0034] Step 101: Obtain the target message to be mirrored and determine the multicast group to which the target message is forwarded;
[0035] Wherein, in step 101, the target message to be mirrored is the message passing through the source port.
[0036] Step 102: Set at least one port outside the multicast group as a destination port for mirroring the target message, and add the destination port as an egress port of the multicast group;
[0037] In step 102, the multicast group is used to normally forward the target message, and the destination port does not belong to the target address of the target message, that is, the destination port does not originally belong to the multicast group.
[0038] Step 103: Perform multicast replication on the target message at the egress port.
[0039] Among them, in step 103, multicast replication is performed on the target message at the egress port, that is, multicast replication is performed on the target message through the existing multicast replication process. Since the destination port is set as the egress port of the multicast group, the destination port will also receive a copy of the target message through the existing multicast replication process, thereby achieving the purpose of mirroring.
[0040] Therefore, the above steps 101 to 103 can utilize the original multicast replication process in the multicast group to replicate the target message and then send it to the destination port, thereby achieving the purpose of mirroring without occupying the forwarding resources of the network processor, thereby alleviating the forwarding resource pressure of the network processor and improving the forwarding performance of the network processor.
[0041] Among them, reference Figure 2 In step 102, determining the multicast group to which the target message is forwarded may include the following steps 201 to 202:
[0042] Step 201: Obtain the network location of the source port of the target message;
[0043] Step 202: Determine the multicast group to which the target message is forwarded according to the network location.
[0044] The source port of the target message can be distributed in at least two network locations:
[0045] One is that the source port is located on the local network device:
[0046] Reference Figure 3 The above step 202 may specifically include the following steps 301 to 302:
[0047] Step 301: Get the source port;
[0048] Step 302: Determine the multicast group to which the source port belongs.
[0049] Among them, in step 302, the multicast group to which the source port belongs is determined, and thus the multicast group to which the target message is forwarded can be determined. The source port can be the ingress port of the multicast group or the egress port of the multicast group. The ingress port is the port for receiving the multicast message, and the egress port is the port for forwarding the copied multicast message to each member of the multicast group.
[0050] Among them, reference Figure 4 , step 302 can be specifically implemented by following steps 401 to 402:
[0051] Step 401: Obtain the inbound port and outbound port of each multicast group in all multicast groups, and generate a query list based on the correspondence between the inbound port and outbound port and the multicast group to which they belong;
[0052] For example, there are multicast groups G1 to G2 in the network, multicast group G1 has ingress port I1 and egress ports O1 to O3, and multicast group G2 has ingress port I2 and egress ports O4 to O5. Therefore, the query list has port information of ingress ports I1 to I2, egress ports O1 to O5, and the multicast groups to which they belong.
[0053] Step 402: Determine the multicast group to which the source port belongs according to the query list.
[0054] In step 402, since the query table records all inbound ports, outbound ports and their corresponding relationships with multicast groups, the multicast group to which the source port belongs can be quickly determined.
[0055] The other is that the source port is located on a remote network device, where a multicast neighbor relationship is established between the remote network device and the local network device:
[0056] Reference Figure 5 , the above step 201 may specifically include the following steps 501 to 503:
[0057] Step 501: Get the source port;
[0058] Step 502: Determine the first multicast group to which the source port belongs;
[0059] In step 502, determining the first multicast group where the source port is located can also be implemented in a similar manner to steps 401 to 402 above, which will not be described in detail here.
[0060] Step 503: Determine the second multicast group to which the local network device belongs based on the multicast neighbor relationship.
[0061] In step 503, since a multicast neighbor relationship is established between the remote network device and the local network device, the second multicast group to which the local network device belongs can be quickly determined through the multicast neighbor relationship, making it easier to add the destination port to the second multicast group. Determining the second multicast group to which the local network device belongs can also be achieved in a manner similar to steps 401 to 402 above, which will not be repeated here.
[0062] In one embodiment, in step 301 or step 501, when obtaining the source port, specifically:
[0063] Get the target packet's packet type. If the target packet's packet type is a multicast packet, get the source port.
[0064] Alternatively, the port position of the source port is obtained. When the port position of the source port is the inbound port or the outbound port of the multicast group, the source port is obtained.
[0065] Among them, when the message type of the target message is a multicast message, or when the port position of the source port is the ingress port or egress port of the multicast group, it means that the target message can be mirrored through the existing multicast replication process in the future to ensure that the target message can be successfully mirrored. When the message type of the target message is not a multicast message, or when the port position of the source port is not the ingress port or egress port of the multicast group, it means that the target message cannot be mirrored through the existing multicast replication process in the future, thereby facilitating the subsequent timely configuration of the ordinary mirroring process to ensure that the target message can be successfully mirrored.
[0066] It is understandable that the above steps of obtaining the message type of the target message and the port position of the source port may be performed selectively or in combination.
[0067] In one embodiment, in step 102, when adding the destination port as the egress port of the multicast group, the following steps may be performed:
[0068] The validity of the destination port is obtained. If the destination port is valid, the destination port is added as the egress port of the multicast group.
[0069] By obtaining the validity of the destination port, it is possible to ensure that the destination port can normally receive the copied target message, thereby ensuring that the target message can successfully complete the mirroring and ensuring the stability of the mirroring.
[0070] In one embodiment, referring to Figure 6 The number of destination ports can be multiple. On this basis, in the above step 102, when the destination port is added as the egress port of the multicast group, the following steps 601 to 602 are specifically included:
[0071] Step 601: Obtain the correspondence between the source port and the destination port;
[0072] Among them, in step 601, the number of source ports can be one, on this basis, multiple destination ports all correspond to the source port, that is, multiple destination ports are used to mirror the target messages of the source port respectively; or, the number of source ports is multiple, for example, the number of source ports is equal to the number of destination ports, that is, multiple source ports and multiple destination ports correspond one to one.
[0073] Step 602: Add the destination port as the egress port of the multicast group according to the corresponding relationship.
[0074] Among them, in step 602, when the number of source ports is one and the number of destination ports is multiple, the destination port is added as the egress port of the multicast group according to the corresponding relationship, that is, all the multiple destination ports are added as the egress ports of the multicast group; when the number of source ports is multiple and the number of destination ports is multiple, take the number of source ports and destination ports as an example, for example, the source ports include the first source port and the second source port, the destination ports include the first destination port and the second destination port, the first source port is located in the third multicast group, and the second source port is located in the fourth multicast group, the destination ports are added as the egress ports of the multicast group according to the corresponding relationship, that is, the first destination port is set as the egress port of the third multicast group, and the second destination port is set as the egress port of the fourth multicast group.
[0075] The specific process of the message mirroring method provided by the embodiment of the present invention is described in detail below.
[0076] Reference Figure 7 , which is the overall validation process of the message mirroring method provided by an embodiment of the present invention, specifically including but not limited to the following steps 701 to 709:
[0077] Step 701: Configure the mirroring service;
[0078] Among them, in step 701, it is necessary to configure the destination port of the mirror, that is, the receiving end of the target message after mirroring, to check the effectiveness of the target message after mirroring and perform subsequent monitoring actions, etc. In addition, it is also necessary to determine the source port of the mirror, that is, the port through which the target message to be mirrored passes. The above configuration process is a session control session.
[0079] When the number of both the destination port and the source port is one, the number of sessions is one. A mirroring service can also be configured with multiple different sessions, meaning that the number of both the destination port and the source port is multiple. Furthermore, the same session can also be configured with multiple different destination ports, meaning that one source port corresponds to multiple different destination ports.
[0080] Step 702: Determine whether the source port is the inbound port of the multicast group. If the source port is the inbound port of the multicast group, jump to step 705; otherwise, jump to step 703.
[0081] Step 703: Determine whether the source port is the egress port of the multicast group. If so, jump to step 705; otherwise, jump to step 704.
[0082] Step 704: Execute the original mirroring process;
[0083] In step 704, the original mirroring process is executed, that is, the network processor is used to implement the mirroring.
[0084] Step 705: Get the mirrored destination port;
[0085] In step 705, the port information of the configured destination port is obtained from step 701. The destination port can be one or more.
[0086] Step 706: Determine whether the destination port is valid. If the destination port is invalid, jump to step 707. If the destination port is valid, jump to step 708.
[0087] Step 707: Send a prompt message;
[0088] Among them, in step 707, the prompt information is used to remind that the destination port is invalid, so as to terminate the process or reconfigure the destination port;
[0089] Step 708: Add the destination port as the egress port of the multicast group;
[0090] In step 708, the multicast group is the multicast group to which the source port belongs. The source port can be the ingress port or egress port of the multicast group. After being added as the egress port of the multicast group, the target message can be replicated through the multicast replication process. At this time, the destination port can receive the replicated target message.
[0091] Step 709: Check the message of the mirrored destination port.
[0092] Among them, in step 709, checking the message of the mirrored destination port can be used to check the validity of the mirrored target message and perform subsequent monitoring actions.
[0093] Reference Figure 8 , which is a source port determination process of the message mirroring method provided by an embodiment of the present invention, specifically includes but is not limited to the following steps 801 to 807:
[0094] Step 801: Get the source port of the mirror;
[0095] Among them, in step 801, the port information of the configured source port is obtained from the above step 701. The source port can be one or more;
[0096] Step 802: Obtain the inbound and outbound ports of the multicast group;
[0097] In step 802, there may be multiple multicast groups G1 to Gn in the network, each multicast group may have its own ingress port and egress port, and each multicast group may have multiple ingress ports and egress ports. Therefore, all ingress ports I1-In and all egress ports O1 to On are read to form a query list for query in subsequent steps.
[0098] Step 803: Determine whether the mirrored source port is the ingress port of the multicast group. If so, jump to step 806. If not, jump to step 804.
[0099] Step 804: Determine whether the mirrored source port is the egress port of the multicast group. If the source port is not the egress port of the multicast group, jump to step 805. If the source port is the egress port of the multicast group, jump to step 806.
[0100] In the above steps 803 to 804, it is possible to determine whether the source port is an inbound port or an outbound port of the multicast group through the query list formed in step 802;
[0101] Step 805: Execute the original mirroring process;
[0102] In step 805, the original mirroring process is executed, that is, the network processor is used to implement the mirroring.
[0103] Step 806: Obtain the multicast group to which the source port belongs;
[0104] In step 806, the multicast group to which the source port belongs can be determined through the query list obtained in step 802;
[0105] Step 807: Execute multicast replication;
[0106] In step 807, the target message may be replicated through a multicast replication process, and the destination port may receive the replicated target message.
[0107] Reference Figure 9 , which is a target message copying process of the message mirroring method provided in an embodiment of the present invention, specifically includes but is not limited to the following steps 901 to 905:
[0108] Step 901: Obtain the multicast group where the mirrored source port belongs;
[0109] In step 901, the multicast group to which the source port belongs can be determined through the query list obtained in step 802;
[0110] Step 902: Obtain the mirrored destination port;
[0111] Step 903: Add the destination port as the egress port of the multicast group;
[0112] In step 903, the multicast group is the multicast group where the source port is located. The source port can be the ingress port or egress port of the multicast group. After being added as the egress port of the multicast group, the target message can be replicated through the multicast replication process. At this time, the destination port can receive the replicated target message. This action does not affect the normal replication and forwarding process of the multicast group.
[0113] Step 904: Execute multicast replication;
[0114] Among them, in step 904, the target message can be copied through the multicast replication process, and the destination port can receive the copied target message;
[0115] Step 905: Check the message of the mirrored destination port.
[0116] Among them, in step 905, checking the message of the mirrored destination port can be used to check the validity of the mirrored target message and perform subsequent monitoring actions.
[0117] The message mirroring method according to the embodiment of the present invention is described below with several specific examples. It should be emphasized that the following examples are all illustrated with relatively simple network structures, and the actual network structure may be more complex.
[0118] ① One-to-one mirroring of the target message of the multicast group inbound port
[0119] Reference Figure 10 Switch S1 is connected to three clients C1 to C3, which form a multicast group G1. Multicast group G1 has an ingress port I1 and egress ports O1 to O3. The three clients C1 to C3 receive multicast messages from the source server through multicast group G1.
[0120] Configure the mirroring service for the target message (i.e., the aforementioned multicast message). The mirrored source port M1 is the ingress port I1 of multicast group G1, and the mirrored destination port is D1. Obtain all ingress and egress ports of multicast group G1 and confirm that the multicast group to which ingress port I1 belongs is multicast group G1.
[0121] Determine that destination port D1 is valid and add it to multicast group G1 as the egress port of multicast group G1. When the target message enters from ingress port I1, destination port D1 can receive a copy of the target message using the existing multicast replication process of multicast group G1, achieving the mirroring effect of ingress port I1.
[0122] ②One-to-one mirroring of the target message of the multicast group outbound port
[0123] Still Figure 10 The network architecture shown is explained:
[0124] Configure the mirroring service for the target message (i.e., the aforementioned multicast message). The mirrored source port M1 is the egress port O1 of multicast group G1, and the mirrored destination port is D1. Obtain all ingress and egress ports of multicast group G1 and confirm that the multicast group to which egress port O1 belongs is multicast group G1.
[0125] Determine that destination port D1 is valid and add it to multicast group G1 as its egress port. When a multicast message enters from ingress port I1, the existing multicast replication process for multicast group G1 is used. Both egress port O1 and destination port D1 receive a copy of the multicast message, achieving a mirroring effect for egress port O1.
[0126] ③One-to-many mirroring of target packets of the multicast group inbound port
[0127] Reference Figure 11 Switch S1 is connected to three clients C1 to C3, which form a multicast group G1. Multicast group G1 has an ingress port I1 and egress ports O1 to O3. The three clients C1 to C3 receive multicast messages from the source server through multicast group G1.
[0128] Configure the mirroring service for the target message (i.e., the aforementioned multicast message). The mirrored source port M1 is the ingress port I1 of multicast group G1, and the mirrored destination ports are D1 to D3. Obtain all ingress and egress ports of multicast group G1 and confirm that the multicast group to which ingress port I1 belongs is multicast group G1.
[0129] Determine that destination ports D1 to D3 are valid and add them to multicast group G1 as egress ports of multicast group G1. When the target message enters from ingress port I1, destination ports D1 to D3 receive a copy of the target message using the existing multicast replication process of multicast group G1, achieving the mirroring effect of ingress port I1.
[0130] ④One-to-one mirroring of multiple target messages
[0131] Reference Figure 12 Switch S1 is connected to four clients C1 to C4. Two clients C1 to C2 form multicast group G1, and the remaining two clients C3 to C4 form multicast group G2. Multicast group G1 has ingress port I1 and egress ports O1 to O2. Multicast group G2 has ingress port I2 and egress ports O3 to O4. Clients C1 to C2 receive the first multicast message from the source server through multicast group G1, and clients C3 to C4 receive the second multicast message from the source server through multicast group G2.
[0132] Configure a mirroring service for the target messages (i.e., the first and second multicast messages), where the mirrored source port M1 of the first target message is the ingress port I1 of multicast group G1, and the mirrored destination port is D1; the mirrored source port M2 of the second target message is the egress port O3 of multicast group G2, and the mirrored destination port is D2. Obtain all ingress and egress ports of multicast groups G1 and G2, and confirm that the multicast group to which ingress port I1 belongs is multicast group G1, and the multicast group to which egress port O3 belongs is multicast group G2.
[0133] Determine whether destination port D1 and destination port D2 are valid, add destination port D1 to multicast group G1 as the egress port of multicast group G1, and add destination port D2 to multicast group G2 as the egress port of multicast group G2. When the first target message enters from ingress port I1, the original multicast replication process of multicast group G1 is used, and destination port D1 can receive a copy of the target message, achieving the mirroring effect of ingress port I1. When the multicast message enters from ingress port I2, the original multicast replication process of multicast group G2 is used, and both egress port O3 and destination port D2 can receive a copy of the multicast message, achieving the mirroring effect of egress port O3.
[0134] ⑤ Remote mirroring of multicast group inbound ports
[0135] Reference Figure 13, switch S1 is connected to four clients C1 to C4. Clients C1 to C2 form multicast group G1, and clients C3 to C4 form multicast group G2. Multicast group G2 is connected to switch S1 through switch S2. Switch S1 and switch S2 establish a multicast neighbor relationship. Switch S2 is the remote downstream device of switch S1. Multicast group G1 has ingress port I1 and egress ports O1 to O2. Clients C1 to C2 receive multicast packets from the source server through multicast group G1, and clients C3 to C4 receive the same multicast packets as multicast group G1 through multicast group G2:
[0136] Configure the mirroring service for the target message (i.e., the aforementioned multicast message). The mirrored source port M1 is the ingress port I1 of multicast group G1, and the mirrored destination port is switch port V1. Obtain all ingress and egress ports for multicast group G1. Verify that ingress port I1 belongs to multicast group G1. Based on the multicast neighbor relationship between switches S1 and S2, verify that switch S2 belongs to multicast group G2.
[0137] Determine that destination port V1 is valid and add it to multicast group G2 as its egress port. When the target message enters from ingress port I1, destination port V1 receives a copy of the target message using the existing multicast replication process between multicast groups G1 and G2, achieving the mirroring effect of ingress port I1.
[0138] It is understandable that, based on the above five examples, other different mirroring modes can be obtained by combining and expanding them.
[0139] It should also be understood that the various implementations provided in the embodiments of the present invention can be combined arbitrarily to achieve different technical effects.
[0140] Figure 14 The network device 1400 provided by an embodiment of the present invention is shown. The network device 1400 includes: a memory 1401, a processor 1402, and a computer program stored in the memory 1401 and executable on the processor 1402. When the computer program is executed, it is used to execute the above-mentioned message mirroring method.
[0141] The processor 1402 and the memory 1401 may be connected via a bus or other means.
[0142] Memory 1401, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer executable programs, such as the message mirroring method described in the embodiments of the present invention. Processor 1402 implements the message mirroring method by executing the non-transitory software programs and instructions stored in memory 1401.
[0143] The memory 1401 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and application programs required for at least one function; the data storage area may store and execute the above-mentioned message mirroring method. In addition, the memory 1401 may include a high-speed random access memory 1401, and may also include a non-volatile memory 1401, such as at least one disk memory 1401 piece, a flash memory device or other non-volatile solid-state memory 1401 piece. In some embodiments, the memory 1401 may optionally include a memory 1401 remotely arranged relative to the processor 1402, and these remote memories 1401 may be connected to the network device 1400 via a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network and a combination thereof.
[0144] The non-transient software program and instructions required to implement the above-mentioned message mirroring method are stored in the memory 1401. When executed by one or more processors 1402, the above-mentioned message mirroring method is executed, for example, Figure 1 Steps 101 to 103 of the method, Figure 2 Steps 201 to 202 of the method, Figure 3 Steps 301 to 302 of the method, Figure 4 Steps 401 to 402 of the method, Figure 5 Steps 501 to 503 of the method, Figure 6 Method steps 601 to 602, Figure 7 Method steps 701 to 709, Figure 8 Method steps 801 to 807, Figure 9 Method steps 901 to 905.
[0145] An embodiment of the present invention further provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute the above-mentioned message mirroring method.
[0146] In one embodiment, the computer-readable storage medium stores computer-executable instructions, which are executed by one or more control processors 1402, for example, by a processor 1402 in the network device 1400, so that the one or more processors 1402 can execute the above-mentioned message mirroring method, for example, executing Figure 1 Steps 101 to 103 of the method, Figure 2 Steps 201 to 202 of the method, Figure 3 Steps 301 to 302 of the method, Figure 4 Steps 401 to 402 of the method, Figure 5 Steps 501 to 503 of the method, Figure 6 Steps 601 to 602 of the method, Figure 7Method steps 701 to 709, Figure 8 Steps 801 to 807 of the method Figure 9 Method steps 901 to 905.
[0147] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, i.e., they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of this embodiment.
[0148] Those skilled in the art will appreciate that all or some of the steps and systems in the method disclosed above can be implemented as software, firmware, hardware, and appropriate combinations thereof. Some physical components or all physical components can be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software can be distributed on a computer-readable medium, and the computer-readable medium can include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory, or other memory 1401 technology, CD-ROM, digital versatile disk (DVD), or other optical disk storage, magnetic cassette, magnetic tape, disk storage, or other magnetic storage device, or any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, as is well known to those skilled in the art, communication media typically includes computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0149] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the above implementation. Those skilled in the art can also make various equivalent modifications or substitutions under the shared conditions that do not violate the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of the present invention.
Claims
1. A message mirroring method, characterized in that: The method comprises: Get the target message to be mirrored; Obtaining a network location of a source port of the target message, and determining a multicast group to forward the target message according to the network location; Setting at least one port outside the multicast group as a destination port for mirroring the target message, and adding the destination port as an egress port of the multicast group; Multicast replication is performed on the target message at the egress port.
2. The message mirroring method according to claim 1, wherein: The source port is located on a local network device, and determining the multicast group to which the target message is forwarded according to the network location relationship includes: Obtaining the source port; Determine the multicast group to which the source port belongs.
3. The message mirroring method according to claim 1, wherein: The source port is located on a remote network device, and a multicast neighbor relationship is established between the remote network device and the local network device. The determining of the multicast group to which the target message is forwarded based on the network location relationship includes: Obtaining the source port; Determine the first multicast group to which the source port belongs; The second multicast group to which the local network device belongs is determined according to the multicast neighbor relationship.
4. The message mirroring method according to claim 2 or 3, characterized in that: The obtaining of the source port includes at least one of the following: Acquire the message type of the target message, and when the message type of the target message is a multicast message, acquire the source port; The port position of the source port is obtained. When the port position of the source port is an inbound port or an outbound port of a multicast group, the source port is obtained.
5. The message mirroring method according to claim 2 or 3, characterized in that: The determining of the multicast group to which the source port belongs includes: Obtaining an inbound port and an outbound port of each multicast group in all multicast groups, and generating a query list according to a correspondence between the inbound port and the outbound port and the multicast groups to which they belong; The multicast group to which the source port belongs is determined according to the query list.
6. The message mirroring method according to claim 1, wherein: There are multiple destination ports, and adding the destination ports as outbound ports of the multicast group includes: Obtaining a correspondence between a source port and the destination port; The destination port is added as an egress port of the multicast group according to the corresponding relationship.
7. The message mirroring method according to claim 6, characterized in that: The number of the source port is one, the plurality of destination ports all correspond to the source port, and the adding of the destination port as the egress port of the multicast group according to the corresponding relationship includes: Add the multiple destination ports as egress ports of the multicast group.
8. The message mirroring method according to claim 6, wherein: The source ports include a first source port and a second source port, the destination ports include a first destination port and a second destination port, the first source port is located in a third multicast group, and the second source port is located in a fourth multicast group, and adding the destination ports as egress ports of the multicast group according to the corresponding relationship includes: The first destination port is set as the egress port of the third multicast group, and the second destination port is set as the egress port of the fourth multicast group.
9. The message mirroring method according to claim 1, wherein: The step of adding the destination port as the egress port of the multicast group includes: Obtaining the validity of the destination port; When the destination port is valid, the destination port is added as an egress port of the multicast group.
10. A network device, characterized in that: The invention comprises at least one processor and a memory for communicating with the at least one processor; the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the message mirroring method according to any one of claims 1 to 9.
11. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the message mirroring method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Packet transmitting method and router
CN101459607A