Method, device and system for acquiring information of equipment under gateway

By adopting a two-layer private communication protocol and a distributed centralized storage architecture in multi-level networking, efficient and accurate acquisition and management of device information are achieved, solving the problems of low device discovery efficiency, inaccurate information and high resource consumption in existing technologies, and improving the real-time performance and topology visualization capabilities of network management.

CN121842020APending Publication Date: 2026-04-10FIBERHOME TELECOMMUNICATION TECHNOLOGIES CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
FIBERHOME TELECOMMUNICATION TECHNOLOGIES CO LTD
Filing Date
2026-01-15
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

In multi-level networking scenarios, existing technologies struggle to achieve efficient, accurate, and low-resource-consumption acquisition of information about downstream devices, resulting in low device discovery efficiency, inaccurate information display, high system resource consumption, and limited topology scalability, making it difficult to meet the needs for real-time topology visualization and rapid fault location.

Method used

It adopts a proactive reporting, on-demand query, and reverse synchronization mechanism based on a two-layer private communication protocol. Through information collaboration between upper and lower level gateways, it realizes real-time updates of device information and accurate display of the management interface. It adopts a distributed centralized storage architecture and a three-layer state machine to work together to ensure information consistency and low resource consumption.

Benefits of technology

It achieves near real-time network topology information updates, eliminates information jitter and residue, reduces CPU and bandwidth overhead, improves the efficiency and accuracy of device information acquisition, and supports the scalability and stability of multi-level networking.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121842020A_ABST
    Figure CN121842020A_ABST
Patent Text Reader

Abstract

The invention discloses a method, a device and a system for acquiring information of equipment under a gateway, and belongs to the field of multilevel networking, and the method comprises the following steps: based on a predefined two-layer private communication protocol, executing at least one of the following information cooperation operations between an upper gateway and a lower gateway: the upper gateway receives a first report message from a lower gateway, according to the change information of the user equipment area of the lower-level gateway, updating the information of the lower-level equipment area of the upper-level gateway; the superior gateway sends a first query message to the subordinate gateway based on the query instruction, and updates information of a downlink device area of the superior gateway according to device information, corresponding to the query range, in a second report message returned by the subordinate gateway; and the superior gateway receives the synchronization request message from the subordinate gateway and returns corresponding equipment information to the subordinate gateway, so that the subordinate gateway updates a user equipment area of the subordinate gateway based on the equipment information returned by the superior gateway. According to the method, the collection efficiency and accuracy of the information of the hanging equipment are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of multi-level networking, and specifically relates to a method, device and system for obtaining information of devices connected to a gateway. Background Technology

[0002] With the rapid development of broadband network technology and the increasing demand from users for high-quality network experiences, home and enterprise network environments are becoming increasingly complex. Multi-level gateway networking (e.g., an optical modem as the main gateway, with multiple wireless routers connected as sub-gateways) has become a common solution for expanding network coverage and achieving granular management. In such topologies, how to acquire, manage, and display information about all connected devices (including terminal devices and lower-level gateways) in real time, accurately, and efficiently constitutes a key technical challenge.

[0003] Currently, the industry primarily relies on traditional network probing and protocol interaction technologies for user-side device information discovery and topology management, such as Address Resolution Protocol (ARP) scanning, Simple Network Management Protocol (SNMP) polling, and Link Layer Discovery Protocol (LLDP). However, these technologies have the following drawbacks when applied to dynamic and multi-level network scenarios: Device discovery efficiency is low: Taking active ARP scanning as an example, it needs to traverse the entire network segment. In a large-scale or deeply layered network, a complete device discovery may take minutes. This latency cannot meet the user's need for real-time topology visualization and is also difficult to support rapid fault location.

[0004] Insufficient information display accuracy: The network environment is highly dynamic, with frequent device online / offline events, user terminals roaming between different access points, network cable port switching, gateway restarts, or uplink changes occurring frequently. It is difficult to capture and respond to these instantaneous changes in a timely manner, resulting in inconsistencies between the device list, online status, and connection relationships displayed on the management interface and the actual network situation, leading to information jitter or information residue. Information loss is particularly high in special scenarios such as device roaming and port switching.

[0005] High system resource consumption: Frequent full network scans or broadcast queries consume a large amount of network bandwidth, gateway CPU and memory resources, which may not only affect the performance of normal business data forwarding, but also limit the applicability of the technology on resource-constrained terminal gateway devices to a certain extent.

[0006] Limited topology scalability: When the network layer exceeds three levels or the number of access devices increases significantly, the information synchronization delay of traditional centralized management or flat discovery mechanisms increases non-linearly, the real-time performance of topology updates decreases sharply, and the system struggles to maintain an effective global view.

[0007] Therefore, there is an urgent need for a method to obtain information about downstream devices that can be efficient, accurate, low-resource-consumption, and highly scalable in multi-level networking scenarios, so as to improve the real-time performance, accuracy, and user experience of network management. Summary of the Invention

[0008] To address the aforementioned issues, this application provides a method, apparatus, and system for acquiring information of gateway-attached devices in a multi-level gateway linkage, which improves the efficiency and accuracy of acquiring information of attached devices while ensuring low resource consumption.

