A path simulation method and apparatus

By simulating network packet forwarding using path simulation methods, the problem of collaborative processing during network failures is solved, enabling rapid location and resolution of network issues and reducing communication costs and troubleshooting time.

CN116743543BActive Publication Date: 2026-06-30上海安博通信息科技有限公司

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
上海安博通信息科技有限公司
Filing Date
2023-05-26
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

In existing technologies, when a network failure occurs, it is necessary to coordinate with other departments to handle the failure, which leads to high communication costs and low troubleshooting efficiency.

Method used

This paper provides a path simulation method that simulates the network packet forwarding principle, determines the source IP and destination IP based on the five-tuple information input by the user, and combines the MAC form and device connection relationship table to realize the path simulation of the entire link, assisting operation and maintenance personnel in quickly locating network problems.

Benefits of technology

It enables rapid resolution of network issues on a unified management platform, ensuring stable business operations and reducing communication costs and troubleshooting time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116743543B_ABST
    Figure CN116743543B_ABST
Patent Text Reader

Abstract

This invention provides a path simulation method and apparatus. The method includes: determining a source IP and a first destination IP belonging to a first LAN based on user-input 5-tuple information; determining a first device and a first interface from a MAC address table based on the source IP; determining a first destination MAC address from the MAC address table based on the first destination IP; determining whether a second device connected to the first device exists in a Layer 3 device connection relationship table; if not, ending the path simulation when the first interface is a gateway interface and the first MAC address of the first device matches the first destination MAC address; the Layer 3 device connection relationship table includes the connection relationships between Layer 3 devices and the connection relationships between Layer 3 devices and Layer 2 devices. This invention achieves end-to-end path simulation, enabling network fault troubleshooting and location on a unified management platform, assisting maintenance personnel in quickly resolving network problems, and ensuring stable business operation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of path simulation technology, and specifically to a path simulation method and apparatus. Background Technology

[0002] In today's era of rapid IT development, as networks grow larger and business systems become increasingly virtualized across industries, users instinctively assume that network problems are the cause of service failures. This leads to network administrators being overwhelmed with resolving various network issues daily. However, the complexity of network structures, the size and diversity of network devices present significant challenges for operations and maintenance (O&M) personnel. Furthermore, if network devices are managed by different departments, O&M staff must coordinate with other departments to collaboratively troubleshoot, resulting in high communication costs, low troubleshooting efficiency, and often irreversible losses for the company.

[0003] Therefore, there is an urgent need to propose a path simulation method and device to solve the technical problem in the existing technology that when a network failure occurs, it is necessary to coordinate with other departments to handle the failure together, which leads to high communication costs and low troubleshooting efficiency. Summary of the Invention

[0004] In view of this, it is necessary to provide a path simulation method and device to simulate the principle of network data packet forwarding, so as to solve the technical problem in the prior art that when a network failure occurs, it is necessary to coordinate with other departments to handle the failure, resulting in high communication costs and low troubleshooting efficiency.

[0005] On one hand, the present invention provides a path simulation method, including: determining the source IP and the first destination IP belonging to the first LAN based on the five-tuple information input by the user;

[0006] Based on the source IP, determine the first device and the first interface from the MAC address table; based on the first destination IP, determine the first destination MAC address from the MAC address table;

[0007] Determine whether a second device connected to the first device exists in the three-layer device connection relationship table;

[0008] If not, then the path simulation ends when the first interface is a gateway interface and the first MAC address of the first device is the same as the first destination MAC address.

[0009] The three-layer device connection relationship table includes the connection relationship between the three-layer devices and the connection relationship between the three-layer devices and the two-layer devices.

[0010] In some possible implementations, the method further includes:

[0011] If there is no second device connected to the first device in the Layer 3 device connection relationship table, then when the first interface is the gateway interface and the first MAC address is inconsistent with the first destination MAC address, the second LAN and the second destination IP of the second LAN are determined according to the Layer 3 logic.

