Network device probing networking method and network device

By exchanging messages between master and slave routers, network topology changes can be quickly identified and the network can be re-probeed, solving the inefficiency problem when the network topology changes and ensuring the normal operation of network devices.

CN120750831BActive Publication Date: 2026-04-28HONOR DEVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HONOR DEVICE CO LTD
Filing Date
2024-08-16
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

When the network topology changes, existing technologies cannot quickly identify and automatically re-detect the network, causing network devices to be unable to resume normal operation in a timely manner.

Method used

By exchanging messages between the master router and slave routers, and utilizing topology discovery, topology notification, topology query request, and topology query reply messages, business scenarios can be quickly identified and network probing can be initiated.

Benefits of technology

This enables slave routers to quickly and promptly detect network formation when the master router changes, ensuring normal network operation and avoiding inefficiencies caused by waiting for router aging time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120750831B_ABST
    Figure CN120750831B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a kind of network equipment's detection networking method and network equipment, method is executed by first network equipment, comprising: in the case where receiving first message from second network equipment, second network equipment is sent to second message, wherein, first message is the message sent by second network equipment when satisfying first condition, first condition includes: third message from first network equipment or third network equipment is received by second network equipment, or, second network equipment detects that equipment restarts or networking switch opens;Fourth message is replied to second message from second network equipment, fourth message carries the device node information and running role information of second network equipment;According to fourth message, determine the service scenario that first network equipment is currently located, and according to service scenario, initiate detection networking to second network equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communication technology, specifically to a network device detection and networking method and a network device. Background Technology

[0002] As living standards improve, people's demands in various aspects are also increasing, such as living in large-sized apartments and renting large office buildings. In order to ensure that every corner of these areas can be covered by wireless networks, people will choose to use multiple network devices (such as routers) to form a network.

[0003] When using multiple routers to form a network, changes to the original network topology are inevitable, such as adding or replacing the main router or changing its parameters. Therefore, quickly identifying these changes and automatically re-detecting the network topology is a crucial problem that needs to be solved. Summary of the Invention

[0004] This application provides a network device detection method and a network device, which can enable the slave router to quickly and timely detect the network formation when the master router changes, through message exchange with the slave router, thus ensuring the normal operation of the network.

[0005] In a first aspect, this application provides a network device detection networking method, which is executed by a first network device and includes: upon receiving a first message from a second network device, sending a second message to the second network device, wherein the first message is a message sent by the second network device when a first condition is met, the first condition including: the second network device receiving a third message from the first network device or a third network device, or the second network device detecting a device restart or a networking switch being turned on; receiving a fourth message from the second network device in response to the second message, the fourth message carrying device node information and running role information of the second network device; determining the current business scenario of the first network device based on the fourth message, and initiating network detection networking to the second network device based on the business scenario.

[0006] In this application, the first and second network devices are initially in the same network. If the second network device changes, such as being replaced or restarted, the first network device needs to re-probe the network structure to ensure normal network operation. If the second network device is replaced, a third network device adjacent to it will send a third message to the second network device. If the second network device is a newly cascaded device on the first network device, the first network device will send a third message to the second network device. Furthermore, if the second network device is restarted or the network switch is turned on, the second network device will detect these changes. In these scenarios, the second network device can promptly send a first message to the first network device, which then triggers a second message to be sent to the second network device. The first network device then receives a fourth message in response from the second network device. The first network device can then parse the fourth message to determine the current business scenario and quickly initiate a network probing attack on the second network device to ensure normal network operation.

[0007] In some implementations, the second network device can be the master router, and the first network device can be the slave router connected to the downlink of the master router.

[0008] In some implementations, the first message can be a topology notification message, the second message can be a topology query request message, the fourth message can be a topology query response message, and the third message can be a topology discovery message.

[0009] In conjunction with the first aspect, in some implementations of the first aspect, determining the current business scenario of the first network device based on the fourth message includes: parsing the fourth message to obtain the device node information and operating role information of the second network device; and determining the current business scenario of the first network device based on the device node information and operating role information of the second network device and the operating role information of the first network device.

[0010] Since the fourth message carries the device node information and operational role information of the second network device, the first network device, upon receiving the fourth message from the second network device, can parse it to obtain the device node information and operational role information of the second network device. For example, the device node information includes the MAC address of the second network device. Then, the first network device can determine the aforementioned business scenario (or business scenario category) based on the parsed device node information and operational role information of the second network device, as well as its own operational role information. This provides a data foundation for the first network device to initiate probe networking, facilitating the first network device to quickly initiate probe networking based on the business scenario.

[0011] In conjunction with the first aspect, in some implementations of the first aspect, determining the current business scenario of the first network device based on the device node information and operating role information of the second network device, as well as the operating role information of the first network device, includes: if it is determined that there is no device node information of the second network device in the first network device, creating a corresponding device node based on the device node information of the second network device, and initializing the operating role of the device node to an initial value; if the operating role of the device node is an initial value, and the parsed operating role information of the second network device is the main router role, then determining the current business scenario of the first network device based on the operating role information of the first network device.

[0012] After the first network device resolves the device node information of the second network device, the first network device may or may not contain this device node information. If the first network device contains the device node information of the second network device, it means the second network device is not a new device, and the corresponding running role can be updated and saved based on the resolved running role information. If the first network device does not contain the device node information of the second network device, it means the second network device is a new device, and the device node can be created based on the resolved device node information, initializing its running role to the initial value. Subsequently, the first network device can determine the current service scenario based on the running role of the device node.

[0013] In the case of changes to the second network device, it should be a new device node relative to the first network device. Therefore, the operating role of this device node is initially set (i.e., the operating role has not yet been updated to the resolved operating role information). However, the operating role information parsed from the aforementioned message indicates a master router role, suggesting that the first network device will likely need to re-probe the network. Thus, the first network device can continue to determine its current service scenario based on its own operating role information. Consequently, the first network device can quickly initiate network probing based on the service scenario.

[0014] In conjunction with the first aspect, in some implementations of the first aspect, determining the current business scenario of the first network device based on its operational role information includes: if the operational role information of the first network device is a slave router, then the current business scenario of the first network device is determined to be either the first scenario or the second scenario, where the first scenario represents a scenario where the second network device is a newly replaced master router, and the second scenario represents a scenario where the second network device is restarted; if the operational role information of the first network device is a master router, then the current business scenario of the first network device is determined to be the third scenario, where the third scenario represents a scenario where the first network device is the old master router and the second network device is a new master router cascaded on the first network device; if the operational role information of the first network device is an initial value and a probe timeout has occurred, then the current business scenario of the first network device is determined to be the fourth scenario, where the fourth scenario represents a scenario where the network detection timeout occurs after the first network device, and the network switch of the second network device is turned on.

[0015] In the first and second scenarios, the primary router is replaced or restarted; the first network device remains unchanged and continues as a secondary router. In the third scenario, a new primary router (second network device) is cascaded onto the old primary router (the first network device). Although the first network device is demoted to a secondary router, its operational role information remains unchanged, retaining its previous primary router role. In the fourth scenario, the first network device previously experienced a probe timeout, meaning it failed to establish a network; therefore, it has not updated its operational role information, which remains at its initial value.