[0009] The technical solution is as follows: In a first aspect, a method for obtaining information of devices connected to a gateway is provided, which is applied in a multi-level network. Each level of gateway includes a user equipment area and a downstream device area. The user equipment area is used to store information of terminal devices directly connected to the gateway, and the downstream device area is used to store information of devices managed by the direct downstream gateways of the gateway. The method includes: Based on a predefined Layer 2 private communication protocol, perform at least one of the following information coordination operations between upper and lower level gateways: The upper-level gateway receives a first reporting message from the lower-level gateway. The first reporting message contains user equipment area information of the lower-level gateway. Based on the changes in the user equipment area of ​​the lower-level gateway, the upper-level gateway updates the downstream device area information. The upper-level gateway sends a first query message to the lower-level gateway based on a query command. The first query message contains identification information indicating the query range. The upper-level gateway updates the information of the downstream device area according to the device information corresponding to the query range in the second reporting message returned by the lower-level gateway. The upper-level gateway receives a synchronization request message from the lower-level gateway, and returns the corresponding device information to the lower-level gateway based on the synchronization request message and the information of the lower-level gateway's downstream device area, so that the lower-level gateway can update its own user equipment area based on the device information returned by the upper-level gateway.

[0010] Secondly, a gateway-attached device for acquiring device information is provided. The device is deployed in any gateway of a multi-level network, and includes: The storage module includes a user equipment area and a downstream device area. The user equipment area is used to store information of terminal devices directly connected to this gateway, and the downstream device area is used to store device information managed by the direct downstream gateways of this gateway. The linkage protocol module, which is communicatively connected to the storage module, is configured to perform at least one of the following information coordination operations based on a predefined Layer 2 private communication protocol: When this gateway acts as an upper-level gateway, it receives the first reporting message from the lower-level gateway and updates the information of the downstream device area of ​​this gateway based on the change information of the user equipment area of ​​the lower-level gateway in the first reporting message. In addition, based on the query command, a query message is sent to the lower-level gateway. The query message contains identification information for indicating the query range. The information of the downstream device area of ​​this gateway is updated according to the device information corresponding to the query range in the second reporting message returned by the lower-level gateway. In addition, it receives synchronization request messages from lower-level gateways, and returns corresponding device information to the lower-level gateways based on the synchronization request messages and the information of the downstream device area of ​​this gateway, so that the lower-level gateways update their own user equipment areas based on the device information returned by this gateway.

[0011] Thirdly, a gateway-attached device information acquisition system is provided, including a main gateway and at least one sub-gateway, wherein both the main gateway and the sub-gateway include the aforementioned gateway-attached device information acquisition device.

[0012] Compared with the prior art, this application has the following advantages: (1) The active reporting, on-demand query and reverse synchronization mechanism based on the Layer 2 private communication protocol replaces the traditional large-scale periodic polling or broadcast scanning. The lower-level gateway immediately reports after detecting device changes locally, and the upper-level gateway updates the global view after receiving the report, realizing near real-time network topology information updates. (2) Adopting a distributed centralized storage architecture, combined with the three-layer state machine (reporting, querying, and synchronization) working together, it can accurately capture and respond to dynamic events such as device roaming, port switching, and gateway restart. Through the linkage protocol, it ensures the consistency of information between upper and lower level gateways, effectively eliminating information jitter, residue, or display errors, and making the network status presented in the management interface highly consistent with the real topology. (3) An event-driven and on-demand triggering coordination mechanism is adopted, and necessary information interaction is only performed with the lower-level gateway when the network status changes or the upper-level gateway is idle, thus avoiding the large CPU and bandwidth overhead caused by continuous full network scanning in traditional solutions.

[0013] Other features and advantages of this application will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures pointed out in the description, claims and drawings. Attached Figure Description

[0014] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0015] Figure 1 This is a schematic diagram of a multi-level network scenario; Figure 2 This is a diagram of a distributed centralized storage architecture with multi-level networking. Figure 3 This is a flowchart of the method for obtaining information of devices connected to the gateway in this application embodiment; Figure 4 This is a schematic diagram of the structure of a two-layer network in a specific embodiment; Figure 5 A diagram illustrating how a lower-level gateway actively reports device information. Figure 6 A schematic diagram illustrating the acquisition module collecting device information; Figure 7 A diagram illustrating how an upstream gateway actively queries device information; Figure 8 A diagram illustrating the reverse synchronization of device information stored by the upper-level gateway with the lower-level gateway. Detailed Implementation

[0016] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0017] In a multi-level (tree-shaped) network scenario with a main gateway at the core and sub-gateways at each level connected sequentially, the concept of upper and lower level gateways is to describe the logical management relationship and data flow between gateway devices, rather than being limited to physical connection relationships.

[0018] Upper-level gateway: In a multi-level tree network topology, this refers to a gateway device that occupies a higher level and plays a role in aggregating, managing, and coordinating information from one or more other gateways. The upper-level gateway is responsible for receiving and integrating device information from its lower-level gateways to form a broader network view.