[0012] Replace the first LAN with the second LAN, replace the first destination IP with the second destination IP, and re-execute the step of "determine the first destination MAC address from the MAC form based on the first destination IP".

[0013] In some possible implementations, the method further includes:

[0014] If the second device connected to the first device does not exist in the three-layer device connection relationship table, then when the first interface is not the gateway interface and the first MAC address is inconsistent with the first destination MAC address, the path simulation will terminate abnormally and an abnormal result will be output.

[0015] In some possible implementations, the method further includes:

[0016] If the three-layer device connection relationship table contains a second device connected to the first device, then jump to the second device according to the first interface of the first device to determine the second interface;

[0017] When the second device is a Layer 3 device, replace the second device with the first device, replace the second interface with the first interface, and re-execute the step of "determining whether there is a second device connected to the first device in the Layer 3 device connection relationship table".

[0018] In some possible implementations, after determining the second interface by jumping to the second device based on the first interface of the first device, the method further includes:

[0019] When the second device is a Layer 2 device, determine whether there is a third device connected to the second device in the Layer 2 device connection relationship table based on the second interface;

[0020] If not, then the path simulation ends when the second interface is the gateway interface and the second MAC address of the second device is the same as the first destination MAC address;

[0021] The Layer 2 device connection relationship table includes the connection relationships between the Layer 2 devices.

[0022] In some possible implementations, after determining whether a third device connected to the second device exists in the Layer 2 device connection table based on the second interface, the method further includes:

[0023] If the third device connected to the second device is not found in the Layer 2 device connection table, then when the second interface is the gateway interface and the second MAC address is inconsistent with the first destination MAC address, the third LAN and the third destination IP of the third LAN are determined according to the Layer 3 logic; the third LAN replaces the first LAN, and the third destination IP replaces the first destination IP, and the step of "determining the first destination MAC address from the MAC table according to the first destination IP" is repeated.

[0024] If the second interface is not the gateway interface and the second MAC address is inconsistent with the first destination MAC address, the path simulation will terminate abnormally and an abnormal result will be output.

[0025] In some possible implementations, the three-layer logic is as follows:

[0026] The second LAN of the VRF routing table in the virtual router is determined based on the first interface;

[0027] If the 5-tuple information conforms to the access rules of the ACL, the 5-tuple information is modified through static NAT and destination NAT to obtain new 5-tuple information;

[0028] Based on the new quintuple information, the second destination IP of the second LAN is obtained.

[0029] In some possible implementations, determining the source IP and the first destination IP belonging to the first LAN based on the five-tuple information input by the user includes:

[0030] Determine whether the source IP and destination IP in the 5-tuple information belong to the same LAN;

[0031] If so, then the same LAN is designated as the first LAN, and the destination IP is designated as the first destination IP;

[0032] If not, then based on the third LAN and the fourth LAN to which the source IP and the destination IP belong respectively, determine the third destination IP corresponding to the third LAN and the fourth destination IP corresponding to the fourth LAN.

[0033] On the other hand, the present invention also provides a path simulation device, comprising:

[0034] The IP determination module is used to determine the source IP and the first destination IP belonging to the first LAN based on the five-tuple information input by the user.

[0035] The address determination module is used to determine the first device and the first interface from the MAC address table based on the source IP address; and to determine the first destination MAC address from the MAC address table based on the first destination IP address.

[0036] The device determination module is used to determine whether there is a second device connected to the first device in the three-layer device connection relationship table;

[0037] The simulation termination module is used to terminate the path simulation if, no, the first interface is a gateway interface and the first MAC address of the first device is consistent with the first destination MAC address; wherein, the three-layer device connection relationship table includes the connection relationship between the three-layer devices and the connection relationship between the three-layer devices and the two-layer devices.

[0038] Accordingly, this invention discloses an electronic device, including: a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, it implements the various steps of the above-described path simulation method embodiments.