[0016] In conjunction with the first aspect, in some implementations of the first aspect, the above-mentioned initiation of probing network formation to the second network device according to the business scenario includes: when the business scenario is the first scenario, the second scenario, or the fourth scenario, the first network device initiates probing network formation on all ports, and completes the network formation after receiving the probing response from the second network device; when the business scenario is the third scenario, the first network device initiates probing network formation on the WAN interface, and completes the network formation after receiving the probing response from the second network device.

[0017] After identifying the business scenario, the first network device can initiate a probe network based on that scenario. In scenarios one, two, or four, the first network device can initiate probe requests on all ports or plug-in ports. This is because the first network device's ports may connect to other network devices besides upstream devices, such as computers. However, the first network device is unsure which port is connected to a network device, so it can initiate probe requests from all ports or plug-in ports. Once it receives a probe response from a port connected to a network device, it will act as a slave router to complete the probe network. In scenario three, the first network device can initiate probe requests only on the WAN port. This is because this scenario involves cascading a new master router onto an older master router. The new master router can only be upstream of the older master router. Therefore, in this scenario, the first network device (i.e., the older master router) can initiate probe requests only on the upstream WAN port to improve probe efficiency. After receiving a probe response, the first network device will degrade itself to a slave router role to complete the probe network.

[0018] In conjunction with the first aspect, in some implementations of the first aspect, when the first condition is that the second network device receives a third message from the first network device or the third network device, the third message is a message sent by the first network device or the third network device when it detects a port plugging / unplugging event.

[0019] As described above, if the second network device is replaced, the third network device adjacent to the second network device will send a third message to the second network device. If the second network device is a newly cascaded device on the first network device, the first network device will send a third message to the second network device. In other words, upon receiving the third message, the second network device will trigger the sending of a first message to the first network device. The third message sent by either the first or third network device is typically sent upon detecting a port plugging / unplugging event. This is because when the second network device is replaced, a plugging / unplugging event occurs on the port of the third network device, and similarly, when a new cascaded device is added to the first network device, a plugging / unplugging event occurs on the port of the first network device. Therefore, the second network device can promptly send a first message to the first network device when a state change occurs, triggering the first network device to quickly and timely perform network detection.

[0020] Secondly, this application provides a network device detection networking method, which is executed by a second network device and includes: sending a first message to a first network device when a first condition is met, the first condition including: the second network device receiving a third message from the first network device or a third network device, or the second network device detecting a device restart or a networking switch being turned on; receiving a second message from the first network device and replying to the first network device with a fourth message in response to the second message, the fourth message carrying device node information and running role information of the second network device; receiving a detection networking request from the first network device and replying to the first network device with a detection response, the detection networking request being a request initiated by the first network device based on the business scenario after determining the current business scenario of the first network device based on the fourth message.

[0021] In this application, the first and second network devices are initially in the same network. If the second network device changes, such as being replaced or restarted, the first network device needs to re-probe the network structure to ensure normal network operation. If the second network device is replaced, a third network device adjacent to it will send a third message to the second network device. If the second network device is a newly cascaded device on the first network device, the first network device will send a third message to the second network device. Furthermore, if the second network device is restarted or the network switch is turned on, the second network device will detect these changes. In these scenarios, the second network device can promptly send a first message to the first network device, which then triggers a second message to be sent to the second network device. The first network device then receives a fourth message in response from the second network device. The first network device can then parse the fourth message to determine the current business scenario and quickly initiate a network probing attack on the second network device to ensure normal network operation.

[0022] In conjunction with the first aspect, in some implementations of the first aspect, when the second network device receives a third message from the first network device or the third network device, the above method further includes: parsing the third message to determine whether the first network device or the third network device is a new device;

[0023] Accordingly, sending a first message to the first network device includes: sending a first message to the first network device when the first network device or the third network device is a new device.

[0024] Typically, when the second network device receives the third message, since the second network device has changed, it will not store information about the first or third network device. That is, the first or third network device should be a new device relative to the second network device. Therefore, if the parsing determines that the first or third network device is a new device, the first message can be sent to the first network device to trigger the first network device to quickly and timely perform network detection.

[0025] Thirdly, this application provides an apparatus included in a network device. This apparatus has the function of implementing the network device behavior described in the first aspect and its possible implementations, or it has the function of implementing the network device behavior described in the second aspect and its possible implementations. The function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules or units corresponding to the above functions. For example, a receiving module or unit, a processing module or unit, etc.

[0026] Fourthly, this application provides a first network device, comprising:

[0027] The message processing module is used to receive a first message from the second network device, wherein the first message is a message sent by the second network device when a first condition is met. The first condition includes: the second network device receives a third message from the first network device or the third network device, or the second network device detects that the device has restarted or the network switch has been turned on.

[0028] The topology management module is used to trigger the message processing module to send a second message to the second network device;

[0029] The message processing module is also used to receive a fourth message from the second network device in response to the second message. The fourth message carries the device node information and running role information of the second network device.

[0030] The network management module is used to provide different detection interfaces for different business scenarios;

[0031] The scene recognition module is used to determine the current business scene of the first network device based on the fourth message, and to call the network management module to initiate a network probe to the second network device according to different probe interfaces based on the business scene.

[0032] Fifthly, this application provides a second network device, comprising:

[0033] The message processing module is used to send a first message to the first network device when a first condition is met. The first condition includes: the second network device receives a third message from the first network device or the third network device, or the second network device detects that the device has restarted or the network switch has been turned on.

[0034] The message processing module is also used to receive a second message from the first network device;

[0035] The topology management module is used to trigger the message processing module to reply to the first network device with a fourth message in response to the second message. The fourth message carries the device node information and running role information of the second network device.

[0036] The network management module is used to receive network probe requests from the first network device and reply to the first network device with probe responses. The network probe request is initiated by the first network device based on the business scenario after determining the current business scenario of the first network device according to the fourth message.

[0037] Sixthly, this application provides a network device, which includes: a processor and a transceiver;

[0038] The transceiver is used to send messages to other network devices or receive messages sent by other network devices; the processor is used to invoke computer instructions to cause the network device to execute any one of the technical solutions in the first aspect or any one of the technical solutions in the second aspect.

[0039] In a seventh aspect, this application provides a chip system applied to a network device. The chip system includes one or more processors, which are configured to invoke computer instructions to cause the network device to perform the methods of the first aspect and any possible implementation thereof, or to perform the methods of the second aspect and any possible implementation thereof.

[0040] Optionally, the chip system also includes a memory, which is connected to the processor via circuitry or wires.

[0041] Alternatively, the chip system may also include a communication interface.

[0042] Eighthly, this application provides a computer-readable storage medium including instructions that, when executed on a network device, cause the network device to perform any method of the technical solution of the first aspect, or any method of the technical solution of the second aspect.

[0043] Ninthly, this application provides a computer program product, which includes: computer program code, which, when run on a network device, causes the network device to execute any method of the technical solution of the first aspect, or to execute any method of the technical solution of the second aspect. Attached Figure Description