[0019] Lower-level gateways: In a multi-level tree network topology, a lower-level gateway is directly connected to and subordinate to a higher-level gateway, accepting information queries and management from the higher-level gateway, and responsible for reporting device information within its managed network area to the higher-level gateway. Lower-level gateways are nodes that collect and initially summarize device information within their directly managed area.

[0020] Direct hierarchical relationship: refers to a pair of master and slave gateways in a multi-level tree network topology that are directly connected by physical links or stable logical tunnels and whose management hierarchy is confirmed according to a Layer 2 private communication protocol.

[0021] like Figure 1 and Figure 2 As shown, main gateway A is the superior gateway of gateways B and C, and gateway B is the superior gateway of gateway C. Communication between superior and subordinate gateways, as well as between gateways and terminal devices (such as PCs, mobile phones, routers (APs), cameras, etc.), is achieved through fiber optic cables, network cables, Wi-Fi, etc.

[0022] This application provides a method for obtaining information about devices connected to a gateway in a multi-level gateway linkage system. The method is applied to a multi-level network. The multi-level network employs a distributed centralized storage method, where each level of gateway (including upper-level and lower-level gateways) has an independent storage area. Each gateway device has a user device area (user) and a downstream device area (ddev). The user device area (user) stores information about directly connected terminal devices connected to this gateway, and the downstream device area (ddev) stores information about devices managed by the gateway's direct downstream gateways.

[0023] like Figure 3 As shown, the method includes: Based on a predefined Layer 2 private communication protocol, perform at least one of the following information coordination operations between upper and lower level gateways: The upper-level gateway receives a first reporting message from the lower-level gateway. The first reporting message contains user equipment area information of the lower-level gateway. Based on the changes in the user equipment area of ​​the lower-level gateway, the upper-level gateway updates the downstream device area information. The upper-level gateway sends a first query message to the lower-level gateway based on a query command. The first query message contains identification information indicating the query range. The upper-level gateway updates the information of the downstream device area according to the device information corresponding to the query range in the second reporting message returned by the lower-level gateway. The upper-level gateway receives a synchronization request message from the lower-level gateway, and returns the corresponding device information to the lower-level gateway based on the synchronization request message and the information of the lower-level gateway's downstream device area, so that the lower-level gateway can update its own user equipment area based on the device information returned by the upper-level gateway.

[0024] The proactive reporting, on-demand querying, and reverse synchronization mechanism based on a Layer 2 private communication protocol replaces the traditional large-scale periodic polling or broadcast scanning. The lower-level gateway immediately reports after detecting device changes locally, and the upper-level gateway updates the global view after receiving the report, achieving near real-time network topology information updates. At the same time, the event-driven and on-demand triggering coordination mechanism only performs necessary information interaction with the lower-level gateway when the network status changes or when the upper-level gateway is idle, avoiding the large CPU and bandwidth overhead caused by uninterrupted full network scanning in traditional solutions.

[0025] To achieve efficient and reliable information collaboration between upper and lower level gateways, this application designs and adopts a dedicated Layer 2 private communication protocol. The protocol messages are directly encapsulated and transmitted at the data link layer, ensuring low latency and high efficiency of communication, and effectively bypassing interference from application layer firewalls.

[0026] In this embodiment of the application, the message structure of the Layer 2 private communication protocol includes: destination address, source address, protocol type, message type, device role, and data field.

[0027] The protocol type is used to identify the Layer 2 private communication protocol. The message types include reporting, querying, and synchronization. The data field is used to encapsulate device information in TLV format. The device role is one of a master role or a subordinate role.

[0028] Specifically, the Layer 2 private communication protocol message mainly includes the following fields: Destination Address (DA): The MAC address of the gateway of the message receiver.

[0029] Source Address (SA): The MAC address of the gateway that sent the message.

[0030] Protocol Type (TYPE): A specific identifier value (e.g., 0xFFD8) is used to uniquely identify this private protocol at the data link layer. When the network stack receives a message of this type, it will distribute it to the linkage protocol module for processing, rather than discarding it or performing a regular Layer 3 forwarding.

[0031] Message type: Defines the operational intent of the message and is the core of driving the operation of the state machine.

[0032] The message types mainly include three types: Report (REPORT): Used by a lower-level gateway to proactively send device information (new, modified, or full) within its management scope to a higher-level gateway; QUERY: Used by an upper-level gateway to request specific device information from a lower-level gateway, or by a lower-level gateway to request synchronization of specific missing information from an upper-level gateway. Synchronization (SYNC): Used by the upper-level gateway to respond to the synchronization request of the lower-level gateway and send it complete device information.

[0033] Device Role: Identifies the logical role of the message sender gateway in this communication, such as a master role or a slave role, and assists gateways in confirming network relationships.

[0034] The DATA field uses the TLV format, which encapsulates data in "Type-Length-Value". The TLV format is highly scalable and efficient in parsing. In this protocol, the "Type (T)" field defines the meaning of subsequent data (e.g., device MAC address type, IP address type, port number type, device type, hostname type, etc.); the "Length (L)" field specifies the data length of the subsequent "Value (V)" field; and the "Value (V)" field carries the specific device information. The TLV format allows for the flexible encapsulation of complete or partial attribute information for one or more devices.