[0039] The beneficial effects of the above embodiments are as follows: The path simulation method provided by the present invention processes the five-tuple information input by the user to obtain the source IP and destination IP corresponding to the LAN. Based on the source IP, it determines the first device and the first interface from the MAC address table, and then determines the first destination MAC address from the MAC address table based on the destination IP. Thus, if a second device connected to the first device is found in the Layer 3 device connection relationship table, the user can jump to the second device through the first interface. Alternatively, if no second device connected to the first device is found in the Layer 3 device connection relationship table, and the first MAC address of the first device matches the first destination MAC address, the path simulation ends. By simulating the principle of network packet forwarding, the method achieves full-link path simulation, thereby enabling network fault troubleshooting and location on a unified management platform, assisting maintenance personnel in quickly resolving network problems, and ensuring the stable operation of services. Attached Figure Description

[0040] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0041] Figure 1 A schematic flowchart of an embodiment of the path simulation method provided by the present invention;

[0042] Figure 2 A schematic diagram of an embodiment of the network structure provided by the present invention;

[0043] Figure 3 A schematic diagram of an embodiment of the path simulation device provided by the present invention;

[0044] Figure 4 A schematic diagram of an embodiment of the electronic device provided by the present invention. Detailed Implementation

[0045] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.

[0046] Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor systems and / or microcontroller systems.

[0047] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a mutually exclusive, independent, or alternative embodiment. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0048] This invention provides a path simulation method and apparatus, which will be described below.

[0049] Figure 1 A schematic flowchart of an embodiment of the path simulation method provided by the present invention is shown below. Figure 1 As shown, the path simulation method includes:

[0050] S101. Based on the five-tuple information input by the user, determine the source IP and the first destination IP belonging to the first LAN;

[0051] S102. Determine the first device and the first interface from the MAC address table based on the source IP; determine the first destination MAC address from the MAC address table based on the first destination IP;

[0052] S103. Determine whether there is a second device connected to the first device in the three-layer device connection relationship table;

[0053] S104. If not, then when the first interface is a gateway interface and the first MAC address of the first device is the same as the first destination MAC address, the path simulation ends.

[0054] The three-layer device connection relationship table includes the connection relationship between the three-layer devices and the connection relationship between the three-layer devices and the two-layer devices.

[0055] Compared with existing technologies, the path simulation method provided in this invention processes the five-tuple information input by the user to obtain the source IP and destination IP corresponding to the LAN. Based on the source IP, it determines the first device and the first interface from the MAC address table, and then determines the first destination MAC address from the MAC address table based on the destination IP. Thus, if a second device connected to the first device is found in the Layer 3 device connection relationship table, the user can jump to the second device through the first interface. Alternatively, if no second device connected to the first device is found in the Layer 3 device connection relationship table, and the first MAC address of the first device matches the first destination MAC address, the path simulation ends. By simulating the network packet forwarding principle, it achieves end-to-end path simulation, thereby enabling network fault troubleshooting and location on a unified management platform, assisting maintenance personnel in quickly resolving network problems, and ensuring the stable operation of services.

[0056] It should be noted that after determining the source IP and destination IP for each LAN, a first LAN can be selected as needed. The source IP of the first LAN is used to look up the global MAC address in the MAC table to locate the originating device (the first device) and the first interface. Then, the first destination IP is used to look up the global MAC address in the MAC table to determine the first destination MAC address. In this invention, LANs are processed one by one. The first LAN is selected as needed. After the processing of the first LAN is completed, the second LAN is determined from the unprocessed LANs according to the three-layer logic, and so on, until the path simulation process ends. After the path simulation is completed, a complete path and each node along the path, as well as information related to each node, such as the matched MAC entries, ARP entries, routing entries, etc., will be output.

[0057] In a specific embodiment of the present invention, if no second device is found, and the first interface is determined to be the gateway interface of the first LAN, and the first MAC address of the first device is consistent with the first destination MAC address, it indicates that the simulation has reached the destination, and the path simulation process ends.

[0058] In some embodiments of the present invention, step S101 includes:

[0059] Determine whether the source IP and destination IP in the 5-tuple information belong to the same LAN;

[0060] If so, then the same LAN is designated as the first LAN, and the destination IP is designated as the first destination IP;