[0044] Figure 1 This is a schematic diagram of a network topology obtained by networking multiple routers, as provided in an embodiment of this application.

[0045] Figure 2 This is a schematic diagram illustrating a scenario where the network topology changes, as provided in an embodiment of this application.

[0046] Figure 3 This is another example of a scenario where the network topology changes, as provided in the embodiments of this application.

[0047] Figure 4 This is another example of a scenario where the network topology changes, as provided in the embodiments of this application.

[0048] Figure 5 This is another example of a scenario where the network topology changes, as provided in the embodiments of this application.

[0049] Figure 6 This is a schematic diagram of the system architecture used in an example of a network device detection and networking method provided in this application embodiment;

[0050] Figure 7 This is a schematic diagram of message interaction for a network device detection networking method provided in an embodiment of this application;

[0051] Figure 8 This is a schematic diagram of message interaction for another network device detection networking method provided in this application embodiment;

[0052] Figure 9 This is a schematic diagram of message interaction for another example of a network device detection and networking method provided in this application embodiment;

[0053] Figure 10 This is a schematic diagram of message interaction for another example of a network device detection and networking method provided in this application embodiment;

[0054] Figure 11 This is a flowchart illustrating a network device detection and networking method provided in an embodiment of this application. Detailed Implementation

[0055] The technical solutions of the embodiments of this application will be described below with reference to the accompanying drawings. In the description of the embodiments of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B; "and / or" in this text is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, in the description of the embodiments of this application, "multiple" refers to two or more than two.

[0056] Hereinafter, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first," "second," or "third" may explicitly or implicitly include one or more of that feature.

[0057] As living standards improve, people's demands in various aspects are also increasing, such as living in large-sized apartments and renting large office buildings. In order to ensure that every corner of these areas can be covered by wireless networks, people will choose to use multiple network devices to form a network.

[0058] The network device mentioned here can be a router, or other devices with network connectivity and data packet forwarding functions. This application uses a router as an example for illustration. Traditional methods of networking multiple routers include, but are not limited to, wireless bridging, wired connections, and hybrid networking. Wireless bridging is a common method of networking multiple routers. In this method, one router acts as the master router, and the other routers act as slave routers. The master router is connected to the internet via a wired connection, while the slave routers are connected to the master router wirelessly. Wired connections are a simple method of networking multiple routers, in which all routers are connected to the internet via wired connections. Hybrid networking is a complex method of networking multiple routers, in which several of the above methods can be combined, and a suitable combination can be selected according to actual needs. It is understood that the network device detection networking method proposed in this application can be adapted to any of the above networking methods.

[0059] When multiple network devices (such as routers) are used to form a network, changes to the original network topology are inevitable, such as adding or replacing the main router, or changing the main router's parameters. For example, the topology obtained by networking multiple routers can be as follows: Figure 1 As shown, for Figure 1 In diagram (a), after the main router connects to the gateway, multiple slave routers are connected in parallel downstream. Figure 1In diagram (b), after the main router connects to the gateway, multiple slave routers are sequentially connected downstream. Of course, there are many other network topologies, which will not be listed here. After multiple routers form a network, each router will have a unique Internet Protocol address (IP address) and subnet mask. Different routers use different IP addresses. The gateway address is usually set to the IP address of the main router. The subnet masks on all routers are set to be consistent to ensure correct network identification. At the same time, all routers will use the same Service Set Identifier (SSID) for communication.

[0060] In these scenarios, if the main router is added or replaced, or its parameters are changed, resulting in a change in the network topology, it is urgent to solve the problem of how to quickly identify the network change scenario and automatically re-detect the network.

[0061] Below, we will first introduce several common scenarios where network topology changes. The first scenario is... Figure 2 As shown, the original topology is that the main router R1 is connected to the gateway, and downstream routers R2, R3, etc. are connected sequentially. Now, the main router R1 is replaced with R4. During the replacement process, the slave router R2 can detect port plugging / unplugging events (down / up events), thus triggering a reconfiguration. However, since the slave router R3 is connected to the slave router R2, and there is no change in port status between R2 and R3, the slave router R3 cannot detect that the main router R1 has been replaced by R4, and therefore cannot initiate a probe, meaning it cannot reconfigure the network with the new main router R4. In related technologies, to address this issue, during the replacement of the primary router R1 with R4, since messages cannot be sent to the secondary router R3 within a short period, the secondary router R3 will wait for a route aging time (e.g., 3 minutes). After this time, it will trigger a re-establishment of the network with the new primary router R4. However, within this route aging time, the primary router R4 may have already completed the replacement and started working (e.g., the replacement was completed in 1 minute), while the secondary router R3 is still waiting. Obviously, this method is inefficient and cannot quickly identify and trigger a re-probe network. The aforementioned route aging time refers to the process where, after a router loses its connection with a neighboring router, if the connection is not re-established within a certain time interval, the router will remove the routing information related to that neighboring router.

[0062] The second scenario, such as Figure 3As shown, the original topology is that the main router R1 is connected to the gateway, and downstream routers R2, R3, etc. are connected sequentially. Now, the network parameters of the main router R1 are modified and restarted. During the instantaneous restart, the slave router R2 can detect the port plugging / unplugging event (down / up event), and thus trigger a reconfiguration. However, since the slave router R3 is connected to the slave router R2, and there is no change in the port status between R2 and R3, the slave router R3 cannot detect the parameter changes of the main router R1, and therefore cannot initiate a probe, that is, it cannot reconfigure and synchronize the parameters with the main router R1 whose network parameters have been modified. In related technologies, to solve this problem, during the reboot process of the main router R1, since it cannot send messages to the secondary router R3 in a short period of time, the secondary router R3 will wait for a route aging time (e.g., 3 minutes). After that time, it will trigger a re-network with the main router R1. However, during this route aging time, the main router R1 may have already completed rebooting and started working (e.g., rebooted in 1 minute), while the secondary router R3 is still waiting. Obviously, this method is inefficient and cannot quickly identify and trigger a re-probe network.

[0063] The third scenario, such as Figure 4 As shown, the original topology had a master router R1 connected to the gateway, with subsequent downstream connections to slave routers R2, etc. Now, a third router R3 is connected between the master router R1 and the gateway, making R3 the master router and demoting the old master router R1 to a slave router. In this scenario, router R1 cannot automatically re-initiate a re-probe, meaning it cannot revert to a slave router and network with the new master router R3. Instead, the user needs to manually configure router R1 to re-probe the network. Clearly, this method is not quick enough to identify and trigger a re-probe.

[0064] The fourth scenario, such as Figure 5As shown, the original topology is that the main router R1 is connected to the gateway, and downstream routers R2, etc., are connected sequentially. If the network topology switch was not enabled when the main router R1 was initially configured, after the secondary router R2 connects to the main router R1, it is assigned an IP address and attempts to probe the network. However, because the main router R1's network topology switch is off, it will not respond to the probe messages even if it receives them. Typically, the secondary router R2 will probe the network topology within a certain time period (e.g., within 1 minute), for example, probing once every 2 seconds, 30 times within 1 minute. If it does not receive a probe response within this time period, the secondary router R2 will confirm that the probe has timed out. If the main router R1's network topology switch is subsequently enabled, the secondary router R2 will not re-initiate the probe because its probe has already timed out. In this scenario, users need to manually configure the secondary router R2 to re-probe the network. This method cannot quickly identify and trigger the re-probe network. Alternatively, the secondary router R2 can be configured to continuously monitor the network status of the primary router R1 and initiate network probing when the network switch of the primary router R1 is turned on. However, this method will cause the power consumption of the secondary router R2 to increase, wasting resources.