[0035] In this embodiment of the application, before performing information collaboration operations between upper and lower level gateways, the method further includes: performing role negotiation between upper and lower level gateways to confirm the network relationship.

[0036] Specifically, the step of performing role negotiation between upper and lower level gateways to confirm network relationships includes: The upper-level gateway receives a second reporting message from the lower-level gateway, the second reporting message being used to indicate that the device role identifier of the lower-level gateway is a subordinate gateway; The upper-level gateway sends a second query message to the lower-level gateway. The second query message is used to indicate that the device role identifier of the upper-level gateway is the main gateway.

[0037] According to an embodiment of this application, the Layer 2 private communication protocol message defines a "device role" field to identify whether the message sender is a master gateway or a slave gateway. All collaborative operations between upper and lower level gateways are based on this confirmed direct networking relationship. That is, information collaboration (reporting, querying, synchronization) only occurs between gateways with a direct upper and lower level relationship, ensuring the determinism and efficiency of the information flow path, which is also key to ensuring system efficiency and a clear topology.

[0038] Furthermore, the aforementioned Layer 2 private communication protocol works closely with three custom state machines (lower-level device proactive reporting, upper-level device querying, and lower-level gateway reverse synchronization). Specifically: when a lower-level gateway detects a change in a downstream device, it encapsulates the device change information into a reporting message and sends it to the upper-level gateway; when the upper-level gateway needs to obtain downstream device information, it proactively sends a query message to the lower-level gateway to obtain the device information; when a lower-level gateway needs to complete the device information, it sends a synchronization request message to the upper-level gateway and receives the corresponding device information returned by the upper-level gateway.

[0039] The Layer 2 proprietary communication protocol described in this application provides a standard, efficient, and reliable information exchange language between multi-level gateways, thereby supporting communication across the entire distributed data acquisition and centralized management architecture. Simultaneously, combined with the collaborative work of a Layer 3 state machine (reporting, querying, and synchronization), it can accurately capture and respond to dynamic events such as device roaming, port switching, and gateway restarts. Through a linkage protocol, it ensures the consistency of information between upper and lower-level gateways, effectively eliminating information jitter, residual data, or display errors, ensuring that the network status presented on the management interface closely matches the actual topology.

[0040] Based on the topology consistency maintenance mechanism, the top-level gateway, as the aggregation point of global information, is responsible for monitoring and resolving information redundancy or conflicts that may occur due to network topology changes (such as gateway reconfiguration). When information from the same gateway device is detected to appear in an unexpected storage path, the top-level gateway will initiate a cleanup and resynchronization process to ensure that at any given time, the management relationship of each gateway device in the system's global view is unique and correct, thereby avoiding information duplication and display confusion.

[0041] The lower-level gateway generates the first reporting message and sends it to the upper-level gateway, including: The lower-level gateway obtains information about changes in the directly connected devices by listening to and parsing the network protocol messages of its directly connected devices, and updates its own user equipment area. The network protocol messages include at least one of the following: DHCP message (Dynamic Host Configuration Protocol message), ARP message (Address Resolution Protocol message), ICMPv6 NS message (Internet Control Message Protocol version 6 - Neighbor Request message), and PPPoE session message (Point-to-Point Protocol Session over Ethernet). The lower-level gateway encapsulates the change information of directly connected devices in its user equipment area into a Layer 2 private communication protocol message with the message type "report", generates the first reporting message, and sends it to the upper-level gateway.

[0042] In this embodiment of the application, the change information of the directly connected device of the lower-level gateway includes at least one of the following: (1) Changes in the network connection status or network configuration attributes of terminal devices directly connected to the lower-level gateway; Among these, changes in the state or attributes of end-user devices that have a direct physical or logical connection with the lower-level gateway include, but are not limited to: Changes in network connectivity, such as a device newly connecting to or disconnecting from the network; Changes in network configuration attributes refer to changes in the device's identification or location parameters in the network. For example, IP address changes (the device obtains a new IP address via DHCP, or the static IP is modified), network port switching (the device changes its physical access port in a wired network, or roams between different access points in a wireless network), and device identification updates (the device's hostname or device type information identified through protocol analysis is updated). (2) The network connection relationship between the lower-level gateway and the upper-level gateway changes, including but not limited to: Network connection establishment / disconnection: The lower-level gateway connects to or disconnects from the management domain of the current upper-level gateway; Switching network connection relationships: Switching the uplink port of a lower-level gateway, or switching from connecting to one upper-level gateway to connecting to another upper-level gateway; Gateway restart: A downstream gateway restarting itself may result in the loss of its locally stored information or inconsistency with the network status.

[0043] This application embodiment triggers the lower-level device to actively report its status and the lower-level gateway to reverse synchronize its status through the above conditions. Based on the dynamic characteristics of user access behavior (such as port switching and roaming) and special scenarios (such as sub-gateway uplink switching and arbitrary gateway restart), it accurately captures these changes and improves the timeliness and accuracy of information updates.