[0061] If not, then based on the third LAN and the fourth LAN to which the source IP and the destination IP belong respectively, determine the third destination IP corresponding to the third LAN and the fourth destination IP corresponding to the fourth LAN.

[0062] It should be noted that the process involves determining whether the source IP and destination IP are on the same network segment and whether they belong to the same LAN. If they are not on the same LAN, the system searches for a gateway device in the third LAN based on the source IP. Once a gateway device is found, it checks if multiple gateway devices are found. If so, one of them is selected as the gateway. Otherwise, there is only one gateway. After confirming a gateway, the gateway IP is determined and set as the third destination IP corresponding to the third LAN. Similarly, the process searches for a gateway device in the fourth LAN based on the source IP. Once a gateway device is found, it checks if multiple gateway devices are found. If so, one of them is selected as the gateway. Otherwise, there is only one gateway. After confirming a gateway, the gateway IP is determined and set as the fourth destination IP corresponding to the fourth LAN.

[0063] In some embodiments of the present invention, the method further includes:

[0064] If there is no second device connected to the first device in the Layer 3 device connection relationship table, then when the first interface is the gateway interface and the first MAC address is inconsistent with the first destination MAC address, the second LAN and the second destination IP of the second LAN are determined according to the Layer 3 logic.

[0065] Replace the first LAN with the second LAN, replace the first destination IP with the second destination IP, and re-execute the step of "determine the first destination MAC address from the MAC form based on the first destination IP".

[0066] It should be noted that if there is no second device connected to the first device in the Layer 3 device connection relationship table, and if the first interface is a gateway interface but the first MAC address is inconsistent with the first destination MAC address, it means that the process in the first LAN has been completed, but the destination has not been found. It is necessary to find the next LAN (second LAN) and the destination IP (second destination IP) according to the Layer 3 logic, and re-execute step S102 "determine the first destination MAC address from the MAC table according to the first destination IP" and the subsequent process in the first LAN until all LANs have been completed. Then the execution result is output. The execution result may be that the execution destination has not been found. The output execution result can be set according to the actual situation, and the embodiment of the present invention does not impose any restrictions here.

[0067] In some embodiments of the present invention, the method further includes:

[0068] If the second device connected to the first device does not exist in the three-layer device connection relationship table, then when the first interface is not the gateway interface and the first MAC address is inconsistent with the first destination MAC address, the path simulation will terminate abnormally and an abnormal result will be output.

[0069] It should be noted that if there is no second device connected to the first device in the Layer 3 device connection relationship table, and if the first interface is not the gateway interface and the first MAC address does not match the first destination MAC address, it indicates an anomaly in the path simulation process. The path simulation ends due to the anomaly. After the simulation ends, a complete path and each node along the path, as well as information related to each node, such as the matched MAC entry, ARP entry, routing entry, etc., will be output. When the path is different, the platform will return which information was not found, thus causing the path to end abnormally. This helps the administrator quickly locate the fault location and cause.

[0070] In some embodiments of the present invention, the method further includes:

[0071] If the three-layer device connection relationship table contains a second device connected to the first device, then jump to the second device according to the first interface of the first device to determine the second interface;

[0072] When the second device is a Layer 3 device, replace the second device with the first device, replace the second interface with the first interface, and re-execute the step of "determining whether there is a second device connected to the first device in the Layer 3 device connection relationship table".

[0073] It should be noted that when determining whether a second device connected to the first device exists in the Layer 3 device connection table, if such a device does exist, the process can directly jump to the second device through the first interface. The second interface is then determined. The Layer 3 device connection table includes the connection relationships between Layer 3 devices and between Layer 3 devices and Layer 2 devices. Therefore, it is necessary to determine the second device. If the second device is a Layer 3 device, the first device is replaced with the second device, the first interface is replaced with the second interface, and then the steps of "determining whether a second device connected to the first device exists in the Layer 3 device connection table" and subsequent steps are re-executed.