[0065] Therefore, for the four scenarios where the network topology changes as described above, the relevant technologies cannot quickly identify the network change scenario and automatically re-detect the network. In view of this, this application provides a network device network detection method. This method enables the slave router to quickly and promptly detect the network topology through message exchange with the slave router when the master router changes, ensuring the normal operation of the network. It is understood that, in addition to the four scenarios mentioned above, the network device network detection method can also be applied to other similar scenarios, which will not be listed here. For ease of description, the network device described in the following embodiments is a router.

[0066] As described in the above scenario, each network topology involves interaction between the master router and slave routers, typically through message exchange. These messages can carry various device information and requests; therefore, both the master and slave routers should possess message management and processing capabilities. Based on this, the network device detection network method provided in this application embodiment can be applied to… Figure 6 The system architecture shown can include a master router (controller) and multiple slave routers (agents). The master router can also be called the probed object, and the slave routers can be called the probe initiators. The multiple slave routers can include the same modular structure. Figure 6 Let's take a router structure as an example for description.

[0067] See Figure 6The main router can include a topology management module, a network management module, and a packet processing module. The topology management module manages the device node information of each router, such as storing device node information indexed by the router's media access control address (MAC address), and storing the operating role information of each router, such as the router's own operating role as the main router. Furthermore, the topology management module actively initiates corresponding topology notifications or messages when new device node information is added, when a topology message is received from another router, during router initialization, or when the network switch status changes. The network management module receives network probe requests from slave routers and replies with probe response information. The packet processing module assembles probe messages and various topology messages, fills in the required field information, and parses the received probe messages and various topology messages, resolving their respective field information. In some implementations, the aforementioned device node information and operating role information can be collectively referred to as topology information.

[0068] A router can include a topology management module, a network management module, a packet processing module, and a scenario identification module. The topology management module manages the device node information of each router, such as storing device node information indexed by the router's MAC address and storing the operating role information of each router, such as the router's own operating role being a slave router; and triggering or replying to the corresponding topology packet when it receives a topology packet from the master router. The network management module provides different probe interfaces for different service scenarios, such as whether the probe request needs to be initiated on all ports or only on a specific port (e.g., only on the wide area network (WAN) interface). The packet processing module assembles probe packets and various topology packets, fills in the required field information, and parses the received probe packets and various topology packets, parsing their respective field information. The scenario identification module identifies the specific service scenario based on the topology packet input from the topology management module, and calls the network management module to perform probe networking according to different probe interfaces based on different service scenarios.

[0069] exist Figure 6Based on the system architecture shown, in this embodiment, the master router can trigger the message processing module to initiate a corresponding topology message when the topology management module receives a topology message from the slave router or when its own device node information changes. The message processing module assembles the topology message and sends it to the message processing module of the slave router. The message processing module of the slave router forwards the topology message to the topology management module. The topology management module can trigger a reply based on the content of the topology message, or output it to the scene recognition module. If a reply is triggered, it means that the message processing module interacts with the message processing module of the master router again. If it is output to the scene recognition module, the scene recognition module can identify the topology message, obtain the specific business scenario, and then call the network management module to initiate a network probe. During the network probe process, the network management module of the slave router can send probe messages to the message processing module of the master router through the message processing module according to different probe interfaces. Finally, the network management module of the master router receives the probe messages forwarded by the message processing module and replies with probe response information to complete the network probe process.

[0070] The topology messages exchanged between the master router and the slave router may include, but are not limited to, topology discovery messages, topology notify messages, topology query request messages, and topology query response messages.

[0071] Topology discovery messages are a type of neighbor multicast message. A network device can only send this message to its neighboring devices. By sending and parsing topology discovery messages, network devices can dynamically obtain the topology of their network, enabling better routing, switching, and fault diagnosis. Topology discovery messages can carry information such as device ID (e.g., MAC address), device type (e.g., router, switch), connectivity (e.g., connection ports), and protocol type.

[0072] Topology notification is a type of relay multicast message. It is a message sent by a network device that can be received by all other devices in the network. When the device node information of a network device changes, it can notify other network devices to maintain the accuracy of the information.

[0073] Topology query request (TDRP) and topology query response (TDRR) messages are unicast messages. When network device A sends a TDRP to another network device B, network device B will reply with a TDRR. The TDRP can be used to query the topology information of a network device, while the TDRR can carry the device's own node information (such as MAC address) and running role information.

[0074] Based on the above description of the system architecture and topology messages, the following will describe in detail the solutions of this application for the four scenarios in which the network topology structure changes.

[0075] In the first scenario, after replacing the master router R1 with R4, the slave router R2 can detect port plug / unplug events (down / up events). At this time, the slave router R2 can send a topology message to the new master router R4 to trigger the slave router R3 to probe the network. For details, please refer to [link to documentation]. Figure 7 This includes the following steps:

[0076] S11, a port plugging / unplugging event was detected from router R2.

[0077] Typically, since router R2 is connected to the master router R1, when the master router R1 is replaced, it's necessary to reconnect router R2 to the new master router R4. This can be done by plugging a network cable between the two routers, resulting in a cable plug-in / unplug event. Router R2 will detect this event. Generally, since the network cable is unplugged before plugged in, router R2 will detect a down event first, then an up event. It's understandable that because router R2 needs to detect port plug-in / unplug events in this step, a wired connection between router R2 and master router R4 is required in this scenario. However, the connection method for other routers is not restricted; wired or wireless connections are both acceptable.

[0078] In some implementations, port plugging and unplugging events can be detected from the network management module in router R2.

[0079] S12, a topology discovery message is sent from router R2 to the master router R4.

[0080] In other words, once router R2 detects a plug-in / plug-out event, it sends a topology discovery message to the new master router R4, triggering subsequent message sending actions by master router R4, ultimately causing router R3 to re-establish a network with the new master router R4. This topology discovery message can carry at least information such as the MAC address of router R2.

[0081] In some implementations, the packet processing module in router R2 can send topology discovery packets to the master router R4.

[0082] S13, the master router R4 resolves the topology discovery message to determine whether the slave router R2 is a new device. If so, proceed to S14.

[0083] After receiving the topology discovery message, the main router R4 can parse the message to extract information such as the MAC address. It then checks its own device list for the MAC address. If the main router R4 is a newly connected device, its device list should not contain information about the secondary router R2, confirming that R2 is a new device.

[0084] In some implementations, the packet processing module in the master router R4 can parse the topology discovery packets and send the parsing results to the topology management module.

[0085] S14, the main router R4 sends a topology notification message.