[0044] In this embodiment of the application, the triggering condition for the query instruction is any one of the following: the upper-level gateway detects that its own CPU utilization rate is lower than a preset threshold; the upper-level gateway detects that the information of its own downstream device area is inconsistent with the historical records.

[0045] In this embodiment of the application, the upper-level gateway sends a first query message containing a query range to the lower-level gateway based on a query command. The query range is specified by identification information as any one of the following: the user equipment area of ​​the lower-level gateway; the downstream device area of ​​the lower-level gateway; or the user equipment area and the downstream device area of ​​the lower-level gateway.

[0046] When querying the user equipment area of ​​a lower-level gateway, the upper-level gateway obtains detailed information on all terminal devices directly connected to that lower-level gateway. This is suitable when the upper-level gateway only needs to know the terminal devices directly connected to the lower-level gateway.

[0047] When querying the downstream device area (ddev) of a lower-level gateway, the upper-level gateway obtains aggregated information on all lower-level sub-gateways and their subordinate devices managed by the lower-level gateway. This is suitable when the upper-level gateway needs to understand the overall picture of the entire branch network in which the lower-level gateway is located.

[0048] The query query the user device area (user) and downstream device area (ddev) of the lower-level gateway retrieves the complete set of all device information stored by the lower-level gateway, which is the union of its user device area and downstream device area. This is typically used for full synchronization after system initialization, periodic verification, or when a user requests to view the complete topology.

[0049] This embodiment, by explicitly specifying the query scope, eliminates the need for lower-level gateways to return all data. Instead, it extracts information from a specified storage partition and encapsulates it into a response message, significantly reducing the processing of invalid data and network bandwidth usage, thereby improving query efficiency.

[0050] In this embodiment of the application, the conditions under which the lower-level gateway sends the synchronization request message include any one of the following: The downstream gateway restarts; The lower-level gateway detected that a device had connected, but its user equipment area did not contain complete information about the device.

[0051] When a downstream gateway restarts due to power outages, upgrades, or malfunctions, its runtime state in volatile memory may be lost. Although non-volatile storage may retain some data, it is difficult to guarantee complete consistency with the current real-time network state. Therefore, during the initialization process after a downstream gateway restarts, the integrity of device information in the local storage module (especially the user equipment area) is checked. If outdated or incomplete information is detected, the system is determined to be in an information-missing state.

[0052] When a lower-level gateway detects a new device accessing the network or detects network activity of an existing device, but cannot obtain complete information about the device through standard protocol message parsing (such as only having a MAC address and lacking IP address, device type, etc.), it determines that the device's recorded information in the user equipment area is incomplete.

[0053] Using the above two scenarios as trigger points for sending synchronization request messages, the lower-level gateway only initiates a synchronization request to the upper-level gateway when device information is missing, avoiding continuous query costs. The synchronization target is specific devices with missing information or all devices after a restart. It has the ability to recover from common abnormal states (restart, roaming packet loss), significantly improving the stability and reliability of the entire multi-level networking system management, and effectively reducing the jitter failure rate in special scenarios mentioned in the background technology.

[0054] This embodiment is based on distributed centralized storage and a hierarchical information reporting mechanism, supporting multi-level (three layers and above) tree-shaped networking. As the network scale and hierarchy expand, information synchronization maintains controllable low latency, and the overall system performance does not significantly degrade, demonstrating excellent horizontal and vertical scalability. Simultaneously, a unique reverse synchronization mechanism is designed. When a lower-level gateway loses local information due to restarts, packet loss, or other reasons, it can proactively request synchronization from the upper-level gateway. This effectively solves the information inconsistency problem in complex scenarios such as device roaming across gateways and abnormal offline events, improving the overall stability and reliability of the system.

[0055] This application embodiment also provides a gateway-attached device for obtaining information on devices linked to a multi-level gateway, wherein the device is deployed in any gateway of a multi-level network.

[0056] The device includes: a storage module and a linkage protocol module.

[0057] The storage module includes a user equipment area and a downstream device area. The user equipment area is used to store information about terminal devices directly connected to this gateway, and the downstream device area is used to store information about devices managed by the direct downstream gateways of this gateway.

[0058] The linkage protocol module is communicatively connected to the storage module and is configured to perform at least one of the following information coordination operations based on a predefined Layer 2 private communication protocol: When this gateway acts as an upper-level gateway, it receives the first reporting message from the lower-level gateway and updates the information of the downstream device area of ​​this gateway based on the change information of the user equipment area of ​​the lower-level gateway in the first reporting message. In addition, based on the query command, a query message is sent to the lower-level gateway. The query message contains identification information for indicating the query range. The information of the downstream device area of ​​this gateway is updated according to the device information corresponding to the query range in the second reporting message returned by the lower-level gateway. In addition, it receives synchronization request messages from lower-level gateways, and returns corresponding device information to the lower-level gateways based on the synchronization request messages and the information of the downstream device area of ​​this gateway, so that the lower-level gateways update their own user equipment areas based on the device information returned by this gateway.

[0059] In this embodiment of the application, the device further includes: a data acquisition module and a communication module.