[0074] In a specific embodiment of the present invention, Figure 2 A schematic diagram of one embodiment of the provided network structure, such as Figure 2 As shown, users can access ser via PC. The two terminals are distributed in different network segments. Switches SW1 and SW2 are Layer 2 devices, and gateway firewall FW1 is a Layer 3 device. Gateway firewall FW1 serves as the gateway for both PC and ser.

[0075] In some embodiments of the present invention, after determining the second interface by jumping to the second device based on the first interface of the first device, the method further includes:

[0076] When the second device is a Layer 2 device, determine whether there is a third device connected to the second device in the Layer 2 device connection relationship table based on the second interface;

[0077] If not, then the path simulation ends when the second interface is the gateway interface and the second MAC address of the second device is the same as the first destination MAC address;

[0078] The Layer 2 device connection relationship table includes the connection relationships between the Layer 2 devices.

[0079] It should be noted that when the second device is a Layer 2 device, the second interface can be used to determine whether there is a third device connected to the second device in the Layer 2 device connection relationship table. If so, the path simulation can end when the second interface is the gateway interface and the second MAC address of the second device is consistent with the first destination MAC address. The Layer 2 device connection relationship table includes the connection relationships between Layer 2 devices.

[0080] In some embodiments of the present invention, after determining whether a third device connected to the second device exists in the Layer 2 device connection relationship table according to the second interface, the method further includes:

[0081] If the third device connected to the second device is not found in the Layer 2 device connection table, then when the second interface is the gateway interface and the second MAC address is inconsistent with the first destination MAC address, the third LAN and the third destination IP of the third LAN are determined according to the Layer 3 logic; the third LAN replaces the first LAN, and the third destination IP replaces the first destination IP, and the step of "determining the first destination MAC address from the MAC table according to the first destination IP" is repeated.

[0082] If the second interface is not the gateway interface and the second MAC address is inconsistent with the first destination MAC address, the path simulation will terminate abnormally and an abnormal result will be output.

[0083] In some embodiments of the present invention, the three-layer logic is as follows:

[0084] The second LAN of the VRF routing table in the virtual router is determined based on the first interface;

[0085] If the 5-tuple information conforms to the access rules of the ACL, the 5-tuple information is modified through static NAT and destination NAT to obtain new 5-tuple information;

[0086] Based on the new quintuple information, the second destination IP of the second LAN is obtained.

[0087] It's important to note that Layer 3 logic matches rules for Layer 3 devices. This logic can include examining the incoming interface's VRF, incoming interface ACL, static NAT, destination NAT, policy routing, global routing, security policies, source NAT, and outgoing interface ACL. VRF is bound to the interface; based on the incoming interface, it determines which VRF routing table to use to determine the next LAN gateway. ACL controls access, judging whether a rule allows access based on the user-input 5-tuple. Static NAT and destination NAT can modify the user-input 5-tuple information. Destination NAT will re-follow the subsequent process based on the transformed 5-tuple. Policy routing and global routing are also used to determine the next-hop device. Layer 3 logic can determine the next LAN, the corresponding destination IP of the LAN, and the next-hop device, thus simulating network packet forwarding principles and achieving end-to-end path simulation.

[0088] To better implement the path simulation method in the embodiments of the present invention, the embodiments of the present invention also provide a path simulation device, such as... Figure 3 As shown, the path simulation device includes:

[0089] IP determination module 301 is used to determine the source IP and the first destination IP belonging to the first LAN based on the five-tuple information input by the user.

[0090] Address determination module 302 is used to determine the first device and the first interface from the MAC form based on the source IP; and to determine the first destination MAC address from the MAC form based on the first destination IP.

[0091] The device determination module 303 is used to determine whether there is a second device connected to the first device in the three-layer device connection relationship table;

[0092] The simulation termination module 304 is used to terminate the path simulation if, no, the first interface is a gateway interface and the first MAC address of the first device is consistent with the first destination MAC address; wherein, the three-layer device connection relationship table includes the connection relationship between the three-layer devices and the connection relationship between the three-layer devices and the two-layer devices.