[0086] Since the master router R4 resolves that the slave router R2 is a new device, it means that the slave router R2 and other slave routers may not have recorded the information of the master router R4. Therefore, the master router R4 can send a topology notification message to notify other routers in the network.

[0087] It's understandable that both routers R2 and R3 will receive the topology notification message sent by the master router R4. Since router R2 is directly connected to the master router R4 and has already detected the aforementioned plug-in / plug-out event, router R2 can directly initiate a network probe. Router R3, however, has not yet detected the replacement of master router R1 with R4. Therefore, upon receiving the topology notification message from master router R4, it can perform the following procedure. It's also understandable that if other routers are connected after router R3, or if other routers are connected in parallel, these other routers can perform the same procedure as router R3.

[0088] In some implementations, the topology management module in the main router R4 can trigger the message processing module to send a topology notification message.

[0089] S15: Receives a topology notification message from router R3 and sends a topology query request message to the master router R4.

[0090] After receiving the topology notification message from router R3, in order to re-establish the network between router R3 and router R4, router R3 needs to know the topology information of router R4, such as device node information and running role information. Therefore, router R3 can send a topology query request message to router R4 to query the topology information of router R4.

[0091] In some implementations, the packet processing module of router R3 can send a topology query request packet to the master router R4.

[0092] S16, the master router R4 replies to the slave router R3 with a topology query reply message.

[0093] When the main router R4 receives a topology query request message, it needs to reply with a topology query reply message within a certain time (e.g., within 1 second). This message carries the device node information (e.g., MAC address) and running role information (here, the main router role) of the main router R4.

[0094] S17 receives a topology query response message from router R3, performs scene recognition, and initiates a network probe.

[0095] The process of scene identification from router R3 based on the topology query reply message is described below. Figure 11 The content of the illustrated embodiment.

[0096] In some implementations, after the topology query response message is parsed by the message processing module of router R3, it can be sent to the topology management module. The topology management module outputs the message content to the scene recognition module, which then identifies the specific business scenario.

[0097] In the first scenario described above, when the replacement of the master router is detected, the slave router can quickly identify the network change scenario and automatically re-probe the network through several topology message exchanges between the master router and the slave router, without waiting for the route aging time, which is highly efficient.

[0098] In the second scenario, after modifying the network parameters of the main router R1 and restarting it, the main router R1 can recognize its own restart operation and send a topology message to the slave router R3, thereby triggering the slave router R3 to probe the network formation. For details, please refer to [link to documentation / documentation]. Figure 8 This includes the following steps:

[0099] S21, the main router R1 detected its own reboot operation.

[0100] S22, the main router R1 sends a topology notification message.

[0101] Network devices typically monitor and record their own status. When the main router R1 detects that it has restarted, it can proactively send a topology notification message to notify other routers in the network.

[0102] It's understandable that both routers R2 and R3 will receive the topology notification message sent by the master router R1. Since router R2 is directly connected to the master router R1 and will detect the plug-in / plug-out event during the master router R1's reboot process, router R2 can directly initiate a network probe. Router R3, however, has not yet detected the master router R1's reboot event, so upon receiving the topology notification message from the master router R1, it can perform the following procedure. It's also understandable that if other routers are connected after router R3, or if other routers are connected in parallel, these other routers can perform the same procedure as router R3.

[0103] In some implementations, the topology management module in the main router R1 can trigger the message processing module to send a topology notification message.

[0104] S23: Receives a topology notification message from router R3 and sends a topology query request message to the master router R1.

[0105] After receiving the topology notification message from router R3, in order to re-establish a network between router R3 and the master router R1 after the network parameters have been modified, router R3 needs to know the topology information of the master router R1, such as device node information and running role information. Therefore, router R3 can send a topology query request message to the master router R1 to query the topology information of the master router R1.

[0106] In some implementations, the packet processing module of router R3 can send a topology query request packet to the master router R1.

[0107] S24, the master router R1 replies to the slave router R3 with a topology query reply message.

[0108] When the main router R1 receives a topology query request message, it needs to reply with a topology query reply message within a certain time (e.g., within 1 second). This message carries the device node information (e.g., MAC address) and running role information (here, the main router role) of the main router R1.

[0109] S25 receives a topology query response message from router R3, performs scene recognition, and initiates a network probe.

[0110] The process of scene identification from router R3 based on the topology query reply message is described below. Figure 11The content of the illustrated embodiment.

[0111] In some implementations, after the topology query response message is parsed by the message processing module of router R3, it can be sent to the topology management module. The topology management module outputs the message content to the scene recognition module, which then identifies the specific business scenario.

[0112] In the second scenario described above, when the master router detects network parameter modifications and restarts, the slave router can quickly identify the network change scenario and automatically re-detect the network through several topology message exchanges between the master and slave routers, without waiting for route aging time, which is highly efficient.

[0113] In the third scenario, after connecting another router R3 between the main router R1 and the gateway, router R3 should become the main router, and router R1 should become a slave router. When connecting to the main router R3, the slave router R1 should be able to detect port plug / unplug events (down / up events). At this time, the slave router R1 can send a topology message to the new main router R3 to subsequently trigger the slave router R1 to probe the network. For details, please refer to [link to documentation]. Figure 9 This includes the following steps:

[0114] S31, the port plugging and unplugging events were detected from router R1.

[0115] Typically, since router R1 is originally connected to the gateway, when cascading a master router R3, it's necessary to disconnect router R1 from the gateway and connect it to the master router R3. For example, this involves unplugging the network cable between router R1 and the gateway and then reconnecting it to the master router R3. This triggers a cable plug-in / unplug event, which router R1 will detect. Generally, because the cable is unplugged before plugged in, router R1 will detect a down event first, then an up event. It's understandable that because router R1 needs to detect port plug-in / unplug events in this step, a wired connection between router R1 and master router R3 is required in this scenario. However, the connection method for other routers is not restricted; wired or wireless connections are both acceptable.

[0116] In some implementations, port plugging and unplugging events can be detected from the network management module in router R1.

[0117] S32, a topology discovery message is sent from router R1 to the master router R3.

[0118] In other words, once router R1 detects a plug / unplug event, it sends a topology discovery message to the new master router R3, triggering subsequent message sending actions by master router R3, ultimately causing router R1 to re-establish a network connection with master router R3. This topology discovery message can carry at least information such as the MAC address of router R1.

[0119] In some implementations, the packet processing module in router R1 can send topology discovery packets to the master router R3.

[0120] S33: The master router R3 resolves the topology discovery message to determine whether the slave router R1 is a new device. If so, proceed to S34.

[0121] After receiving the topology discovery message, the main router R3 can parse the message to extract information such as the MAC address. It then checks its own device list to see if the MAC address exists. If the main router R3 is a newly connected device, its device list should not contain information about the secondary router R1, confirming that the secondary router R1 is a new device.

[0122] In some implementations, the packet processing module in the main router R3 can parse the topology discovery packet and send the parsing result to the topology management module.

[0123] S34, the main router R3 sends a topology notification message.

[0124] Since the master router R3 resolves that the slave router R1 is a new device, it means that the slave router R1 and other slave routers may not have recorded the information of the master router R3. Therefore, the master router R3 can send a topology notification message to notify other routers in the network.