[0060] The acquisition module is communicatively connected to the storage module and is configured to listen to and parse the network protocol messages of the directly connected devices under this gateway in order to obtain the device information of the directly connected terminal devices and trigger this gateway to update its user equipment area.

[0061] The communication module is connected to the linkage protocol processing module and is configured to send and receive Layer 2 private communication protocol messages based on the forwarding hook function.

[0062] The following detailed description of the solution is provided through a specific embodiment.

[0063] like Figure 4 and Figure 5 As shown, the Layer 2 network includes a gateway 1 and a gateway 2. Gateway 1 is considered the upper-level gateway of gateway 2. Gateway 1 includes a communication module A1, a data acquisition module C1, a storage module B1, and a linkage protocol module D1. Gateway 2 includes a communication module A2, a data acquisition module C2, a storage module B2, and a linkage protocol module D2.

[0064] The process of obtaining information about devices connected to the gateway is as follows: Step 1: System Initialization 1. Gateway 1 and Gateway 2 complete basic network configuration and power on to start.

[0065] 2. Initialization of internal modules of each gateway: Communication module initialization: Load the kernel forwarding hook function driver to prepare for identifying and sending / receiving private protocol packets with protocol type (TYPE) of 0xffd8, bypassing iptables restrictions.

[0066] Among them, the kernel hook function receives packets: register a hook function at the NF_INET_PRE_ROUTING point, check whether each packet entering br0 is of type 0xffd8, if it is a packet of type 0xffd8, do not allow the packet to continue to be passed up, but instead redirect the packet to the user module; Kernel hook function packet sending: The data packets constructed by the user module are passed to the kernel space for processing through the forwarding hook function. The kernel filters and processes the packets according to their characteristics and flexibly forwards them to any network device and other processing modules. This avoids data copying and context switching between user space and kernel space, thereby greatly improving processing speed and reducing latency.

[0067] Storage module initialization: Initialize the local database, create the user device area (user) and the downstream device area (ddev), both of which are initially empty.

[0068] Each gateway device has an independent storage module, and the stored information is divided according to the port number. Each gateway adopts a distributed centralized storage method. Its storage module includes a user area (user) and a downstream device area (ddev). The user area contains all directly connected terminal devices of this gateway, and the ddev area contains device information of its downstream gateways. The upstream gateway contains all device information of its downstream gateways. Information is reported hierarchically between gateways, and each gateway only supports information flow between two networked gateways. This distributed centralized storage method combines the features of distributed storage and centralized management, improving system scalability, reliability, and performance while simplifying operational complexity.

[0069] Acquisition module initialization: Start protocol listening services (such as DHCP and ARP listening) for the downstream ports.

[0070] Linkage protocol module initialization: Initialize three state machines (reporting, querying, and reverse synchronization), and enter standby state.

[0071] The main function of the linkage protocol module is to enable the upper-level gateway to obtain device information from the lower-level gateway and to perform operations such as adding, deleting, modifying, and querying the stored device information. Data interaction between the upper and lower-level gateways is based on a proprietary Layer 2 protocol, which includes destination address (DA), source address (SA), protocol type (TYPE), message type (REPORT / QUERRY / SYNC), and DATA information (TLV format). The linkage protocol module mainly has three state machines: lower-level device proactive reporting, upper-level device querying, and lower-level gateway reverse synchronization of device information stored by the upper-level gateway.

[0072] 3. Confirm the hierarchical relationship of the gateway. Gateway 2's linkage protocol module D2 actively constructs a reporting message with device role (DEV_ROLE) as SUB (DATA can be empty or carry its own basic information), and sends it out from its uplink port through communication module A2.

[0073] After receiving this message, the communication module A1 of gateway 1 parses the message and finds DEV_ROLE=SUB, thus registering gateway 2 as its direct subordinate gateway. Based on this, both parties establish a unique hierarchical management relationship, and all subsequent information collaboration is based on this relationship.

[0074] Step 2: Terminal device access and proactive reporting to lower-level gateways The terminal device (MAC address MA:CA:DD:01:01:01) connects to the WiFi of gateway 2 and sends a DHCP request.

[0075] like Figure 5 and Figure 6As shown, the acquisition module C2 of gateway 2 listens to this DHCP message and parses out key information such as the device's MAC address, IP address (192.168.2.100), device type (e.g., smartphone), and hostname (e.g., MyPhone). The acquisition module C2 submits the parsed information to the storage module B2, which stores this record in its user device area (user).

[0076] The update action of storage module B2 triggers the lower-level device of linkage protocol module D2 to actively report the state machine. Linkage protocol module D2 obtains the new terminal information from storage module B2 and encapsulates it into a reporting message according to the protocol format.

[0077] The key fields in this reporting message include: TYPE: 0xFFD8 Message type: REPORT Device Role: SUB DATA: Encapsulates information such as the terminal device's port number, MAC address, IP address, device type, and hostname in TLV format. The report message is sent to its direct gateway 1 via communication module A2 (which calls the kernel hook function).

[0078] After receiving the message, the communication module A1 of gateway 1 hands it over to the linkage protocol module D1 for processing. The linkage protocol module D1 parses the message and identifies that it originates from its direct gateway 2 based on DEV_ROLE=SUB.