[0093] The path simulation device provided in the above embodiments can realize the technical solutions described in the above path simulation method embodiments. The specific implementation principles of each module or unit can be found in the corresponding content in the above path simulation method embodiments, and will not be repeated here.

[0094] like Figure 4 As shown, the present invention also provides an electronic device 400. The electronic device 400 includes a processor 401, a memory 402, and a display 403. Figure 4 Only some components of the electronic device 400 are shown, but it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented instead.

[0095] In some embodiments, memory 402 may be an internal storage unit of electronic device 400, such as a hard disk or memory of electronic device 400. In other embodiments, memory 402 may also be an external storage device of electronic device 400, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc. equipped on electronic device 400.

[0096] Furthermore, the memory 402 may include both internal storage units of the electronic device 400 and external storage devices. The memory 402 is used to store application software and various types of data installed on the electronic device 400.

[0097] In some embodiments, processor 401 may be a central processing unit (CPU), microprocessor, or other data processing chip, used to run program code stored in memory 402 or process data, such as the path simulation method of the present invention.

[0098] In some embodiments, display 403 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen. Display 403 is used to display information from electronic device 400 and to display a visual user interface. Components 401-403 of electronic device 400 communicate with each other via a system bus.

[0099] In some embodiments of the present invention, when the processor 401 executes the path simulation program in the memory 402, the following steps can be implemented:

[0100] Based on the five-tuple information entered by the user, determine the source IP and the first destination IP belonging to the first LAN;

[0101] Based on the source IP, determine the first device and the first interface from the MAC address table; based on the first destination IP, determine the first destination MAC address from the MAC address table;

[0102] Determine whether a second device connected to the first device exists in the three-layer device connection relationship table;

[0103] If not, then the path simulation ends when the first interface is a gateway interface and the first MAC address of the first device is the same as the first destination MAC address.

[0104] The three-layer device connection relationship table includes the connection relationship between the three-layer devices and the connection relationship between the three-layer devices and the two-layer devices.

[0105] It should be understood that when the processor 401 executes the path simulation program in the memory 402, in addition to the functions mentioned above, it can also perform other functions, as detailed in the description of the corresponding method embodiments above.

[0106] Furthermore, this embodiment of the invention does not specifically limit the type of electronic device 400 mentioned. Electronic device 400 can be a mobile phone, tablet computer, personal digital assistant (PDA), wearable device, laptop computer, or other portable electronic device. Exemplary embodiments of portable electronic devices include, but are not limited to, portable electronic devices running iOS, Android, Microsoft, or other operating systems. The aforementioned portable electronic device can also be other portable electronic devices, such as a laptop computer with a touch-sensitive surface (e.g., a touch panel). It should also be understood that in some other embodiments of the invention, electronic device 400 may not be a portable electronic device, but rather a desktop computer with a touch-sensitive surface (e.g., a touch panel).

[0107] Accordingly, this application also provides a computer-readable storage medium for storing computer-readable programs or instructions. When the programs or instructions are executed by a processor, they can implement the path simulation method steps or functions provided in the above-described method embodiments.

[0108] Those skilled in the art will understand that all or part of the processes of the methods described in the above embodiments can be implemented by a computer program instructing related hardware (such as a processor, controller, etc.), and the computer program can be stored in a computer-readable storage medium. The computer-readable storage medium may be a disk, optical disk, read-only memory, or random access memory, etc.