[0125] It is understandable that both routers R1 and R2 will receive topology notification messages sent by the master router R3. Therefore, upon receiving the topology notification message, both routers R1 and R2 can execute the following process, which is described below using router R1 as an example. It is also understandable that if other routers are connected after router R2, or if other routers are connected in parallel, these other routers can also execute the same process as router R1. However, the difference is that router R1 has been demoted from master router to slave router, and its role can be changed subsequently, while the role of router R2 remains unchanged.

[0126] In some implementations, the topology management module in the main router R3 can trigger the message processing module to send a topology notification message.

[0127] S35 receives a topology notification message from router R1 and sends a topology query request message to the master router R3.

[0128] After receiving the topology notification message from router R1, in order to re-establish the network between router R1 and router R3, router R1 needs to know the topology information of router R3, such as device node information and running role information. Therefore, router R1 can send a topology query request message to router R3 to query the topology information of router R3.

[0129] In some implementations, the packet processing module of router R1 can send a topology query request packet to the master router R3.

[0130] S36, the master router R3 replies to the slave router R1 with a topology query reply message.

[0131] When the main router R3 receives a topology query request message, it needs to reply with a topology query reply message within a certain time (e.g., within 1 second). This message carries the device node information (e.g., MAC address) and running role information (here, the main router role) of the main router R3.

[0132] S37 receives a topology query response message from router R1, performs scene recognition, and initiates a network probe.

[0133] The process of scene identification from router R1 based on the topology query reply message is described below. Figure 11 The content of the illustrated embodiment. It can be understood that when router R1 detects the network, it can also automatically modify its own running role information to the role of a slave router.

[0134] In some implementations, after the topology query response message is parsed by the message processing module of router R1, it can be sent to the topology management module. The topology management module outputs the message content to the scene recognition module, which then identifies the specific business scenario.

[0135] In the third scenario described above, when another master router is cascaded onto the old master router and the old master router is demoted to a slave router, the slave router can quickly identify the network change scenario and automatically re-detect the network through several topology message exchanges between the new master router and the slave router. This eliminates the need for manual configuration by the user and is highly efficient.

[0136] In the fourth scenario, after router R2's probe times out and the main router R1's network switch is turned on again, the main router R1 can recognize this switch operation and send a topology message to the slave router R2, subsequently triggering the slave router R2 to probe the network. For details, please refer to [link to documentation]. Figure 10 This includes the following steps:

[0137] S41, the networking switch of the main router R1 is in the off state.

[0138] S42 initiated a network probe from router R2, but received no probe response, confirming that the probe timed out.

[0139] In other words, after router R2 connects to the master router R1, router R2 is assigned an IP address and initiates a network probe. However, because the master router R1's network switch is off, it will not respond to the probe even if it receives the probe message. If router R2 does not receive a probe response within a certain period of time, it will confirm a probe timeout.

[0140] S43, the main router R1 detected that the network switch was turned on.

[0141] S44, the main router R1 sends a topology notification message.

[0142] Network devices typically monitor and record their own status. When the main router R1 detects that the network switch has been turned on at a certain time, it can proactively send a topology notification message to notify other routers in the network.

[0143] It's understandable that if other slave routers are connected after router R2, or if other slave routers are connected in parallel, these other slave routers will also be unable to complete the network detection if the network topology switch on the main router R1 is not initially turned on. Therefore, after the network topology switch on the main router R1 is turned on, the other slave routers can perform the same process as slave router R2.

[0144] In some implementations, the topology management module in the main router R1 can trigger the message processing module to send a topology notification message.

[0145] S45: Receives a topology notification message from router R2 and sends a topology query request message to the master router R1.

[0146] After receiving the topology notification message from router R2, in order to re-establish the network between router R2 and router R1, router R2 needs to know the topology information of router R1, such as device node information and running role information. Therefore, router R2 can send a topology query request message to router R1 to query the topology information of router R1.

[0147] In some implementations, the packet processing module of router R2 can send a topology query request packet to the master router R1.

[0148] S46, the master router R1 replies to the slave router R2 with a topology query reply message.

[0149] When the main router R1 receives a topology query request message, it needs to reply with a topology query reply message within a certain time (e.g., within 1 second). This message carries the device node information (e.g., MAC address) and running role information (here, the main router role) of the main router R1.

[0150] S47 receives a topology query response message from router R2, performs scene recognition, and initiates a network probe.

[0151] The process of scene identification from router R2 based on the topology query reply message is described below. Figure 11 The content of the illustrated embodiment.

[0152] In some implementations, after the topology query response message is parsed by the message processing module of router R2, it can be sent to the topology management module. The topology management module outputs the message content to the scene recognition module, which then identifies the specific business scenario.

[0153] In the fourth scenario described above, when the master router detects that its network switch has been turned on, the slave router can quickly identify the network change scenario and automatically re-probe the network through several topology message exchanges between the master router and the slave router. This eliminates the need for manual configuration by the user or continuous detection by the slave router, resulting in high efficiency and resource conservation.

[0154] In the four scenarios described above, message exchange occurred. After receiving the topology query reply message from the master router, the slave router can parse the message to trigger scenario recognition and network detection. It's understood that the four scenarios are illustrated using different slave routers as examples, but the scenario recognition process performed by different slave routers is the same. The following description uses a single slave router as an example. Specifically, as... Figure 11 As shown, the process of scene recognition and network detection from the router includes:

[0155] S51 parses the topology query response message from the router to obtain the device node information and running role information of the main router.

[0156] Because the topology query response message carries the device node information and running role information of the master router, this information can be obtained from the router. For example, the device node information includes the MAC address.

[0157] It's understandable that, in the first scenario, router R3 resolves the device node information and operational role information of the main router R4; in the second scenario, router R3 resolves the device node information and operational role information of the main router R1; in the third scenario, router R1 resolves the device node information and operational role information of the main router R3; and in the fourth scenario, router R2 resolves the device node information and operational role information of the main router R1. Normally, the operational role information resolved here should be the main router's role.

[0158] S52: Query the router to see if the device node information already exists. If it exists, proceed to S53; otherwise, proceed to S54.

[0159] In other words, the slave router checks its own stored device list to see if the parsed device node information exists. If it does, it means the corresponding master router is not a new device on the slave router, and the update operation in S53 can be performed. If it does not exist, it means the corresponding master router is a new device on the slave router, and the device node needs to be created in S54. In some implementations, the slave router can check whether the MAC address in the device node information already exists.

[0160] S53 updates and saves the running role of the corresponding device node based on the running role information.

[0161] Here, after updating the running role of the storage from the router, the subsequent S55 steps can be executed.

[0162] S54: Create a device node from the router based on the device node information and initialize the running role of the device node to the initial value.

[0163] If the router does not store the device node information obtained from the above parsing, the router can create a new device node corresponding to the device node information. In this case, its running role can be assigned an initial value, such as none, and then the subsequent S55 steps can be executed.

[0164] S55: Determine whether the running role corresponding to the device node is the initial value and whether the parsed running role information is the main router role. If yes, proceed to S56; otherwise, discard this packet.