[0079] The linkage protocol module D1 extracts the terminal device information from the DATA field and submits it to the storage module B1. Storage module B1 performs MAC matching on the information from the linkage protocol module D1 and adds, deletes, and modifies the information in its own storage. Storage module B1 updates the terminal device information to the storage entry corresponding to gateway 2 in its downstream device area ddev. At this point, gateway 1 has obtained the information of the terminal device connected to gateway 2.

[0080] Step 3: The upstream gateway actively queries like Figure 7 As shown, when the CPU of Gateway 1 enters an idle state (utilization rate below a preset threshold) or its web management interface receives a user refresh command, the linkage protocol module D1 of Gateway 1 initiates a query state machine query from the upper-layer device. The linkage protocol module D1 generates a query message, whose key fields include: TYPE: 0xFFD8 Message type: QUERY Equipment Role: MAIN DATA: TLV format, where the query type is identified as all (indicating a query for both the user and ddev partitions). The query message is sent to gateway 2 via communication module A1. Upon receiving the QUERY message, gateway 2's linkage protocol module D2 parses the query type as "all". Linkage protocol module D2 then requests a complete list of devices from storage module B2, specifically the user device area ("user") and the downstream device area ("ddev").

[0081] The linkage protocol module D2 encapsulates this list into a message with TYPE=0xFFD8 and message type=REPORT, and returns it to gateway 1 through communication module A2. Upon receiving it, gateway 1 uses this list to completely refresh the device information about gateway 2 in its ddev area, ensuring that the information is complete and consistent.

[0082] Step 4: Lower-level gateway reverse synchronizes device information like Figure 8 As shown, after the terminal device disconnects from the WiFi of gateway 2, it quickly reconnects. Due to the rapid reconnection, a complete DHCP interaction is not triggered, and the acquisition module C2 of gateway 2 fails to capture the query message, resulting in incomplete or incorrect record information of the terminal device in its storage module B2.

[0083] Gateway 2's linkage protocol module D2, through self-testing, discovered that information about the terminal device (MA:CA:DD:01:01:01) in its user area was missing (e.g., the IP address field was empty or the status was abnormal). Linkage protocol module D2 then initiated the lower-level gateway's reverse synchronization state machine, generating a synchronization request message whose key fields included: TYPE: 0xFFD8 Message type: QUERY (identified as a synchronization request in DATA using a specific TLV) Device Role: SUB DATA: TLV format, containing the MAC address of the device requesting synchronization. The synchronization request message is sent to gateway 1 via communication module A2. Upon receiving it, gateway 1's linkage protocol module D1 recognizes it as a synchronization request, and then searches for the complete device information corresponding to the MAC address in its downstream device area ddev, and generates a SYNC message as a response.

[0084] Key fields in the SYNC response message include: TYPE: 0xFFD8 Message type: SYNC DATA: TLV format, carrying complete information about the mobile phone (IP, type, hostname, etc.).

[0085] After receiving the SYNC response message, the linkage protocol module D2 extracts the complete information and submits it to the storage module B2 to update and complete the original incomplete records, thereby correcting the local information errors.

[0086] Step 5: Maintaining Topology Consistency If gateway 2 was previously networked with other gateways 3, and then switched to network with gateway 1, then the ddev area of ​​gateway 3 may contain historical information of gateway 2.

[0087] When Gateway 1, as the current direct superior gateway of Gateway 2, reports the information of Gateway 2 up the chain of command to the top-level gateway, the top-level logic will detect that the management ownership of Gateway 2 has changed. Then, it will send an update command to the historically associated gateway (Gateway 3) to clean up the residual information about Gateway 2 in its ddev area and synchronize the latest topology relationship. This ensures that in the entire network, any gateway only appears in the management list of its current direct superior, fundamentally avoiding information duplication and conflict.

[0088] Step Six: Multi-level Network Expansion For three-level or higher hierarchical networks (such as...) Figure 1 and Figure 2 As shown in the diagram, information aggregation is achieved by recursively executing steps two through four above. Device information from gateway D is reported to gateway A via gateway B. Gateway A's ddev area contains not only the user area devices of gateway C but also the ddev area of ​​gateway B (i.e., all devices managed by gateway B). Ultimately, the ddev area of ​​top-level gateway A aggregates information from all devices across the network, achieving the design goal of distributed collection and centralized management.

[0089] This embodiment fully demonstrates how, in a multi-level network, the four core modules of the gateway work together with three state machines to achieve efficient, accurate, stable acquisition and unified management of information from downstream devices.

[0090] Based on the same inventive concept, this application also provides a gateway-attached device information acquisition system, which includes a main gateway and at least one sub-gateway, wherein both the main gateway and the sub-gateway include the aforementioned gateway-attached device information acquisition device.