[0109] The path simulation method and apparatus provided by the present invention have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A path simulation method characterized by, include: Based on the five-tuple information entered by the user, determine the source IP and the first destination IP belonging to the first LAN; Based on the source IP, determine the first device and the first interface from the Mac form; The first destination MAC address is determined from the MAC form based on the first destination IP address; Determine whether a second device connected to the first device exists in the three-layer device connection relationship table; If not, then the path simulation ends when the first interface is a gateway interface and the first MAC address of the first device is the same as the first destination MAC address. The three-layer device connection relationship table includes the connection relationship between the three-layer devices and the connection relationship between the three-layer devices and the two-layer devices; The method further includes: If there is no second device connected to the first device in the Layer 3 device connection relationship table, then when the first interface is the gateway interface and the first MAC address is inconsistent with the first destination MAC address, the second LAN and the second destination IP of the second LAN are determined according to the Layer 3 logic. Replace the first LAN with the second LAN, replace the first destination IP with the second destination IP, and re-execute the step "determine the first destination MAC address from the MAC form based on the first destination IP"; The method further includes: If the second device connected to the first device does not exist in the three-layer device connection relationship table, then when the first interface is not the gateway interface and the first MAC address is inconsistent with the first destination MAC address, the path simulation will end abnormally and an abnormal result will be output. The method further includes: If the three-layer device connection relationship table contains a second device connected to the first device, then jump to the second device according to the first interface of the first device to determine the second interface; When the second device is a Layer 3 device, replace the second device with the first device, replace the second interface with the first interface, and re-execute the step of "determining whether there is a second device connected to the first device in the Layer 3 device connection relationship table".

2. The path simulation method according to claim 1, characterized in that, After determining the second interface by jumping to the second device based on the first interface of the first device, the process further includes: When the second device is a Layer 2 device, determine whether there is a third device connected to the second device in the Layer 2 device connection relationship table based on the second interface; If not, then the path simulation ends when the second interface is the gateway interface and the second MAC address of the second device is the same as the first destination MAC address; The Layer 2 device connection relationship table includes the connection relationships between the Layer 2 devices.

3. The path simulation method according to claim 2, characterized in that, After determining whether a third device connected to the second device exists in the Layer 2 device connection table based on the second interface, the method further includes: If the third device connected to the second device is not found in the Layer 2 device connection table, then when the second interface is the gateway interface and the second MAC address is inconsistent with the first destination MAC address, the third LAN and the third destination IP of the third LAN are determined according to the Layer 3 logic; the third LAN replaces the first LAN, the third destination IP replaces the first destination IP, and the step of "determining the first destination MAC address from the MAC table according to the first destination IP" is repeated. If the second interface is not the gateway interface and the second MAC address is inconsistent with the first destination MAC address, the path simulation will terminate abnormally and an abnormal result will be output.

4. The path simulation method according to claim 1, characterized in that, The three-layer logic is as follows: The second LAN of the VRF routing table in the virtual router is determined based on the first interface; If the 5-tuple information conforms to the access rules of the ACL, the 5-tuple information is modified through static NAT and destination NAT to obtain new 5-tuple information; Based on the new quintuple information, the second destination IP of the second LAN is obtained.

5. The path simulation method according to claim 1, characterized in that, The step of determining the source IP and the first destination IP belonging to the first LAN based on the five-tuple information input by the user includes: Determine whether the source IP and destination IP in the 5-tuple information belong to the same LAN; If so, then the same LAN is designated as the first LAN, and the destination IP is designated as the first destination IP; If not, then based on the third LAN and the fourth LAN to which the source IP and the destination IP belong respectively, determine the third destination IP corresponding to the third LAN and the fourth destination IP corresponding to the fourth LAN.

6. A path simulation device, characterized in that, For performing the path simulation method according to any one of claims 1 to 5, comprising: The IP determination module is used to determine the source IP and the first destination IP belonging to the first LAN based on the five-tuple information input by the user. The address determination module is used to determine the first device and the first interface from the MAC address table based on the source IP address; and to determine the first destination MAC address from the MAC address table based on the first destination IP address. The device determination module is used to determine whether there is a second device connected to the first device in the three-layer device connection relationship table; The simulation termination module is used to terminate the path simulation if, no, the first interface is a gateway interface and the first MAC address of the first device is consistent with the first destination MAC address; wherein, the three-layer device connection relationship table includes the connection relationship between the three-layer devices and the connection relationship between the three-layer devices and the two-layer devices.

7. An electronic device, characterized in that, include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the steps of the path simulation method as described in any one of claims 1-5.