Packet path tracking method and device, electronic equipment, storage medium and product
By determining path tracing entries and sorting packet-in messages, the problem of packets not being able to be traced along the entire path in the data center in existing technologies is solved, realizing the acquisition of full path information at the flow table level and improving tracing efficiency.
Patent Information
- Application Number
- CN202410984544.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-22
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2044-07-22
AI Technical Summary
Existing technologies cannot achieve flow table-level tracing of packets along the entire path in the data center, and OVS Packet Tracing can only be performed on a single device, making cross-device tracing impossible and resulting in complicated problem localization.
By determining path tracing entries, including at least one sub-tracing entry, matching the message information to be traced in ascending order of table_id, and sorting them in chronological order of packet in message time, the switch_id and table_id sequence is obtained, thus achieving full path tracing of messages within the data center.
It enables the acquisition of full-path information of packets at the flow table level within the data center, simplifies the packet location process, and improves tracking efficiency.
Smart Images

Figure CN119011459B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of communication, and particularly relates to a message path tracking method and device, electronic equipment, storage medium and product. BACKGROUND
[0002] In related message path tracking schemes, most of the schemes only support message path tracking at the hardware node level. Although OVS Packet Tracing can support message path tracking at the flow table level, this method can only track messages on one device and cannot realize full-path tracking of messages in a data center. SUMMARY
[0003] The present disclosure provides a message path tracking method, device, electronic equipment, storage medium and product to solve the problems in the related art.
[0004] A first aspect embodiment of the present disclosure provides a message path tracking method, which comprises the following steps:
[0005] Obtaining message information to be tracked and service table entries on a switch, wherein the message information to be tracked comprises a message to be tracked;
[0006] Determining path tracking table entries based on the message information to be tracked and the service table entries on the switch, wherein the path tracking table entries comprise at least one sub-tracking table entry;
[0007] Matching the message information to be tracked with each sub-tracking table entry in the path tracking table entries in the order of table_id of the sub-tracking table entries in the path tracking table entries from small to large;
[0008] If the message information to be tracked and the sub-tracking table entry in the path tracking table entries match successfully, obtaining a packet in message corresponding to the sub-tracking table entry, wherein the packet in message corresponding to the sub-tracking table entry comprises switch_id, table_id and an original message, the switch_id is used to indicate a switch where the message to be tracked is located, and the table_id is used to indicate a table where the message to be tracked is located;
[0009] Sorting the packet in messages corresponding to the sub-tracking table entries in the order of time when the packet in messages corresponding to the sub-tracking table entries are obtained, and taking a switch_id and table_id sequence in a sorting result as a path of the message to be tracked.
[0010] In an embodiment, determining the path tracking table entries based on the message information to be tracked and the service table entries on the switch comprises:
[0011] an action in an action field of a service entry and a matching rule in a matching field of the service entry;
[0012] comparing the action in the action field of the service entry, the matching rule in the matching field of the service entry, and the to-be-traced packet information, determining that the action in the action field of the service entry and the matching rule in the matching field of the service entry are matching fields of a sub-tracing entry in a path-tracing entry;
[0013] obtaining a priority of the sub-tracing entry in the path-tracing entry, a duration of the sub-tracing entry in the path-tracing entry, and an action field of the sub-tracing entry in the path-tracing entry;
[0014] merging the priority of the sub-tracing entry in the path-tracing entry, the duration of the sub-tracing entry in the path-tracing entry, the matching field of the sub-tracing entry in the path-tracing entry, and the action field of the sub-tracing entry in the path-tracing entry, to obtain the sub-tracing entry in the path-tracing entry;
[0015] determining the path-tracing entry based on the sub-tracing entry in the path-tracing entry.
[0016] In an embodiment, before matching the to-be-traced packet information with each sub-tracing entry in the path-tracing entry in an order of table_id of the sub-tracing entry in the path-tracing entry from small to large, the method provided by the present disclosure further includes:
[0017] obtaining a priority of each flow table in the sub-tracing entry in the path-tracing entry;
[0018] matching the to-be-traced packet with a flow table with a high priority in the sub-tracing entry in the path-tracing entry in an order of the priority of each flow table from high to low.
[0019] In an embodiment, before taking a sequence of switch_id and table_id in a sorting result as a path of a to-be-traced packet, the method provided by the present disclosure further includes:
[0020] determining whether an original packet in the packet in message corresponding to the sub-tracing entry is a VXLAN packet;
[0021] If the determination result is yes, in response to a VXLAN network identifier VNI of the to-be-traced packet being the same as a VNI of a VXLAN in which the original packet is located, decapsulating the VXLAN packet to obtain the switch_id and the table_id in the packet in message corresponding to the sub-tracing entry;
[0022] If the judgment result is no, in response to the source IP address of the to-be-traced packet being the same as the source IP address of the original packet and the source MAC address of the to-be-traced packet being the same as the source MAC address of the original packet, a switch_id and a table_id in a packet in message corresponding to the sub-tracing table item are obtained.
[0023] In an embodiment, the packet in messages corresponding to the sub-tracing table items are sorted in a first-to-last order according to a time at which the packet in messages corresponding to the sub-tracing table items are obtained, and a switch_id and a table_id sequence in a sorting result are taken as a path of the to-be-traced packet, including:
[0024] obtaining a timestamp of the packet in message corresponding to the sub-tracing table item;
[0025] associating a switch_id and a table_id in the packet in message corresponding to the sub-tracing table item;
[0026] sorting the packet in messages corresponding to the sub-tracing table items in a first-to-last order according to a time indicated by the timestamp of the packet in message corresponding to the sub-tracing table item, and taking a switch_id and a table_id sequence in a sorting result as the path of the to-be-traced packet.
[0027] In an embodiment, if the to-be-traced packet information matches the sub-tracing table item in the path-tracing table item successfully, after obtaining the packet in message corresponding to the sub-tracing table item, the method provided by the disclosure further includes:
[0028] obtaining a sub-tracing table item deletion instruction in the path-tracing table item, the sub-tracing table item deletion instruction including a table_id of the sub-tracing table item and a priority of the sub-tracing table item;
[0029] determining a switch in which the sub-tracing table item is located based on a switch_id in the packet in message corresponding to the sub-tracing table item;
[0030] deleting a table item in the switch, the table item having a table_id same as the table_id of the sub-tracing table item in the deletion instruction and having a priority same as the priority of the sub-tracing table item in the deletion instruction.
[0031] A second aspect embodiment of the disclosure provides a packet path tracing device, and the device includes:
[0032] a first obtaining unit, configured to obtain to-be-traced packet information and a service table item on a switch, the to-be-traced packet information including a to-be-traced packet;
[0033] determining unit, configured to determine a path tracking table item based on the to-be-tracked packet information and the service table item on the switch, the path tracking table item comprising at least one sub-tracking table item;
[0034] matching unit, configured to match the to-be-tracked packet information with each sub-tracking table item in the path tracking table item in the order of table_id of the sub-tracking table item in the path tracking table item from small to large;
[0035] the second obtaining unit is configured to obtain a packet in message corresponding to the sub-tracking table item if the to-be-tracked packet information matches the sub-tracking table item successfully, the packet in message corresponding to the sub-tracking table item comprising a switch_id, a table_id and an original packet, the switch_id being used to indicate the switch where the to-be-tracked packet is located, and the table_id being used to indicate the table where the to-be-tracked packet is located;
[0036] the sorting unit is configured to sort the packet in messages corresponding to the sub-tracking table items in the order of time from early to late, and take the switch_id and table_id sequence in the sorting result as the path of the to-be-tracked packet.
[0037] A third aspect embodiment of the present disclosure provides an electronic device, comprising:
[0038] at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores instructions executable 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 perform the method described in the first aspect embodiment of the present disclosure.
[0039] A fourth aspect embodiment of the present disclosure provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to perform the method described in the first aspect embodiment of the present disclosure.
[0040] A fifth aspect embodiment of the present disclosure provides a computer program product, comprising a computer program, and the computer program is used to implement the method described in the first aspect embodiment of the present disclosure when executed by a processor.
[0041] In summary, the present disclosure provides a packet path tracking method, which comprises: obtaining to-be-tracked packet information and service table items on a switch, the to-be-tracked packet information comprising a to-be-tracked packet;
[0042] determining a path tracking table item based on the to-be-tracked packet information and the service table item on the switch, the path tracking table item including at least one sub-tracking table item; matching the to-be-tracked packet information with each sub-tracking table item in the path tracking table item in the order of table_id from small to large in the sub-tracking table item; if the to-be-tracked packet information matches the sub-tracking table item in the path tracking table item successfully, obtaining a packet in message corresponding to the sub-tracking table item, the packet in message corresponding to the sub-tracking table item including switch_id, table_id and an original packet, the switch_id being used to indicate the switch where the to-be-tracked packet is located, and the table_id being used to indicate the table where the to-be-tracked packet is located; and sorting the packet in messages corresponding to the sub-tracking table items in the order of time from early to late when the packet in messages corresponding to the sub-tracking table items are obtained, and taking the switch_id and table_id sequence in the sorting result as the path of the to-be-tracked packet.
[0043] According to the scheme provided in the present disclosure, by determining a path tracking table item, the path tracking table item including at least one sub-tracking table item; matching the to-be-tracked packet information with each sub-tracking table item in the path tracking table item in the order of table_id from small to large in the sub-tracking table item; if the to-be-tracked packet information matches the sub-tracking table item in the path tracking table item successfully, obtaining a packet in message corresponding to the sub-tracking table item, the packet in message corresponding to the sub-tracking table item including switch_id, table_id and an original packet, the switch_id being used to indicate the switch where the to-be-tracked packet is located, and the table_id being used to indicate the table where the to-be-tracked packet is located; and sorting the packet in messages corresponding to the sub-tracking table items in the order of time from early to late when the packet in messages corresponding to the sub-tracking table items are obtained, and taking the switch_id and table_id sequence in the sorting result as the path of the to-be-tracked packet, the full path information of the to-be-tracked packet at the flow table level in the data center can be obtained.
[0044] It should be understood that the foregoing general description and the following detailed description are only exemplary and explanatory, and are not limiting to the present disclosure. BRIEF DESCRIPTION OF DRAWINGS
[0045] The accompanying drawings, which are incorporated into and form part of the specification, illustrate embodiments consistent with the present disclosure and, together with the specification, serve to explain the principles of the present disclosure, and do not limit the present disclosure.
[0046] Figure 1 Structure schematic diagram of the packet path tracking method provided by the embodiments of the present disclosure;
[0047] Figure 2 A flowchart of a packet path tracking method provided by an embodiment of the present disclosure is shown in FIG. 1.
[0048] Figure 3 A flowchart of a method for determining a path tracking entry provided by an embodiment of the present disclosure is shown in FIG. 2.
[0049] Figure 4 A flowchart of a method for tracking a path of a packet provided by an embodiment of the present disclosure is shown in FIG. 3.
[0050] Figure 5 A flowchart of a method for deleting a sub-tracking entry provided by an embodiment of the present disclosure is shown in FIG. 4.
[0051] Figure 6 A flowchart of a packet path tracking method provided by an application example of the present disclosure is shown in FIG. 5.
[0052] Figure 7 A structural diagram of a packet path tracking apparatus provided by an embodiment of the present disclosure is shown in FIG. 6.
[0053] Figure 8 A hardware composition structural diagram of an electronic device provided by an embodiment of the present disclosure is shown in FIG. 7. DETAILED DESCRIPTION
[0054] Embodiments of the present disclosure are described in detail below, examples of which are shown in the accompanying drawings, in which the same or similar notations represent the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by reference to the drawings are exemplary and are intended to explain the present disclosure, and cannot be understood as limiting the present disclosure.
[0055] In related packet path tracking schemes, most of the schemes only support packet path tracking at the hardware node level. Although OVS Packet Tracing can support packet path tracking at the flow table level, this method can only track packets on one device and cannot realize full path tracking of packets in a data center.
[0056] Several schemes of packet path tracking methods in related technologies are briefly introduced below:
[0057] Scheme A: Scheme A proposes to use OVS Packet Tracing technology to match the flow table on the node according to the parameters of the packet to be tracked by the user. If matched, the flow table is output until it is matched to leave the node or discarded.
[0058] Scheme B: Scheme B proposes a method of tracing the forwarding path of a packet in a physical node. When a physical node between a source virtual machine and a destination virtual machine receives a traceroute packet, the physical node sends the address of the physical node to the source virtual machine. The main steps include: a computing node receiving a traceroute packet sent by a virtual machine configured on any computing node; determining whether the tracing target of the traceroute packet is the next virtual machine on the transmission path of the computing node; and when the tracing target is a destination virtual host, the physical node returns the address information of the physical machine interface to the virtual machine sending the traceroute packet.
[0059] Scheme C: Scheme C proposes a method of tracing the forwarding path and quality parameters of a packet. Network devices between a source node and a destination node record packet information and analyze quality parameters such as forwarding delay and packet loss reasons. Network devices assemble path tracing packets according to packet information and write quality parameters into the packets, and send the packets back to the source node. In this way, the source node can obtain path information and quality information on the path according to the received path tracing packets.
[0060] In the above schemes, the following defects exist:
[0061] First, the prior art can only trace to the hardware node level on the packet forwarding path, and cannot achieve packet tracing at the flow table level. In the software defined network (SDN) scenario, there are a large number of flow table entries on each forwarding device, and it is still difficult to locate the problem.
[0062] Second, OVS Packet Tracing can achieve packet tracing at the flow table level, but it can only be traced on one device and cannot be traced across devices. Since a packet often passes through a large number of forwarding devices in a data center, it is cumbersome to verify one device at a time.
[0063] To address the deficiencies in related technologies, this disclosure involves determining path tracing entries, each including at least one sub-tracing entry; matching the message to be traced against each sub-tracing entry in the path tracing entry according to the ascending order of the table_id of the sub-tracing entries; if the message to be traced successfully matches a sub-tracing entry, obtaining the packet in message corresponding to the sub-tracing entry, thus obtaining all switch_ids and corresponding table_ids traversed by the message to be traced; sorting all successfully matched packet in messages corresponding to sub-tracing entries according to the time of obtaining the packet in message corresponding to the sub-tracing entry, and using the switch_id and table_id sequence in the sorting result as the path of the message to be traced, thus obtaining the full path information of the message to be traced at the flow table level within the data center.
[0064] like Figure 1 As shown, Figure 1 This is a schematic diagram of the structure of the packet path tracing method provided in this embodiment of the disclosure, including a cloud host, a compute node, a forwarding device, a controller, an SDN orchestration service, an SDN controller, and a path tracer. The cloud host is the source host that sends the packet to be traced; the compute node is the physical device that hosts the cloud host and runs an OpenFlow virtual switch, such as an Open vSwitch (OVS); the forwarding device is a switch that supports the OpenFlow protocol; the SDN orchestration service is responsible for orchestrating SDN services and stores service data; the SDN controller is the software in the SDN network responsible for managing the flow tables on the forwarding device and the compute node virtual switch; and the path tracer is responsible for initiating and displaying packet path tracing for a specific cloud host.
[0065] The present disclosure will now be described in further detail with reference to the accompanying drawings and specific embodiments.
[0066] like Figure 2 As shown, Figure 2 This is a flowchart illustrating the message path tracing method provided in this embodiment of the disclosure. The message path tracing method provided in this embodiment of the disclosure includes the following steps:
[0067] Step 201: Obtain the message information to be traced and the service entries on the switch;
[0068] In one embodiment, the message information to be tracked includes messages to be tracked.
[0069] In an embodiment, the source host information of the to-be-traced packet can be acquired, and the to-be-traced packet information can be acquired. Specifically, the path tracker uses the id of the source host sending the to-be-traced packet to acquire the source host information from the SDN programming service, and the to-be-traced packet information is the same as the source host information of the to-be-traced packet.
[0070] In an embodiment, the to-be-traced packet information at least includes VXLAN network identifier (VXLAN Network Identifier, VNI) of a Virtual Private Cloud (Virtual Private Cloud, VPC) where the source host sending the to-be-traced packet is located, source host IP address, MAC address, OVS interface number and the like.
[0071] In an embodiment, since the matching rules of each entry in each table on the switch are the same, only the first entry can be acquired to know the matching rules in the entire table, and thus the first entry of each table on the switch is taken as a service entry.
[0072] In an embodiment, there can be multiple tables on a switch, and each table has a corresponding service entry, so that there can be multiple service entries on a switch.
[0073] In an embodiment, the service entries on the switch can be acquired by using a display instruction.
[0074] Step 202, determining a path tracking entry based on the to-be-traced packet information and the service entries on the switch;
[0075] In an embodiment, the path tracking entry includes at least one sub-tracking entry.
[0076] In an embodiment, the number of service entries on all switches is the same as the number of sub-tracking entries of the path tracking entry, that is, one service entry corresponds to one sub-tracking entry.
[0077] In an embodiment, the sub-tracking entry includes priority of the sub-tracking entry, duration of the sub-tracking entry, matching field of the sub-tracking entry and action field of the sub-tracking entry. The priority of the sub-tracking entry is the highest 65535, the duration of the sub-tracking entry is a preset value, the sub-tracking entry is automatically destroyed after reaching the preset time, the matching field of the sub-tracking entry is used to define the packet matching rule, such as matching according to the packet port number, and the action field of the sub-tracking entry is used to define the operation for the packet, such as forwarding, discarding, modifying and the like.
[0078] Step 203, matching the to-be-traced packet information with each sub-tracking entry in the path tracking entry in the order of table_id of the sub-tracking entry in the path tracking entry from small to large.
[0079] In an embodiment, in different switches, the to-be-traced packet information is matched with the sub-trace table item corresponding to the current switch in the path trace table item according to the order of the to-be-traced packet entering the switch.
[0080] In an embodiment, in the same switch, the to-be-traced packet information is matched with each sub-trace table item in the path trace table item according to the order of the table_id of the sub-trace table item corresponding to the current switch in the path trace table item from small to large.
[0081] In an embodiment, in the same switch, the to-be-traced packet information is matched with each sub-trace table item in the path trace table item according to the order of the table_id of the sub-trace table item from small to large, if the matching fails, the matching with the sub-trace table item corresponding to the next switch is continued, if the matching with the last sub-trace table item corresponding to the last switch also fails, the packet is discarded.
[0082] In step 204, if the to-be-traced packet information matches the sub-trace table item in the path trace table item successfully, a packet in message corresponding to the sub-trace table item is obtained.
[0083] In an embodiment, the packet in message corresponding to the sub-trace table item includes switch_id, table_id and the original packet.
[0084] In an embodiment, the switch_id is used to indicate the switch where the to-be-traced packet is located, and the table_id is used to indicate the table where the to-be-traced packet is located.
[0085] In an embodiment, the original packet contains five-tuple information, if the original packet is a VXLAN packet, the original packet contains the five-tuple information of the inner packet, and the five-tuple information refers to source IP, source port, target IP, target port and communication protocol.
[0086] In an embodiment, by obtaining the packet in message corresponding to the sub-trace table item, the switch where the to-be-traced packet is located and the table where the to-be-traced packet is located can be determined, and the current path of the to-be-traced packet is obtained.
[0087] In step 205, the packet in messages corresponding to the sub-trace table item are sorted according to the order of the time when the packet in messages corresponding to the sub-trace table item are obtained from early to late, and the switch_id and table_id sequence in the sorting result are taken as the path of the to-be-traced packet.
[0088] In an embodiment, the path tracker acquires the packet in message corresponding to the sub-trace table item reported by the SDN controller, and records the time of acquiring the packet in message corresponding to the sub-trace table item each time, and takes the recorded time as the basis for sorting.
[0089] In an embodiment, the packet in message corresponding to the sub-trace table item is sorted in the order from early to late according to the time of acquiring the packet in message corresponding to the sub-trace table item, and the switch_id and table_id sequence in the sorting result is taken as the path of the packet to be tracked, so that the full path tracking at the flow table level can be realized for the packet to be tracked.
[0090] In an embodiment, as shown in Figure 3 Based on the packet to be tracked information and the service table item on the switch, the path tracking table item is determined, including:
[0091] Step 301: acquiring the action in the action field of the service table item and the matching rule in the matching field of the service table item;
[0092] In an embodiment, the action in the action field of the service table item includes encapsulation, decapsulation, forwarding, matching, etc.
[0093] In an embodiment, the matching rule in the matching field of the service table item includes matching according to the ingress port, matching according to the source IP address, matching according to the destination address, etc.
[0094] In an embodiment, the SDN controller can issue an openflow Read-state message to the switch to acquire the service table item on all switches, and then acquire the action in the action field of the service table item and the matching rule in the matching field of the service table item.
[0095] Step 302: comparing the action in the action field of the service table item, the matching rule in the matching field of the service table item, and the packet to be tracked information, and determining that the action in the action field of the service table item and the matching rule in the matching field of the service table item are the matching field of the sub-trace table item in the path tracking table item.
[0096] In an embodiment, if the matching field of the service table item contains the ingress port information, the ingress port of the source host sending the packet to be tracked needs to be taken as the ingress port of the matching field of the sub-trace table item.
[0097] In an embodiment, if the matching field of the service table item contains the source IP address, the IP address and MAC address of the source host sending the packet to be tracked need to be taken as the source IP and source MAC of the matching field of the sub-trace table item.
[0098] In an embodiment, if there is an action of decapsulating VXLAN packet in the action field of the service entry, the VNI of the VXLAN in which the source host sending the to-be-traced packet is located needs to be taken as the VNI of the matching field of the sub-tracing entry.
[0099] In an embodiment, within a computing node, a packet is often encapsulated into a VXLAN packet before leaving the computing node, and before that, it is always an original packet. Therefore, for a service flow entry before the computing node encapsulates a VXLAN packet, the matching field should include the source IP address and the source MAC. Correspondingly, when a packet enters a switch, it is often in the form of a VXLAN packet, and it is necessary to decapsulate the VXLAN packet before processing. Therefore, for a service flow entry after decapsulation, the matching field should include the source IP address and the source MAC.
[0100] In an embodiment, cookie, register field and other information can also be used to achieve more accurate matching of the path of the to-be-traced packet.
[0101] Step 303: Obtain the priority of the sub-tracing entry in the path-tracing entry, the duration of the sub-tracing entry in the path-tracing entry, and the action field of the sub-tracing entry in the path-tracing entry.
[0102] In an embodiment, the priority of the sub-tracing entry in the path-tracing entry, the duration of the sub-tracing entry in the path-tracing entry, and the action field of the sub-tracing entry in the path-tracing entry can be obtained by using an SDN controller.
[0103] In an embodiment, the priority of the sub-tracing entry in the path-tracing entry, the duration of the sub-tracing entry in the path-tracing entry, and the action field of the sub-tracing entry in the path-tracing entry can also be obtained by calling an application programming interface (API).
[0104] In an embodiment, the same action can be used in the action field of the sub-tracing entry in the path-tracing entry, such as using an openflow packet in message to report flow table information to an SDN controller and continuing to match subsequent flow entries.
[0105] In an embodiment, different actions can also be used in the action field of the sub-tracing entry in the path-tracing entry, such as encapsulating an original packet and decapsulating a VXLAN packet.
[0106] Step 304: Merge the priority of the sub-tracing entry in the path-tracing entry, the duration of the sub-tracing entry in the path-tracing entry, the matching field of the sub-tracing entry in the path-tracing entry, and the action field of the sub-tracing entry in the path-tracing entry to obtain the sub-tracing entry in the path-tracing entry.
[0107] In an embodiment, the priority of the sub-tracking table item in the path tracking table item, the duration of the sub-tracking table item in the path tracking table item, the matching field of the sub-tracking table item in the path tracking table item and the action field of the sub-tracking table item in the path tracking table item can be combined in a row or a column to obtain the sub-tracking table item in the path tracking table item.
[0108] In an embodiment, the priority of the sub-tracking table item in the path tracking table item, the duration of the sub-tracking table item in the path tracking table item, the matching field of the sub-tracking table item in the path tracking table item and the action field of the sub-tracking table item in the path tracking table item can also be combined in an array to obtain the sub-tracking table item in the path tracking table item.
[0109] In an embodiment, by combining the priority of the sub-tracking table item in the path tracking table item, the duration of the sub-tracking table item in the path tracking table item, the matching field of the sub-tracking table item in the path tracking table item and the action field of the sub-tracking table item in the path tracking table item, the priority, the duration, the matching rule and the action information of the table on the corresponding switch can be directly obtained through the table_id of the switch.
[0110] Step 305, determining the path tracking table item based on the sub-tracking table item in the path tracking table item.
[0111] In an embodiment, in the same switch, all the sub-tracking table items are combined in the order of the table_id of the sub-tracking table item in the path tracking table item from small to large to obtain the path tracking table item.
[0112] In an embodiment, among multiple switches, all the sub-tracking table items of all the switches are combined in the order of the sequence in which the to-be-tracked packet enters the switch to obtain the path tracking table item.
[0113] In an embodiment, before matching the to-be-tracked packet information with each sub-tracking table item in the path tracking table item in the order of the table_id of the sub-tracking table item in the path tracking table item from small to large, the method further comprises:
[0114] Obtaining the priority of each flow table in the sub-tracking table item in the path tracking table item.
[0115] In an embodiment, the priority of each flow table in the sub-tracking table item in the path tracking table item can be obtained by using an SDN controller.
[0116] In an embodiment, the priority of the flow table is usually represented by an unsigned 16-bit integer, and the priority range is 0 to 65535.
[0117] According to the order from high to low of the priority of each flow table, the to-be-traced packet is matched with the flow table with high priority in the sub-tracing table item in the path tracing table item.
[0118] In an embodiment, according to the order from high to low of the priority of each flow table, the to-be-traced packet is matched with the flow table with high priority in the sub-tracing table item in the path tracing table item, and if the matching is successful, it indicates that the to-be-traced packet passes through the flow table with high priority in the sub-tracing table item.
[0119] In an embodiment, the packet in messages corresponding to the sub-tracing table items are sorted according to the order from early to late of the time of obtaining the packet in messages, and the switch_id and table_id sequence in the sorting result are taken as the path of the to-be-traced packet, and the method further comprises:
[0120] judging whether the original packet in the packet in message corresponding to the sub-tracing table item is a VXLAN packet;
[0121] In an embodiment, the VXLAN packet refers to an encapsulated packet.
[0122] In an embodiment, the original packet in the packet in message corresponding to the sub-tracing table item is analyzed, and whether the original packet in the packet in message corresponding to the sub-tracing table item is a VXLAN packet is judged by judging whether the original packet in the packet in message corresponding to the sub-tracing table item contains a VXLAN header.
[0123] If the judgment result is yes, in response to the VXLAN network identifier VNI of the to-be-traced packet being the same as the VNI of the VXLAN in which the original packet is located, the VXLAN packet is decapsulated, and the switch_id and table_id in the packet in message corresponding to the sub-tracing table item are obtained.
[0124] In an embodiment, if the original packet in the packet in message corresponding to the sub-tracing table item is a VXLAN packet, it is further judged whether the VXLAN network identifier VNI of the to-be-traced packet is the same as the VNI of the VXLAN in which the original packet is located, if the judgment result is yes, the VXLAN packet is decapsulated, and the switch_id and table_id in the packet in message corresponding to the sub-tracing table item are obtained; if the judgment result is no, the VXLAN packet is discarded.
[0125] In one embodiment, by determining whether the VXLAN network identifier (VNI) of the packet to be tracked is the same as the VNI of the VXLAN where the original packet is located, it can be determined whether the original packet in the packet in message corresponding to the sub-tracking entry is the packet to be tracked, and then the packet in message is filtered a second time to select the packet to be tracked and its path information.
[0126] If the judgment result is negative, the response is that the source IP address of the packet to be traced is the same as the source IP address of the original packet, and the source MAC address of the packet to be traced is the same as the source MAC address of the original packet. The switch_id and table_id in the packet in message corresponding to the sub-trace table entry are obtained.
[0127] In one embodiment, if the original packet in the packet-in message corresponding to the sub-trace entry is not a VXLAN packet, then it is further determined whether the source IP address of the packet to be traced is the same as the source IP address of the original packet and whether the source MAC address of the packet to be traced is the same as the source MAC address of the original packet. If the determination result is yes, then the switch_id and table_id in the packet-in message corresponding to the sub-trace entry are obtained; if the determination result is no, then the original packet is discarded.
[0128] In one embodiment, by determining whether the source IP address of the packet to be tracked is the same as the source IP address of the original packet and whether the source MAC address of the packet to be tracked is the same as the source MAC address of the original packet, it can be determined whether the original packet in the packet in message corresponding to the sub-tracking entry is the packet to be tracked, and then the packet in message is filtered a second time to select the packet to be tracked and its path information.
[0129] In one embodiment, such as Figure 4 As shown, the packet-in messages corresponding to the sub-trace entries are sorted according to the time of acquisition, from earliest to latest. The switch_id and table_id sequences in the sorting result are used as the paths of the packets to be traced, including:
[0130] Step 401: Obtain the timestamp of the packet in message corresponding to the sub-tracking entry;
[0131] In one embodiment, the timestamp is used to indicate the order in which packet-in messages corresponding to sub-tracking entries are retrieved.
[0132] In one embodiment, the SDN controller can be used to obtain the timestamp of the packet-in message corresponding to the sub-tracking entry.
[0133] Step 402, associate switch_id and table_id in the packet in message corresponding to the sub-tracing table item;
[0134] In an embodiment, switch_id and table_id and other information in the packet in message corresponding to the sub-tracing table item are parsed out, and each information is associated. For example, the packet to be traced passes through multiple tables (table_1, table_2, table_3) on switch_1 (switch_1), then switch_id and table_id parsed out can be associated to form data {switch_1: [table_1, table_2, table_3]} or (switch_1, table_1), (switch_1, table_2), (switch_1, table_3). The presentation form of the associated data is not limited in the disclosure, which can be in the form of a linked list or an array.
[0135] Step 403, sort the associated packet in message corresponding to the sub-tracing table item in the order from early to late according to the time indicated by the timestamp of the packet in message corresponding to the sub-tracing table item, and take the switch_id and table_id sequence in the sorting result as the path of the packet to be traced.
[0136] In an embodiment, the presentation form of the associated packet in message corresponding to the sub-tracing table item is (switch_id, table_id), three switches, and each switch has three tables. For example, according to the time indicated by the timestamp of the packet in message corresponding to the sub-tracing table item, the associated packet in message corresponding to the sub-tracing table item is sorted in the order from early to late, and the sorting result (switch_1, table_1)-(switch_1, table_2)-(switch_1, table_3)-(switch_2, table_1)-(switch_2, table_2)-(switch_2, table_3)-(switch_3, table_1)-(switch_3, table_2)-(switch_3, table_3) is taken as the path of the packet to be traced.
[0137] In an embodiment, the packet in messages corresponding to the sub-trace table entries are sorted according to the time indicated by the time stamp of the packet in message corresponding to the sub-trace table entry in the first-to-last order, and the switch_id and table_id sequence in the sorting result is taken as the path of the packet to be traced, so that the full-path tracing of the packet to be traced at the flow table level can be implemented.
[0138] In an embodiment, as shown in Figure 5 If the packet to be traced information matches the sub-trace table entry in the path-trace table entry successfully, the method further includes the following steps:
[0139] Step 501: obtaining a sub-trace table entry deletion instruction in the path-trace table entry.
[0140] In an embodiment, the sub-trace table entry deletion instruction includes the table_id of the sub-trace table entry and the priority of the sub-trace table entry.
[0141] In an embodiment, the SDN controller can be used to obtain the sub-trace table entry deletion instruction in the path-trace table entry.
[0142] In an embodiment, the specific content of different sub-trace table entry deletion instructions is different. For example, according to the table_id of 0 and the priority of 65535, the deletion instruction is obtained as follows:
[0143]
[0144] Step 502: determining the switch where the sub-trace table entry is located based on the switch_id in the packet in message corresponding to the sub-trace table entry.
[0145] In an embodiment, since each switch corresponds to a unique switch_id, the switch where the sub-trace table entry is located can be determined based on the switch_id in the packet in message corresponding to the sub-trace table entry.
[0146] Step 503: deleting the table entry in the switch, which has the same table_id as the table_id of the sub-trace table entry in the deletion instruction and has the same priority as the priority of the sub-trace table entry in the deletion instruction.
[0147] In an embodiment, after determining the switch in which the sub-trace table item is located, the table can be located according to the table_id in the switch, each table contains multiple flow tables with different priorities, and thus the specific flow table can be located according to the priority of the table item. The flow table in which the sub-trace table item is located can be determined by the table_id of the sub-trace table item in the deletion instruction and the priority of the sub-trace table item in the deletion instruction.
[0148] In an embodiment, the related table items are cleared in time by deleting the table items in the switch with the same table_id as the table_id of the sub-trace table item in the deletion instruction and the same priority as the priority of the sub-trace table item in the deletion instruction, thereby avoiding the continuous packet in message reporting to the SDN controller and effectively reducing the performance loss caused by path tracking.
[0149] In summary, the scheme provided by the present disclosure has the following advantages:
[0150] Firstly, by determining a path tracking table item including at least one sub-trace table item, the to-be-traced message information is matched with each sub-trace table item in the path tracking table item in the order of the table_id of the sub-trace table item from small to large. If the to-be-traced message information matches the sub-trace table item in the path tracking table item successfully, the packet in message corresponding to the sub-trace table item is obtained, and all switch_id and table_id in the corresponding switch through which the to-be-traced message passes can be obtained. By sorting all the packet in messages corresponding to the sub-trace table item which match successfully in the order of the time when the packet in message corresponding to the sub-trace table item is obtained from early to late, the switch_id and table_id sequence in the sorting result are taken as the path of the to-be-traced message, and the full path information of the to-be-traced message at the flow table level in the data center can be obtained.
[0151] Secondly, by judging whether the VXLAN network identifier VNI of the to-be-traced message is the same as the VNI of the original message in the VXLAN, it can be determined whether the original message in the packet in message corresponding to the sub-trace table item is the to-be-traced message, and the packet in message is further filtered to screen out the to-be-traced message and the path information.
[0152] Thirdly, the related table items are cleared in time by deleting the table items in the switch with the same table_id as the table_id of the sub-trace table item in the deletion instruction and the same priority as the priority of the sub-trace table item in the deletion instruction, thereby avoiding the continuous packet in message reporting to the SDN controller and effectively reducing the performance loss caused by path tracking.
[0153] The following application example further illustrates the message path tracing method provided in this disclosure:
[0154] like Figure 6 As shown, Figure 6 This is a flowchart illustrating the message path tracing method provided in this application example. The message path tracing method provided in this application example includes the following steps:
[0155] Step 601: Obtain the message information to be traced and the service entries on the switch, wherein the message information to be traced includes the message to be traced;
[0156] Step 602: Obtain the action in the action field of the business table item and the matching rule in the matching field of the business table item;
[0157] Step 603: Compare the actions in the action field of the service entry, the matching rules in the matching field of the service entry, and the message information to be traced, and determine that the actions in the action field of the service entry and the matching rules in the matching field of the service entry are the matching fields of the sub-tracking entries in the path tracing entry.
[0158] Step 604: Obtain the priority, duration, and action domain of the sub-tracking entries in the path tracing table entry;
[0159] Step 605: Merge the priority, duration, matching domain, and action domain of the sub-tracking entries in the path tracing table entry to obtain the sub-tracking entries in the path tracing table entry.
[0160] Step 606: Determine the path tracing entry based on the sub-tracing entries in the path tracing entry;
[0161] Step 607: Match the message information to be tracked with each sub-tracking entry in the path tracing table according to the table_id of the sub-tracking table entries in ascending order;
[0162] In one embodiment, before matching the message information to be traced with each sub-tracking entry in the path tracing table according to the ascending order of the table_id of the sub-tracking entries in the path tracing table, the method further includes:
[0163] Get the priority of each flow table in the sub-tracing table entries of the path tracing table entry;
[0164] According to the order of priority from high to low in each flow table, the message to be traced is matched with the flow table with the highest priority in the sub-tracing table entries of the path tracing table.
[0165] If the packet information to be tracked matches the sub-tracking table item in the path tracking table item, obtaining a packet in message corresponding to the sub-tracking table item in step 608;
[0166] In an embodiment, the packet in message corresponding to the sub-tracking table item includes a switch_id, a table_id and an original packet, wherein the switch_id is used to indicate a switch where the packet to be tracked is located, and the table_id is used to indicate a table where the packet to be tracked is located.
[0167] In an embodiment, after obtaining the packet in message corresponding to the sub-tracking table item if the packet information to be tracked matches the sub-tracking table item in the path tracking table item, the method further includes:
[0168] Obtaining a sub-tracking table item deletion instruction in the path tracking table item, wherein the sub-tracking table item deletion instruction includes a table_id of the sub-tracking table item and a priority of the sub-tracking table item;
[0169] Determining a switch where the sub-tracking table item is located based on the switch_id in the packet in message corresponding to the sub-tracking table item;
[0170] Deleting a table item in the switch, wherein the table item has the same table_id as the sub-tracking table item in the deletion instruction and has the same priority as the sub-tracking table item in the deletion instruction.
[0171] Obtaining a timestamp of the packet in message corresponding to the sub-tracking table item in step 609;
[0172] Associating the switch_id and the table_id in the packet in message corresponding to the sub-tracking table item in step 610;
[0173] According to the time indicated by the timestamp of the packet in message corresponding to the sub-tracking table item, sorting the packet in message corresponding to the sub-tracking table item in a sequence from early to late, and taking a switch_id and table_id sequence in a sorting result as a path of the packet to be tracked in step 611.
[0174] In an embodiment, before sorting the packet in message corresponding to the sub-tracking table item in a sequence from early to late, the method further includes:
[0175] determining whether the original packet in the packet in message corresponding to the sub-tracing table entry is a VXLAN packet;
[0176] If the determination result is yes, in response to the VXLAN network identifier VNI of the to-be-traced packet being the same as the VNI of the VXLAN in which the original packet is located, the VXLAN packet is decapsulated, and the switch_id and the table_id in the packet in message corresponding to the sub-tracing table entry are obtained;
[0177] If the determination result is no, in response to the source IP address of the to-be-traced packet being the same as the source IP address of the original packet and the source MAC address of the to-be-traced packet being the same as the source MAC address of the original packet, the switch_id and the table_id in the packet in message corresponding to the sub-tracing table entry are obtained.
[0178] To implement the packet path tracing method provided in the embodiments of the present disclosure, the embodiments of the present disclosure further provide a packet path tracing device, as shown in Figure 7 . Figure 7 The structure diagram of the packet path tracing device provided in the embodiments of the present disclosure is shown in FIG. 7. The packet path tracing device 700 comprises:
[0179] A first obtaining unit 701 is configured to obtain to-be-traced packet information and service table entries on a switch, wherein the to-be-traced packet information comprises a to-be-traced packet.
[0180] A determining unit 702 is configured to determine a path tracing table based on the to-be-traced packet information and the service table entries on the switch, wherein the path tracing table comprises at least one sub-tracing table entry.
[0181] A matching unit 703 is configured to match the to-be-traced packet information with each sub-tracing table entry in the path tracing table in the order of table_id in the sub-tracing table entries in the path tracing table from small to large.
[0182] A second obtaining unit 704 is configured to, if the to-be-traced packet information matches a sub-tracing table entry in the path tracing table successfully, obtain a packet in message corresponding to the sub-tracing table entry, wherein the packet in message corresponding to the sub-tracing table entry comprises a switch_id, a table_id and an original packet, the switch_id is used to indicate a switch in which the to-be-traced packet is located, and the table_id is used to indicate a table in which the to-be-traced packet is located.
[0183] The sorting unit 705 is configured to sort the packet in messages corresponding to the sub-trace table item in a time sequence from early to late, and take the switch_id and table_id sequence in the sorting result as the path of the to-be-traced packet.
[0184] In an embodiment, the determining unit 702 is specifically configured to:
[0185] obtain an action in an action field of the service table item and a matching rule in a matching field of the service table item;
[0186] compare the action in the action field of the service table item, the matching rule in the matching field of the service table item, and the to-be-traced packet information, and determine that the action in the action field of the service table item and the matching rule in the matching field of the service table item are the matching field of the sub-trace table item in the path-trace table item;
[0187] obtain a priority of the sub-trace table item in the path-trace table item, a duration of the sub-trace table item in the path-trace table item, and an action field of the sub-trace table item in the path-trace table item;
[0188] merge the priority of the sub-trace table item in the path-trace table item, the duration of the sub-trace table item in the path-trace table item, the matching field of the sub-trace table item in the path-trace table item, and the action field of the sub-trace table item in the path-trace table item, to obtain the sub-trace table item in the path-trace table item;
[0189] determine the path-trace table item based on the sub-trace table item in the path-trace table item.
[0190] In an embodiment, the packet path-trace device 700 further includes a flow table matching unit, which is configured to:
[0191] obtain a priority of each flow table in the sub-trace table item in the path-trace table item;
[0192] match the to-be-traced packet with a flow table with a high priority in the sub-trace table item in the path-trace table item in a sequence from high to low according to the priority of each flow table.
[0193] In an embodiment, the packet path-trace device 700 further includes a judging unit, which is configured to:
[0194] determine whether the original packet in the packet in message corresponding to the sub-trace table item is a VXLAN packet;
[0195] If the judgment result is yes, in response to the VXLAN network identifier VNI of the to-be-traced packet being the same as the VNI of the VXLAN where the original packet is located, the VXLAN packet is decapsulated, and the switch_id and the table_id in the packet in message corresponding to the sub-tracing table item are obtained.
[0196] If the judgment result is no, in response to the source IP address of the to-be-traced packet being the same as the source IP address of the original packet and the source MAC address of the to-be-traced packet being the same as the source MAC address of the original packet, the switch_id and the table_id in the packet in message corresponding to the sub-tracing table item are obtained.
[0197] In an embodiment, the sorting unit 705 is specifically configured to:
[0198] obtain the timestamp of the packet in message corresponding to the sub-tracing table item;
[0199] associate the switch_id and the table_id in the packet in message corresponding to the sub-tracing table item;
[0200] sort the packet in messages corresponding to the sub-tracing table items in the order from early to late according to the time indicated by the timestamp of the packet in message corresponding to the sub-tracing table item, and take the switch_id and the table_id sequence in the sorting result as the path of the to-be-traced packet.
[0201] In an embodiment, the packet path tracing apparatus 700 further includes a deletion unit configured to:
[0202] obtain a sub-tracing table item deletion instruction in the path tracing table item, the sub-tracing table item deletion instruction including the table_id of the sub-tracing table item and the priority of the sub-tracing table item;
[0203] determine the switch where the sub-tracing table item is located based on the switch_id in the packet in message corresponding to the sub-tracing table item;
[0204] delete the table item in the switch that has the same table_id as the table_id of the sub-tracing table item in the deletion instruction and has the same priority as the priority of the sub-tracing table item in the deletion instruction.
[0205] It should be noted that the packet path tracking device provided by the above-mentioned embodiments only takes the above-mentioned division of each program module as an example when performing packet path tracking, and in actual application, the above-mentioned processing can be completed by different program modules according to needs, that is, the internal structure of the packet path tracking device is divided into different program modules to complete all or part of the above-mentioned processing. In addition, the packet path tracking device provided by the above-mentioned embodiments and the packet path tracking method provided by the embodiments of the present disclosure belong to the same concept, and the specific implementation process is detailed in the method embodiments, which will not be repeated here.
[0206] Figure 8 The hardware component structure diagram of the electronic device provided by the embodiments of the present disclosure is shown in FIG. 8, which includes at least one processor 802, and a memory 801 connected with the at least one processor 802 in communication; wherein the memory 801 stores instructions executable by the at least one processor 802, and the instructions are executed by the at least one processor 802 to implement the steps of the packet path tracking method of the embodiments of the present disclosure. Figure 8
[0207] Optionally, the electronic device can be the packet path tracking device of the embodiments of the present disclosure, and the electronic device can implement the corresponding processes in the methods of the embodiments of the present disclosure which are implemented by the packet path tracking device. For brevity, details are not repeated here.
[0208] It can be understood that the electronic device further includes a communication interface 803. Each component in the electronic device is coupled together through a bus system 804. It can be understood that the bus system 804 is used to realize the connection and communication between the components. The bus system 804 includes a data bus, a power supply bus, a control bus and a state signal bus in addition to the data bus. However, for the purpose of clear illustration, all kinds of buses are marked as the bus system 804 in the figure. Figure 8
[0209] It can be understood that the memory 801 can be a volatile memory or a non-volatile memory, and can also 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), a ferromagnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM); the magnetic surface memory can be a disk memory or a tape memory. The volatile memory can be a random access memory (RAM) used as an external cache. By way of example but not limitation, many forms of RAM can be used, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct rambus random access memory (DRRAM).The memory 801 described in the embodiments of the present application is intended to include, but not limited to, these and any other suitable type of memory.
[0210] The method disclosed in the embodiments of the present application can be applied to the processor 802 or implemented by the processor 802. The processor 802 can be an integrated circuit chip having a processing capability of signals. In the implementation process, each step of the above method can be completed by the integrated logic circuit of hardware in the processor 802 or the instruction in the form of software. The processor 802 described above can be a general processor, a DSP, or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, etc. The processor 802 can implement or execute the disclosed methods, steps and logic block diagrams in the embodiments of the present application. The general processor can be a microprocessor or any conventional processor, etc. In combination with the steps of the method disclosed in the embodiments of the present application, the hardware decoding processor can be directly embodied to complete the execution, or the combination of hardware and software modules in the decoding processor can be used to complete the execution. The software module can be located in the storage medium, which is located in the memory 801, and the processor 802 reads the information in the memory 801 to complete the steps of the above method in combination with the hardware.
[0211] In the exemplary embodiments, the electronic device can be implemented by one or more application specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), FPGAs, general-purpose processors, controllers, MCUs, microprocessors (Microprocessors), or other electronic elements, for executing the above-mentioned methods.
[0212] The embodiments of the present application also provide a non-transitory computer readable storage medium storing computer instructions, which are used to make a computer execute the steps of the packet path tracking method provided by the embodiments of the present application.
[0213] Optionally, the computer readable storage medium can be applied to the packet path tracking device in the embodiments of the present application, and the computer instructions make the computer execute the corresponding processes implemented by the packet path tracking device in the various methods of the embodiments of the present application. For brevity, details are not described here.
[0214] The embodiments of the present application also provide a computer program product, which comprises a computer program, and the computer program implements the steps of the packet path tracking method provided by the embodiments of the present application when executed by a processor.
[0215] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other manners. The above described device embodiments are merely exemplary. For example, the division of the units is only a logical function division. There can be another division manner for the actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the components shown or discussed can be indirect coupling or communication connection through some interfaces, devices or units, and can be electrical, mechanical or in other forms.
[0216] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place or distributed on multiple network units; some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
[0217] In addition, each functional unit in each embodiment of the present application can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the integrated unit can be realized in the form of hardware or in the form of hardware plus software functional unit.
[0218] Those of ordinary skill in the art can understand that all or part of the steps of the above method embodiments can be completed by a program instructing related hardware, and the foregoing program can be stored in a computer readable storage medium, and the program executes the steps of the above method embodiments when executed; and the foregoing storage medium includes mobile storage devices, ROM, RAM, magnetic discs or optical discs, and various media that can store program codes.
[0219] Alternatively, the integrated unit of the present application, if implemented in the form of a software functional module and sold or used as an independent product, can also be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present application can be embodied in the form of a software product, and the computer software product is stored in a storage medium, and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods of the embodiments of the present application. The foregoing storage medium includes mobile storage devices, ROM, RAM, magnetic discs or optical discs, and various media that can store program codes.
[0220] The above merely illustrates the specific embodiments of the present application, but the protection scope of the present application is not limited thereto, any person skilled in the art can easily think of the changes or replacements within the technical range disclosed by the present application, which should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A packet path tracing method characterized by, The method comprises the following steps: acquiring message to be tracked and service table item on the switch, wherein the message to be tracked comprises a packet to be tracked; determining path tracking table item based on the message to be tracked and the service table item on the switch, wherein the path tracking table item comprises at least one sub-tracking table item; matching the message to be tracked with each sub-tracking table item in the path tracking table item in the order of table_id from small to large in the sub-tracking table item; if the message to be tracked matches the sub-tracking table item, acquiring packet in message corresponding to the sub-tracking table item, wherein the packet in message corresponding to the sub-tracking table item comprises switch_id, table_id and original packet, wherein the switch_id is used to indicate the switch where the packet to be tracked is located, and the table_id is used to indicate the table where the packet to be tracked is located; sorting the packet in message corresponding to the sub-tracking table item in the order of time from early to late when the packet in message corresponding to the sub-tracking table item is acquired, and taking the switch_id and table_id sequence in the sorting result as the path of the packet to be tracked.
2. The method of claim 1, wherein, The method further comprises the following steps before the matching of the message to be tracked with each sub-tracking table item in the path tracking table item in the order of table_id from small to large in the sub-tracking table item: acquiring action in the action field of the service table item and matching rule in the matching field of the service table item; comparing the action in the action field of the service table item, the matching rule in the matching field of the service table item and the message to be tracked, and determining that the action in the action field of the service table item and the matching rule in the matching field of the service table item are the matching field of the sub-tracking table item in the path tracking table item; acquiring the priority of the sub-tracking table item in the path tracking table item, the duration of the sub-tracking table item in the path tracking table item and the action field of the sub-tracking table item in the path tracking table item; merging the priority of the sub-tracking table item in the path tracking table item, the duration of the sub-tracking table item in the path tracking table item, the matching field of the sub-tracking table item in the path tracking table item and the action field of the sub-tracking table item in the path tracking table item to obtain the sub-tracking table item in the path tracking table item; determining the path tracking table item based on the sub-tracking table item in the path tracking table item.
3. The method of claim 1, wherein, The method further comprises the following steps before the sorting of the packet in message corresponding to the sub-tracking table item in the order of time from early to late when the packet in message corresponding to the sub-tracking table item is acquired: acquiring the priority of each flow table in the sub-tracking table item in the path tracking table item; matching the packet to be tracked with the flow table with high priority in the sub-tracking table item in the path tracking table item in the order of priority from high to low.
4. The method of claim 1, wherein, determining whether the original packet in the packet in message corresponding to the sub-tracing table entry is a virtual extension local area network (VXLAN) packet; if the determination result is yes, in response to a VXLAN network identifier (VNI) of the to-be-traced packet being the same as a VNI of a VXLAN to which the original packet belongs, performing VXLAN packet decapsulation to obtain a switch_id and a table_id in the packet in message corresponding to the sub-tracing table entry; if the determination result is no, in response to a source IP address of the to-be-traced packet being the same as a source IP address of the original packet and a source MAC address of the to-be-traced packet being the same as a source MAC address of the original packet, obtaining the switch_id and the table_id in the packet in message corresponding to the sub-tracing table entry.
5. The method of claim 1, wherein, the switch_id and the table_id in the packet in message corresponding to the sub-tracing table entry are sorted in a time sequence in which the packet in message corresponding to the sub-tracing table entry is obtained, and a sequence of the switch_id and the table_id in a sorting result is taken as a path of the to-be-traced packet, including: obtaining a timestamp of the packet in message corresponding to the sub-tracing table entry; associating the switch_id and the table_id in the packet in message corresponding to the sub-tracing table entry; sorting the packet in message corresponding to the sub-tracing table entry after the association in a time sequence indicated by the timestamp of the packet in message corresponding to the sub-tracing table entry, and taking a sequence of the switch_id and the table_id in a sorting result as the path of the to-be-traced packet.
6. The method of claim 1, wherein, after the packet in message corresponding to the sub-tracing table entry is obtained when the to-be-traced packet information matches the sub-tracing table entry in the path-tracing table entry successfully, the method further includes: obtaining a sub-tracing table entry deletion instruction in the path-tracing table entry, the sub-tracing table entry deletion instruction including a table_id of the sub-tracing table entry and a priority of the sub-tracing table entry; determining a switch in which the sub-tracing table entry is located based on the switch_id in the packet in message corresponding to the sub-tracing table entry; deleting a table entry in the switch that has the same table_id as the table_id of the sub-tracing table entry in the deletion instruction and has the same priority as the priority of the sub-tracing table entry in the deletion instruction.
7. A packet path tracing apparatus characterized by comprising: including: a first obtaining unit, configured to obtain to-be-traced packet information and a service table entry on a switch, the to-be-traced packet information including a to-be-traced packet; a determining unit, configured to determine a path-tracing table entry based on the to-be-traced packet information and the service table entry on the switch, the path-tracing table entry including at least one sub-tracing table entry; a matching unit, configured to match the to-be-traced packet information with each sub-tracing table entry in the path-tracing table entry in a sequence in which the table_id of the sub-tracing table entry in the path-tracing table entry is in ascending order. A second obtaining unit, configured to, if the to-be-traced packet information matches a sub-trace table item in the path trace table item successfully, obtain a packet in message corresponding to the sub-trace table item, the packet in message corresponding to the sub-trace table item including a switch_id, a table_id, and an original packet, the switch_id being used to indicate a switch where the to-be-traced packet is located, and the table_id being used to indicate a table where the to-be-traced packet is located. An ordering unit, configured to order the packet in messages corresponding to the sub-trace table items in a sequence from early to late according to a time when the packet in messages corresponding to the sub-trace table items are obtained, and take a switch_id and table_id sequence in an ordering result as a path of the to-be-traced packet.
8. An electronic device, comprising: Comprise: at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores instructions executable 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 perform the method in any one of claims 1 to 6.
9. A non-transitory computer-readable storage medium having stored thereon computer instructions, wherein, The computer instructions are used to enable the computer to perform the method in any one of claims 1 to 6.
10. A computer program product comprising a computer program which, when executed by a processor, implements the method in any one of claims 1 to 6.
Citation Information
Patent Citations
Traceroute method for label switched paths (LSP) in multi-protocol label switching (MPLS) network and routing equipment
CN103166852A
SDN (Software Defined Network) trusted routing scheduling method based on path tracking feedback
CN114567582A