[0091] Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A method for acquiring information of a gateway-attached device, applied to a multi-level networking network, and characterized in that, Each gateway comprises a user equipment area and a lower-link equipment area, the user equipment area is used to store information of terminal equipment directly connected to the gateway, and the lower-link equipment area is used to store equipment information managed by a direct subordinate gateway of the gateway; The method comprises: Based on a predefined two-layer private communication protocol, at least one of the following information coordination operations is performed between the upper and lower gateways: The upper gateway receives a first reporting message from the lower gateway, the first reporting message comprises user equipment area information of the lower gateway, and the upper gateway updates information of the lower-link equipment area of the upper gateway according to the change information of the user equipment area of the lower gateway; The upper gateway sends a first query message to the lower gateway based on a query instruction, the first query message comprises identification information used to indicate a query range, and the upper gateway updates information of the lower-link equipment area of the upper gateway according to equipment information corresponding to the query range in a second reporting message returned by the lower gateway; The upper gateway receives a synchronization request message from the lower gateway, and returns corresponding equipment information to the lower gateway according to the synchronization request message and the information of the lower-link equipment area of the upper gateway, so that the lower gateway updates its own user equipment area based on the equipment information returned by the upper gateway.

2. The method of claim 1, wherein, The message structure of the two-layer private communication protocol comprises a destination address, a source address, a protocol type, a message type, a device role and a data field; The protocol type is used to identify the two-layer private communication protocol; The message type comprises reporting, querying and synchronizing; The data field is used to encapsulate equipment information in a TLV format; The device role is one of a master role and a subordinate role.

3. The method of claim 1, wherein, Before the information coordination operation is performed between the upper and lower gateways, the method further comprises role negotiation between the upper and lower gateways to confirm a networking relationship; The role negotiation between the upper and lower gateways to confirm the networking relationship comprises: The upper gateway receives a second reporting message from the lower gateway, the second reporting message is used to indicate that the device role of the lower gateway is a subordinate gateway; The upper gateway sends a second query message to the lower gateway, the second query message is used to indicate that the device role of the upper gateway is a master gateway.

4. The method of claim 1, wherein, The lower gateway obtains change information of directly connected equipment of the lower gateway by listening to and analyzing network protocol messages of the directly connected equipment, and updates its own user equipment area, wherein the network protocol messages are at least one of DHCP messages, ARP messages, ICMPv6 NS messages and PPPoE session messages; The lower gateway encapsulates the change information of the directly connected equipment in its own user equipment area into a two-layer private communication protocol message with a reporting message type, generates a first reporting message, and sends the first reporting message to the upper gateway.

5. The method of claim 4, wherein, The change information of the directly connected equipment of the lower gateway comprises at least one of the following: A network connection state change or a network configuration attribute change of terminal equipment directly connected to the lower gateway; A change in the networking connection relationship between the lower gateway and the upper gateway.

6. The method of claim 1, wherein, The trigger condition of the query instruction comprises at least one of the following: The upper gateway detects that the CPU usage of the upper gateway is lower than a preset threshold; The upper gateway detects that the information of the lower-link equipment area of the upper gateway is inconsistent with historical records.

7. The method of claim 1, wherein, The query range is specified by its identification information as any one of the following: a user equipment area of a subordinate gateway; a downlink equipment area of a subordinate gateway; a user equipment area and a downlink equipment area of a subordinate gateway.

8. The method of claim 1, wherein, The conditions for the subordinate gateway to send the synchronization request message include any one of the following: the subordinate gateway is restarted; the subordinate gateway detects that a device is accessed but there is no complete information of the device in its user equipment area.

9. A gateway-attached device information acquisition apparatus, the apparatus being disposed in any gateway of a multi-level networking network, characterized in that, The device comprises: a storage module including a user equipment area and a downlink equipment area, the user equipment area being used to store information of terminal devices directly connected to the gateway, and the downlink equipment area being used to store device information managed by a direct subordinate gateway of the gateway; a linkage protocol module in communication connection with the storage module, configured to perform at least one of the following information coordination operations based on a predefined two-layer private communication protocol: when the gateway is an upper-level gateway, receiving a first reporting message from a subordinate gateway, and updating information of a downlink equipment area of the gateway based on change information of a user equipment area of the subordinate gateway in the first reporting message; and sending a query message to the subordinate gateway based on a query instruction, the query message containing identification information for indicating a query range, and updating information of the downlink equipment area of the gateway according to device information corresponding to the query range in a second reporting message returned by the subordinate gateway; and receiving a synchronization request message from the subordinate gateway, and returning corresponding device information to the subordinate gateway according to the synchronization request message and information of the downlink equipment area of the gateway, so that the subordinate gateway updates its user equipment area based on the device information returned by the gateway.

10. The apparatus of claim 9, wherein, The device further comprises: a collection module in communication connection with the storage module, configured to listen to and parse network protocol messages of directly connected devices of the gateway, to obtain device information of the directly connected terminal devices, and to trigger the gateway to update its user equipment area; a communication module in communication connection with the linkage protocol processing module, configured to receive and send the two-layer private communication protocol messages based on a forwarding hook function.

11. A multi-level gateway-related action hanging device information acquisition system characterized by comprising: The system comprises a master gateway and at least one sub-gateway, and the master gateway and the sub-gateway each comprise the device as claimed in any one of claims 9 or 10.