[0165] In all four scenarios described above—replacing or cascading the master router, changing the master router's network parameters, or turning on the master router's network switch—the master router should be a new device node relative to the slave router. Therefore, step S54 should be executed. At this point, the running role of the device node is the initial value (i.e., the running role has not yet been updated to the resolved running role information). However, the running role information obtained from the parsed message is the master router's role, indicating that the slave router is highly likely to need to re-probe the network. Therefore, the slave router continues to execute the subsequent step S56. If the running role of the device node is not the initial value (e.g., the update step S53 is executed), it means that the master router is not a new device node relative to the slave router and may not need to re-probe the network. Alternatively, if the resolved running role information is not the master router's role, it means that the message may not have come from the master router, and re-probe the network is also unnecessary.

[0166] It is understood that the process of obtaining the running role information from the router by parsing the packet can be performed in S51 above, or it can be performed after S54. This application embodiment does not limit this.

[0167] S56 determines the service scenario category from the router's own operational role information.

[0168] Since the router also stores its own runtime role information, it can obtain its own runtime role information and then determine the current business scenario category based on its own runtime role information.

[0169] In some implementations, if the router's own running role information is that of a slave router, it is determined to be either the first or second scenario mentioned above. This is because, as described in the first or second scenario, the master router R1 is replaced or restarted, and the slave router R3 remains unchanged, still in the slave router role. If the slave router's own running role information is that of a master router, it is determined to be the third scenario mentioned above. This is because, as described in the third scenario, the master router R1 is demoted to a slave router, and the running role information of the slave router R1 has not changed, still retaining its previous master router role. Optionally, the running role information of the slave router can be updated after determining the service scenario category. If the slave router's own running role information is the initial value, and a probe timeout record is confirmed, it is determined to be the fourth scenario mentioned above. This is because, as described in the fourth scenario, the slave router R2 did not successfully establish a network before the master router R1's network switch was turned on, so the slave router R2 did not update its own running role information, which remains the initial value.

[0170] S57 initiates a network probe to the main router based on the service scenario category.

[0171] Among them, the router can initiate network probing from different ports according to different business scenario categories.

[0172] In some implementations, such as the first, second, or fourth scenario, the slave router can initiate probe requests from all ports or plug-in ports. This is because, in addition to the upstream router, the slave router's ports may also be connected to computer devices, etc. However, the slave router is unsure which port is connected to the router. Therefore, it can initiate probe requests from all ports or plug-in ports. Once the slave router receives a probe response from the port connected to the router, it will assume the role of a slave router to complete the probe network formation.

[0173] In the third scenario, the slave router can initiate probe requests only on the WAN port. This is because a new master router is cascaded onto an older master router, and the new master router can only be upstream of the older master router. Therefore, in this scenario, the slave router (i.e., the older master router) can initiate probe requests only on the upstream WAN port to improve probe efficiency. After receiving the probe response, the slave router will revert to its slave role to complete the probe network setup.

[0174] In some implementations, the scene recognition process in steps S51-S56 above can be executed by the scene recognition module in the router. After the business scene is determined, the scene recognition module can call the network management module to perform network detection according to different detection interfaces.

[0175] In summary, the network device detection and networking method proposed in this application can quickly identify the scene and initiate network detection in a timely manner by parsing messages with the slave router when the master router is replaced, cascaded, restarted, or the networking switch is turned on. This is more efficient than traditional technologies and can enable the network to operate normally more quickly.

[0176] The foregoing has detailed examples of network device detection and networking methods provided in the embodiments of this application. It is understood that, in order to achieve the above functions, the network device includes hardware and / or software modules corresponding to the execution of each function. Those skilled in the art should readily recognize that, based on the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in conjunction with the embodiments, but such implementation should not be considered beyond the scope of this application.

[0177] This application embodiment can divide the network device into functional modules according to the above method example. For example, each function can be divided into a separate functional module, such as a detection unit, a processing unit, a parsing unit, etc., or two or more functions can be integrated into one module. The integrated module can be implemented in hardware or as a software functional module. It should be noted that the module division in this application embodiment is illustrative and only represents one logical functional division. In actual implementation, there may be other division methods.

[0178] It should be noted that all relevant content of each step involved in the above method embodiments can be referenced from the functional description of the corresponding functional module, and will not be repeated here.

[0179] The network device provided in this embodiment is used to execute the above-described network device detection and networking method, and therefore can achieve the same effect as the above-described implementation method.

[0180] When using integrated units, network devices may also include a processing module, a storage module, and a communication module. The processing module controls and manages the network device's operations. The storage module supports the network device in executing stored program code and data. The communication module supports communication between the network device and other devices.

[0181] The processing module can be a processor or a controller. It can implement or execute various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. The processor can also be a combination that implements computational functions, such as a combination of one or more microprocessors, a combination of a digital signal processor and a microprocessor, etc. The storage module can be a memory. The communication module can specifically be a transceiver or other device that interacts with other network devices via messages.

[0182] When the network device is a router, the router can include a routing section and a packet forwarding section. The core component of the routing section is the routing processor, whose task is to construct a routing table according to the selected routing protocol, and to continuously update and maintain the routing table by frequently or periodically exchanging routing information with neighboring routers. The packet forwarding section consists of three parts: a switching structure, a set of input ports, and a set of output ports. The function of the switching structure is to process packets according to the forwarding table and forward packets entering from a certain input port to an appropriate output port.

[0183] This application also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it causes the processor to execute the network device detection and networking method of any of the above embodiments. The storage medium may include various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0184] This application also provides a computer program product that, when run on a network device, causes the network device to perform the aforementioned steps to realize the network device detection and networking method described in the above embodiments.

[0185] In addition, embodiments of this application also provide an apparatus, which may specifically be a chip, component, or module. The apparatus may include a connected processor and a memory. The memory is used to store computer execution instructions. When the apparatus is running, the processor can execute the computer execution instructions stored in the memory to cause the chip to execute the network device detection and networking methods in the above-described method embodiments.

[0186] In this embodiment, the network device, computer-readable storage medium, computer program product or chip are all used to execute the corresponding methods provided above. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects in the corresponding methods provided above, and will not be repeated here.

[0187] Through the above description of the embodiments, those skilled in the art will understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0188] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0189] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for detecting network devices, the method being executed by a first network device, characterized in that, The method includes: Upon receiving a topology notification message from a second network device, a topology query request message is sent to the second network device. The topology notification message is a message sent by the second network device when a first condition is met. The first condition includes: the second network device receiving a topology discovery message sent by a neighboring first network device when it detects a port plugging / unplugging event; or receiving a topology discovery message sent by a neighboring third network device when it detects a port plugging / unplugging event; or the second network device detecting that it has restarted or its network switch has been turned on. Receive a topology query response message from the second network device in response to the topology query request message, the topology query response message carrying the device node information and running role information of the second network device; Based on the device node information and operating role information of the second network device, and the operating role information of the first network device, the current business scenario of the first network device is determined; According to the business scenario, a network probe request is sent to the second network device, and a probe response is received from the second network device to complete the network formation.

2. The method according to claim 1, characterized in that, The step of determining the current business scenario of the first network device based on the device node information and operating role information of the second network device, and the operating role information of the first network device, includes: If it is determined that there is no device node information for the second network device in the first network device, a corresponding device node is created according to the device node information of the second network device, and the running role of the device node is initialized to the initial value; If the operating role of the device node is the initial value, and the parsed operating role information of the second network device is the main router role, then the current business scenario of the first network device is determined based on the operating role information of the first network device.

3. The method according to claim 2, characterized in that, The step of determining the current service scenario of the first network device based on its operational role information includes: If the operating role information of the first network device is a slave router role, then the current business scenario of the first network device is determined to be either the first scenario or the second scenario. The first scenario represents the scenario where the second network device is a newly replaced master router, and the second scenario represents the scenario where the second network device itself restarts. If the operating role information of the first network device is a master router role, then the current business scenario of the first network device is determined to be the third scenario. The third scenario represents a scenario where the first network device is the old master router and the second network device is a new master router cascaded on the first network device. If the operating role information of the first network device is an initial value and a detection timeout has occurred, then the current business scenario of the first network device is determined to be the fourth scenario. The fourth scenario represents the scenario in which the second network device's own networking switch is turned on after the first network device's network detection timeout.

4. The method according to claim 3, characterized in that, The step of initiating a network probe to the second network device based on the business scenario includes: When the business scenario is the first scenario, the second scenario, or the fourth scenario, the first network device initiates a probe network formation on all ports, and completes the network formation after receiving a probe response from the second network device; In the case of the third scenario, the first network device initiates a network probe on the WAN interface and completes the network formation after receiving a probe response from the second network device.

5. The method according to any one of claims 1 to 4, characterized in that, The device node information of the second network device includes the Media Access Control (MAC) address of the second network device.

6. A method for detecting network devices, the method being executed by a second network device, characterized in that, The method includes: Under the condition that the first condition is met, a topology notification message is sent to the first network device. The first condition includes: the second network device receives a topology discovery message sent by the adjacent first network device when it detects a port plugging / unplugging event, or receives a topology discovery message sent by the adjacent third network device when it detects a port plugging / unplugging event, or the second network device detects that it has restarted or its own network switch has been turned on. The system receives a topology query request message from the first network device and replies to the first network device with a topology query reply message in response to the topology query request message. The topology query reply message carries the device node information and running role information of the second network device. The system receives a network probe request from the first network device and responds with a probe response to the first network device to complete the network formation. The network probe request is initiated by the first network device based on a business scenario, which is determined by the first network device based on the device node information and operating role information of the second network device, as well as the operating role information of the first network device.

7. The method according to claim 6, characterized in that, When the second network device receives a topology discovery message from the first network device or the third network device, the method further includes: Parse the topology discovery message to determine whether the first network device or the third network device is a new device; Accordingly, sending a topology notification message to the first network device includes: If the first network device or the third network device is a new device, the topology notification message is sent to the first network device.

8. A first network device, characterized in that, The first network device includes: The message processing module is used to receive topology notification messages from a second network device, wherein the topology notification message is a message sent by the second network device when a first condition is met, the first condition including: the second network device receives a topology discovery message sent by a neighboring first network device when it detects a port plugging / unplugging event, or receives a topology discovery message sent by a neighboring third network device when it detects a port plugging / unplugging event, or the second network device detects that it has restarted or its own network switch has been turned on; The topology management module is used to trigger the message processing module to send a topology query request message to the second network device; The message processing module is further configured to receive a topology query response message from the second network device in response to the topology query request message, wherein the topology query response message carries the device node information and running role information of the second network device; The network management module is used to provide different detection interfaces for different business scenarios; The scene recognition module is used to determine the current business scene of the first network device based on the device node information and running role information of the second network device and the running role information of the first network device, and to call the network management module to send a network detection request to the second network device according to the corresponding detection interface based on the business scene. The network management module is also used to receive the probe response from the second network device to complete the network setup.

9. A second network device, characterized in that, The second network device includes: The message processing module is used to send a topology notification message to the first network device when a first condition is met. The first condition includes: the second network device receives a topology discovery message sent by the first network device from a neighboring device when it detects a port plugging / unplugging event, or receives a topology discovery message sent by a third network device from a neighboring device when it detects a port plugging / unplugging event, or the second network device detects that it has restarted or its own network switch has been turned on. The message processing module is also used to receive topology query request messages from the first network device; The topology management module is used to trigger the message processing module to reply to the first network device with a topology query reply message in response to the topology query request message. The topology query reply message carries the device node information and running role information of the second network device. The network management module is used to receive a network probe request from the first network device and reply with a probe response to the first network device. The network probe request is a request initiated by the first network device based on a business scenario. The business scenario is determined by the first network device based on the device node information and running role information of the second network device and the running role information of the first network device.

10. A first network device, characterized in that, The first network device includes: A transceiver is configured to send a topology query request message to the second network device upon receiving a topology notification message from the second network device. The topology notification message is a message sent by the second network device when a first condition is met. The first condition includes: the second network device receiving a topology discovery message sent by the adjacent first network device when it detects a port plugging / unplugging event; or receiving a topology discovery message sent by the adjacent third network device when it detects a port plugging / unplugging event; or the second network device detecting that it has restarted or its network switch has been turned on. The transceiver is further configured to receive a topology query response message from the second network device in response to the topology query request message, the topology query response message carrying device node information and running role information of the second network device; The processor is configured to determine the current business scenario of the first network device based on the device node information and running role information of the second network device and the running role information of the first network device. The transceiver is also used to send a probe network request to the second network device according to the service scenario, and receive a probe response from the second network device to complete the network formation.

11. A second network device, characterized in that, The second network device includes: A transceiver is configured to send a topology notification message to a first network device when a first condition is met, the first condition including: the second network device receives a topology discovery message sent by the first network device from a neighboring device when it detects a port plugging / unplugging event, or receives a topology discovery message sent by a third network device from a neighboring device when it detects a port plugging / unplugging event, or the second network device detects that it has restarted or its own network switch has been turned on. The transceiver is further configured to receive a topology query request message from the first network device, and reply to the first network device with a topology query reply message in response to the topology query request message, wherein the topology query reply message carries the device node information and running role information of the second network device; The transceiver is also configured to receive a probe networking request from the first network device and reply with a probe response to the first network device. The probe networking request is a request initiated by the first network device based on a business scenario. The business scenario is determined by the first network device based on the device node information and running role information of the second network device, as well as the running role information of the first network device.

12. A chip system, characterized in that, The chip system is applied to a network device, the chip system including one or more processors, the one or more processors being configured to invoke computer instructions to cause the network device to perform the method as described in any one of claims 1 to 5, or to perform the method as described in any one of claims 6 to 7.

13. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes instructions that, when executed on a network device, cause the network device to perform the method as claimed in any one of claims 1 to 5, or the method as claimed in any one of claims 6 to 7.

Citation Information

Patent Citations

  • Topology discovery in a hybrid network

    CN103765835A

  • Message forwarding method and equipment

    CN115883448A