Switch information sharing method and device, mDNS switch and storage medium

By implementing the mDNS protocol in the switch, the switch can multicast query and declare messages within the local area network, solving the problem that service and protocol information cannot be shared in real time between switches, and achieving efficient and automatic information synchronization and management.

CN119996372APending Publication Date: 2025-05-13深圳市三旺通信股份有限公司
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510164116.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-14
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

In the prior art, service and protocol information between switches cannot be shared in real time, resulting in administrators needing to log in to each switch one by one for inspection and configuration, which is inefficient and error-prone.

Method used

By implementing the mDNS protocol in the switch, the switch can multicast query messages and declare messages within the local area network, and share the service information of itself and other switches in real time.

Benefits of technology

Automatic synchronization of service and protocol information between switches is achieved, and the efficiency and reliability of network management is improved, and manual intervention is required to ensure the consistency and accuracy of information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119996372A_ABST
    Figure CN119996372A_ABST
Patent Text Reader

Abstract

The invention relates to the field of switches, and discloses a switch information sharing method and device, an mDNS switch and a storage medium. The method comprises the following steps: if it is determined that the switch itself is a switch to be accessed to a network, carrying out multicast on a first query message in a local area network to query service information currently possessed in the local area network, and after receiving a first response message sent by other switches in the local area network, carrying out multicast on a first declaration message carrying equipment information of the switch itself; if it is determined that the switch itself is the switch accessed to the network, periodically multicasting a first declaration message; if it is determined that the preset condition is met, a second declaration message and / or a second query message and / or a second response message are / is multicast in real time; and receiving a third query message and / or a third declaration message and / or a third response message of other switches in real time. By using the MDNS protocol, the service and protocol information automatic synchronization between the switches in the local area network is realized, and the network management efficiency and reliability are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of switches, and in particular to a switch information sharing method, device, mDNS switch and storage medium. Background Art

[0002] In a local area network (such as a company's internal network), different switches can provide a variety of services and protocols, such as link discovery (LLDP), ring protection (MRP), web management (HTTP), dynamic host configuration (DHCP), etc. However, under current technology, the service and protocol information between these switches cannot be shared in real time. This means that if a switch changes a configuration or enables a service, other switches will not automatically know these changes, causing administrators to log in to each switch one by one to check and configure, which is inefficient and prone to errors. Summary of the invention

[0003] In view of this, in order to solve the technical problem in the prior art that service and protocol information between switches cannot be shared in real time, the present application provides a switch information sharing method, device, mDNS switch and storage medium.

[0004] In a first aspect, the present application provides a switch information sharing method, which is applied to an mDNS switch, and the method includes:

[0005] If it is determined that it is a switch to be added to the network, it multicasts a first query message in the local area network to query the service information currently available in the local area network. After receiving the first response message sent by other switches in the same local area network, it multicasts a first announcement message carrying its own device information in the local area network;

[0006] If it is determined that it is a switch that has been connected to the network, the first declaration message is periodically multicast in the local area network; if it is determined that the preset conditions are met, the second declaration message and / or the second query message and / or the second response message are instantly multicast in the local area network; and the third query message and / or the third declaration message and / or the third response message of the other switch are received in real time.

[0007] In an optional implementation manner, the multicasting of the first query message includes:

[0008] According to the service information to be queried, the service instance name field of the PTR record is set in the first mDNS message to obtain a first query message; wherein the first query message is used to indicate the service to be queried; and the service instance name field is used to indicate the specific service name to be queried.

[0009] In an optional implementation manner, before the multicast second response message is sent, the method further includes:

[0010] According to the received second query message and its own device information, the values ​​of each field of the text record, the pointer record, the service record, the IPV6 address record and the address record are respectively set in the second mDNS message to obtain a second response message; wherein the text record is used to indicate its own device information, the pointer record is used to indicate its own MAC address, the service record is used to indicate the port information of the port where the service involved in the second query message is located, the IPV6 address record is used to indicate its own IPV6 address, and the address record is used to indicate its own IPV4 address.

[0011] In an optional implementation manner, the multicasting of the first announcement message carrying the own device information in the local area network includes:

[0012] According to its own device information, set the value of the text record field in the third mDNS message;

[0013] According to its own domain name, a value of a pointer record field is set in the third mDNS message; the pointer record field is used to indicate a MAC address, so that other switches in the local area network can directly access local services through the MAC address;

[0014] According to its own service information, set the value of the service record field in the third mDNS message;

[0015] According to its own IPv4 address and IPv6 address, respectively set the values ​​of the address record field and the IPv6 address record field in the third mDNS message;

[0016] A first announcement message is obtained according to the third mDNS message in which corresponding fields are set.

[0017] In an optional implementation manner, the preset conditions include:

[0018] Condition 1: If it is determined that its service information configuration has been updated;

[0019] Condition 2: If it is determined that the current time has reached the time point where it is necessary to query the service information currently available in the local area network;

[0020] Condition three: If you are sure that you need to exit the LAN.

[0021] In an optional embodiment, the method further comprises:

[0022] Parse the response message and / or the announcement message sent by the other switch to obtain the service information and status information of the other switch; the service information and the status information are used for local direct access to the other switch.

[0023] In an optional implementation, the query message, the declaration message and the response message are all types of mDNS protocol messages, and the mDNS protocol message is respectively composed of four fields: service instance name, service type, protocol type and domain name definition, and five record types: pointer record, text record, service record, address record and IPV6 address record.

[0024] In a second aspect, the present application provides a switch information sharing device, including:

[0025] The network access announcement module is used to multicast a first query message in the local area network to query the service information currently available in the local area network if it is determined that it is a switch to be networked, and after receiving the first response message sent by other switches in the same local area network, multicast a first announcement message carrying its own device information in the local area network;

[0026] The query declaration module is used to periodically multicast the first declaration message in the local area network if it is determined that it is a switch that has been connected to the network; if it is determined that the preset conditions are met, instantly multicast the first declaration message and / or the first query message and / or the second response message in the local area network; and receive the second query message and / or the second declaration message and / or the third response message from the other switches in real time.

[0027] In a third aspect, the present application provides an mDNS switch, the mDNS switch comprising a processor and a memory, the memory storing a computer program, and the processor being configured to execute the computer program to implement the aforementioned switch information sharing method.

[0028] In a fourth aspect, the present application provides a computer storage medium storing a computer program, wherein when the computer program is executed on a processor, the switch information sharing method described above is implemented.

[0029] The embodiments of the present application have the following beneficial effects:

[0030] The embodiment of the present application provides a switch information sharing method, which realizes automatic synchronization of service and protocol information between switches in a local area network by utilizing the MDNS protocol supported by the switch, greatly improving the efficiency and reliability of network management. In addition, the information sharing process of the entire switch requires almost no human intervention, and all switches in the same local area network can automatically participate in information sharing, and can quickly respond to changes in the configuration information of themselves or other switches, ensuring the consistency and accuracy of the information, greatly simplifying network management and maintenance, improving work efficiency and reducing the possibility of errors. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the technical solution of the present application, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present application and should not be regarded as limiting the scope of protection of the present application. For ordinary technicians in this field, other related drawings can also be obtained based on these drawings without creative work.

[0032] Figure 1 A schematic diagram of the structure of an mDNS switch in an embodiment of the present application is shown;

[0033] Figure 2 A schematic diagram showing a first implementation of the switch information sharing method in an embodiment of the present application is shown;

[0034] Figure 3a The interactive schematic diagram of the query process executed by the new switch in the local area network in the embodiment of the present application is shown;

[0035] Figure 3b The following is a schematic diagram showing the interaction of a new switch in a local area network executing a declaration process in an embodiment of the present application;

[0036] Figure 4 The interactive schematic diagram of the query process executed by the connected switch in the local area network in the embodiment of the present application is shown;

[0037] Figure 5 A schematic diagram of the structure of a switch information sharing device in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0038] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.

[0039] The components of the embodiments of the present application generally described and shown in the drawings herein may be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0040] Hereinafter, the terms "including", "having" and their cognates, which may be used in various embodiments of the present application, are intended only to indicate specific features, numbers, steps, operations, elements, components, or combinations of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components, or combinations of the foregoing items or adding the possibility of one or more features, numbers, steps, operations, elements, components, or combinations of the foregoing items.

[0041] Furthermore, the terms “first”, “second”, “third”, etc. are merely used for distinguishing descriptions and are not to be understood as indicating or implying relative importance.

[0042] Unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meanings as those generally understood by those skilled in the art to which the various embodiments of the present application belong. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meanings as the contextual meanings in the relevant technical field and will not be interpreted as having idealized meanings or overly formal meanings unless clearly defined in the various embodiments of the present application.

[0043] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0044] mDNS is a protocol used for mutual discovery and service resolution between devices in a local area network. It is similar to DNS on the Internet, but it works through multicast and does not require a centralized server.

[0045] PTR records (pointer records) are mainly used to map IP addresses to domain names and are usually used in reverse DNS lookups.

[0046] SRV records (Service Location Records) are used to identify the host name and port of the server that provides a specific service. They usually contain the following fields: Service: service name (such as `_http`). Protocol: protocol name (such as `_tcp` or `_udp`); Name: domain name where the service is located; Priority: priority (the smaller the number, the higher the priority); Weight: weight (used for load balancing); Port: service port; Target: host name that provides the service.

[0047] TXT records (text records) are used to store arbitrary text information, usually used to provide additional data or verification information.

[0048] A record (address record), used to map a domain name to an IPv4 address. It is one of the most common record types in DNS.

[0049] AAAA record (IPV6 address record), similar to A record, but it is used to map domain names to IPv6 addresses.

[0050] An embodiment of the present application provides an mDNS switch (hereinafter referred to as the switch), which includes multiple functional modules and components, etc.; the mDNS switch can simultaneously support the MDNS protocol and the DNS-SD protocol; wherein the MDNS protocol and the DNS-SD protocol are both DNS protocol extension protocols.

[0051] It should be noted that in the prior art, since the functions of broadcasting discovery and publishing the device's own information are rarely enabled between switches, only the DNS protocol is generally enabled in the switch field. The mDNS switch in this application means that the corresponding MDNS function has been configured internally, and can identify and send MDNS protocol messages, and pre-customize the meaning of the corresponding fields in the MDNS message, so as to adaptively transmit information through each field in the MDNS message to achieve the corresponding function. Based on this, the mDNS switch can implement domain name resolution in a subnet without a DNS server; at the same time, it can provide its own service information and supplementary information.

[0052] That is, through the coordinated use of the above two protocols, the present application can realize that switches can know each other's status and device information, existing service types, service providers and their access addresses in the local area network.

[0053] In other words, through the MDNS and DNS-SD protocols, the switch multicasts its own information to the LAN, and other switches can cache and parse it. The switches that support the MDNS and DNS-SD protocols in the LAN can obtain the device information, status, and IP addresses and port numbers of specific services of other switches that support the MDNS and DNS-SD protocols in the LAN, and provide information such as information of all switches that support the MDNS and DNS-SD protocols in the LAN, device status, and device service information, thereby meeting needs while improving efficiency.

[0054] For example, Figure 1 As shown, the functional modules of the switch include a protocol and service function monitoring module, a protocol function module, a service function module, and a protocol and service function database.

[0055] Among them, the protocol and service function monitoring module (MDNS_Monitor) is used to monitor the protocol and service information of a switch; the protocol function module (Protocol_XXX) is the protocol function module for the normal operation of the switch, such as Protocol_LLDP represents the LLDP module, Protocol_MRP represents the MRP module, etc. The service function module (Service_XXX) is the service function module for the normal operation of the switch, such as Service_HTTP represents the HTTP service, and Service_DNS represents the DNS service.

[0056] Furthermore, the switch also includes a component, which may be a protocol and service function database (PS_Database (Protocol and Service Database). The protocol and service function database is used to store protocol and service function information of the switch (including the device itself) in the local area network, and its entity is a database stored in the memory during operation, which is used in the operation of the switch.

[0057] Furthermore, the switch also includes input and output ports and multiple communication channels; wherein the input and output ports (PORT) are physical ports for the switch to access the local area network, i.e., message sending and receiving interfaces; the multiple communication channels include a first bidirectional communication channel (a bidirectional communication channel between the two modules MDNS_Monitor and Protocol_XXX, i.e., channel 1 shown in the figure), a second bidirectional communication channel (a bidirectional communication channel between the two modules MDNS_Monitor and Service_XXX, i.e., channel 2 shown in the figure) and a third bidirectional communication channel (message sending and receiving channel, a message sending and receiving channel of the MDNS_Monitor module through a physical port (input and output ports), i.e., channel 3 shown in the figure).

[0058] Based on the structure of the above switch, an embodiment of the present application further provides a switch information sharing method, which can be applied to the mDNS switch in the above embodiment, so that the switch can automatically share device information with other switches in a local area network.

[0059] For example, Figure 2 As shown, the method may include the following steps:

[0060] S210, if it is determined that it is a switch to be added to the network, it multicasts a first query message in the local area network to query the service information currently available in the local area network, and after receiving a first response message sent by other switches in the same local area network, it multicasts a first announcement message carrying its own device information in the local area network.

[0061] S220, if it is determined that it is a switch that has joined the network, periodically multicast a first announcement message in the local area network; if it is determined that the preset conditions are met, instantly multicast a second announcement message and / or a second query message and / or a second response message in the local area network; and, receive a third query message and / or a third announcement message and / or a third response message from other switches in real time.

[0062] In this embodiment, the query message, response message and announcement message sent by the switch in the local area network are all mDNS protocol messages. Among them, the mDNS protocol message consists of four fields: service instance name, service type, protocol type and domain name definition, as well as five record types: pointer record (PTR record), text record (TXT record), service record (SRV record), address record (A record) and IPV6 address record (AAA record). It should be noted that the pointer record in the query message is used to carry the service instance name to be queried.

[0063] In this embodiment, each switch realizes synchronous sharing of service information of each switch in the local area network by multicasting corresponding types of mDNS messages in the local area network.

[0064] In one implementation, when a switch to be added to the network first adds to the network, it can query other switches in the local area network whether they already have the service information it needs to announce by multicasting a query message (remembered as a first query message) in the local area network.

[0065] That is, the switch to be connected to the network first sets the service instance name field of the pointer record (i.e., PTR record) in the first mDNS message according to the service information to be queried to obtain the first query message; wherein the first query message is used to indicate the service to be queried; and the service instance name field is used to indicate the specific service name to be queried.

[0066] For example, the Name field of the PTR record of the mDNS protocol message in the prior art is used to indicate the service name to be queried. The Name field includes <service> 、 <protocol> 、 <domain>These three fields; the <service>The field is defined as the specific service name. <protocol>The field is defined as the specific protocol name. <domain>The field is defined as a specific domain name suffix. <service> 、 <protocol>The value of the field begins with an underscore "_". For example, if you need to query an http service based on the TCP protocol, the value of the Name description of the queried service in the query message (that is, the value of the Name field in the PTR record) is "_http._tcp.local". <protocol>The fields are limited to "_tcp" and "_udp", which does not meet the needs of many switch protocols and services in the switch communication field.

[0067] The embodiment of the present application defines the Name field value of the PTR record of the mDNS protocol message in the prior art. <service> 、 <protocol>The meanings of these two fields are adjusted so that the query message obtained is suitable for the communication service requirements between the switches in the current local area network. <service>The field definition becomes the operation type; its details are shown in Table 1 below.

[0068] Table 1 PTR record <service>Field value definition

[0069] <service> < / service> Message Type _join mDNS network access message _request Configure mDNS request packets _response The response in the mDNS message <service>Partially used. < / service> _exit mDNS network exit message

[0070] Further, <protocol>The field definition is set to the protocol or service name, or is undefined; the details are shown in Table 2 below.

[0071] Table 2 PTR record <protocol>Field value definition

[0072] <protocol> < / protocol> Protocol and service type _undefined Non-Query Protocol and Service Requests _XXX XXX is the specific protocol name, such as lldp, mrp, etc.

[0073] After receiving the first query message, other switches in the LAN may generate a response message (referred to as a first response message) according to the first query message. The first response message is used to indicate the service information it already has, and then prompt the service conflict through the first response message.

[0074] Furthermore, after receiving the first response message, the newly connected switch can process the conflicting services, and then multicast a declaration message (remembered as the first declaration message) in the local area network, and then share its own device information and service information with each switch in the local area network through the declaration message.

[0075] For example, Figure 3a As shown, the switch to be connected to the network is connected to the local area network (i.e., the new switch), and will publish a first query message to the local area network, and then use the first query message to query whether the local area network has the service information that it needs to announce. The switches in the local area network that support the MDNS protocol will receive the first query message. If there is already a switch with the service information in the local area network, it will respond to the multicast message and send a response message to prompt the new switch of the service conflict through the response message. The new switch will automatically handle the conflict of the service information (generally modify the service instance name) and then enter a stage.

[0076] Furthermore, if Figure 3b As shown, the newly connected switch will also multicast a response message to the LAN based on the received response message (the response message at this time is equivalent to a declaration message) to announce its own device information such as the domain name, IP address and port number. The device information content will publish its own device domain name, IP address and port number and other information for synchronizing service information with other switches in the LAN.

[0077] Specifically, the process of generating a declaration message by a new switch can be: according to its own device information, set the value of the text record field in the third mDNS message; according to its own domain name, set the value of the pointer record field in the third mDNS message; the pointer record field is used to indicate the MAC address, so that other switches in the local area network can directly access local services through the MAC address; according to its own service information, set the value of the service record field in the third mDNS message; according to its own IPV4 address and IPV6 address, respectively set the value of the address record field and the IPV6 address record field in the third mDNS message; according to the third mDNS message with the corresponding fields set, obtain the first declaration message. The first declaration message is used to announce the device information such as the domain name, IP address and port number of its own device.

[0078] After receiving the response message and / or announcement message, each switch in the local area network parses the response message and / or announcement message sent by other switches to obtain the service information and status information of other switches; the service information and status information are used for local direct access to other switches. That is, the switch can directly access the services of other switches based on the parsed device information of other switches.

[0079] Among them, the pointer record provides service type information, the service record provides specific service access port information, and the text record provides supplementary information of the device itself. At the same time, it can also respond to the switch's DNS-SD query request for its own supported services, and respond to its own service information, port information and TXT records.

[0080] In another embodiment, the switch that has joined the network may periodically multicast announcement messages to the local area network. In other words, the switch that has joined the network periodically shares its own device information and service information in the local area network.

[0081] In this embodiment, if the switch itself is connected to the network, it will periodically multicast announcement messages in the local area network to announce its own device domain name, IP address, port number and other information. Specifically, the switch that has been connected to the network will periodically publish announcement messages according to the preset TTL (Time-To-Live, i.e., survival period) to publish its own device domain name, IP and port number information, and update the cache of other switches in the local area network. During the whole process, the switches in the local area network that have enabled the mDNS service will receive the corresponding announcement message or response message, and then record and refresh the domain name, IP and port number and other device information of all switches in the local area network in the local cache, thereby realizing the synchronization of service information of each switch in the local area network.

[0082] It can be understood that for the MDNS protocol, a LAN switch that supports the MDNS protocol can multicast the domain name of its own device in the LAN (i.e., publish a declaration message) and provide it to other switches for storage; it can also respond to query requests from other switches and then respond to its own IP address (i.e., publish a response message) to implement the domain name resolution function in a LAN without a DNS server; it can also publish query messages in the LAN to query the current service status of other switches in the LAN. For the DNS-SD protocol, LAN devices that support the DNS-SDS protocol can multicast their own service information in the LAN. Among them, the process of generating a declaration message by a switch that has been connected to the network is the same as the process of generating a declaration message by a switch that has just been connected to the network, so it will not be repeated here.

[0083] Exemplarily, the process of generating a response message by the switch may be, according to the received second query message and its own device information, respectively setting the values ​​of the text record, pointer record, service record, IPV6 address record and address record fields in the second mDNS message to obtain the second response message; wherein the text record field is used to indicate its own device information, the pointer record is used to indicate its own MAC address, the service record is used to indicate the port information of the port where the service involved in the second query message is located, the IPV6 address record is used to indicate its own IPV6 address, and the address record is used to indicate its own IPV4 address. Then, the subsequent networked switch multicasts the response message.

[0084] It should be noted that the content of the second response message is a response to the received second query message. The switch will provide its own service information in the response message, that is, the response message will carry TXT records, PTR records, SRV records, AAAA records, and A records and other information. The TXT record can be customized according to its own device information, and is used to feedback various content, with a definable space; the PTR record will provide a domain name ending with the local domain name that is unique to MDNS in the LAN, and is used for LAN domain name access services. The SRV record will provide port information, and respond to the access port of the service mentioned in the message, that is, provide a background entrance; the AAAA and A records will provide the IPV6 and IPV4 address records of the device. Among them, compared with the mDNS protocol message in the prior art, the response message only adjusts the field meaning of the PTR record, wherein the Name field of the PTR record <service> 、 <protocol> 、 <domain>The definition and adjustment of the three field values ​​in are consistent with those in the aforementioned query message, so they will not be repeated here.

[0085] Specifically, the PTR record includes the Name field, which is the full name of the service, defined as <service> 、 <protocol> 、 <domain>; Among them, Domain Name: domain name, defined as <instance> 、 <service> 、 <protocol> 、 <domain>Instance is a specific instance name. The instance name is unique and needs to remain unique in the same local area network. In this embodiment, the instance name is a MAC address.

[0086] SRV records include <instance> 、 <service> 、 <protocol> 、 <name> 、 <target>These five fields; among them, <instance>, i.e., the instance name, which is specifically a MAC address in this embodiment; <service>The meaning of the fields is as described in Table 1 above; <protocol>The meaning of the fields is as described in Table 2 above; <name>, defined as "local"; <target>, which is a special field in the SRV record, generally consisting of a host name plus a domain name. In this embodiment, the meaning of this field remains the host name plus the domain name. For example, if the hostname of the switch is switch1, the value is "switch1.local".

[0087] The TXT record includes the Time to live field, Name field, TXT Length field, and TXT content field. The Time to live field in the TXT record indicates the mDNS switch protocol and configuration synchronization cycle time. The Name field is the full name of the service, including <instance> 、 <service> 、 <protocol> 、 <domain>Four fields, and in this embodiment, the definitions of these four fields are the same as those in the aforementioned PTR record <instance> 、 <service> 、 <protocol> 、 <domain>The TXT Length field and the TXT Content field are a group of two, specifically the protocol and service customization area, which are filled in with key-value pairs according to the actual services provided. For example, for the MRP protocol, a pair of key-value pairs can be provided as "mrp_port1=ge1", indicating that one of the ring network ports is ge1, and a pair of key-value pairs can be provided as "mrp_port1=ge2", indicating that the other ring network port is ge2. The left side of the key-value pair equal sign is the description content, and the right side is the specific value.

[0088] The A record includes a Name field and an Adress field. The Name field is generally composed of a host name and a domain name. In this embodiment, the field is specifically defined as a host name and a domain name. For example, if the host name of the switch is switch1, the value is "switch1.local". The Adress field is specifically the IPV4 address of the switch itself.

[0089] The AAAA record includes a Name field and an Adress field. The Name field is generally composed of a host name and a domain name. In this embodiment, the field is specifically defined as a host name and a domain name. For example, if the host name of the switch is switch1, the value is "switch1.local". The Adress field is specifically the IPV6 address of the switch itself.

[0090] For example, if the current switch supports the MRP protocol service, its MAC address is AA-BB-CC-11-22-33, and the host name (hostname) is switch1, it will periodically send mDNS announcement messages, wherein the announcement part of the mDNS message (wherein, the announcement part in the announcement message and the response message in the response message have substantially the same content, so they are not described here):

[0091] In the PTR record, the Name field is "_response._mrp._local"; Domain Name: The domain name is "AA-BB-CC-11-22-33._response._mrp._local". This indicates that the mDNS switch provides MRP services and its MAC address is AA-BB-CC-11-22-33.

[0092] In the SRV record, the Instance field, that is, the instance name, is "AA-BB-CC-11-22-33"; the Service field is "_response"; the Protocol is "_mrp"; the Name field remains "local"; and the Target field is "switch1.local". This indicates that the mDNS switch provides MRP services, the MAC address is AA-BB-CC-11-22-33, and the host name is switch1.

[0093] In the TXT record, a key-value pair is "mrp_port1=ge1", indicating that one of the ring network ports is ge1; a key-value pair is "mrp_port1=ge2", indicating that the other ring network port is ge2. A key-value pair is "mrp_state=ok", indicating that there is no problem with the current MRP ring network status, etc.

[0094] The Name corresponding to the A record and AAAA record is "switch1.local", and the IP address is the corresponding IPV4 and IPV6 address.

[0095] In one example, the switch that has joined the network can immediately multicast announcement messages and / or query messages and / or response messages in the local area network when it determines that it currently meets the preset conditions. The preset conditions include: condition 1, if it is determined that its service information configuration has been updated; condition 2, if it is determined that the current time has reached the time point where it is necessary to query the service information currently available in the local area network; condition 3, if it is determined that it currently needs to exit the local area network.

[0096] It can be understood that in one example, when a switch that has been connected to the network determines that its current service information configuration has been updated, in order to ensure that other switches in the local area network can obtain its updated service information in a timely manner, the switch will immediately multicast a declaration message locally to announce its own domain name, service information, etc. to all switches in the local area network through the declaration message.

[0097] In another example, when the connected switch determines that the current time has reached the time point where the service information currently available in the local area network needs to be queried, it multicasts the query message in the local area network. In other words, if it needs to actively query the service information of other switches in the local area network, it can multicast the query message immediately, and the switch that receives the query message will respond to the message to announce its own service information and device information.

[0098] For example, in some embodiments, Figure 4 As shown in the figure, when a networked switch needs a certain service or domain name resolution, it can initiate a query message in the LAN and send the query message through multicast. The query message will carry the domain name and port number information that need to be queried and resolved; switches in the LAN that have enabled the mDNS service will receive the message, switches that do not provide the service will not process it, and only switches that provide the service will process it and respond to the message ( Figure 4 In step 2. Response), a response message is sent, which carries information such as the IP address. The requesting device and other mDNS switches in the LAN will receive the response message and perform resolution processing. This process achieves the main purpose of the mDNS protocol design and realizes domain name resolution in a zero-configuration (i.e., automatic configuration without manual intervention) network.

[0099] By analyzing the MDNS messages of LAN devices, the switch can obtain the status information of other switches in the LAN that support MDNS services, the device services they can provide, etc., and record their IP addresses and port numbers to provide management users with direct access to services, or perform specific functional operations for specific services through the built-in program of the switch.

[0100] The switch that supports MDNS and DNS-SD protocols will multicast the device information of its own organization in the LAN. Other switches in the LAN that support MDNS and DNS-SD protocols will receive the multicast message, parse and record it, and complete the process of multicasting the MDNS of their own devices to the LAN. After all switches complete the process, the switches in the LAN can realize data sharing, and the status and information of other switches can be mastered through one switch. The record cache can be updated later through periodic multicast messages.

[0101] In other words, for scenarios where specific services and device information need to be obtained in a timely manner, the switch can actively send MDNS multicast messages (i.e., query messages) to query specific services. By publishing the query message to the local area network, it can obtain responses from all switches that support the MDNS protocol and provide the specific service. The received response message is then parsed to obtain the device information and service information that meets the needs.

[0102] In another example, if the switch that has joined the network determines that it currently needs to exit the local area network (i.e., exit the network), it will immediately multicast a response message in the local area network. The response message in this case is actively sent by the switch to indicate that it is about to exit the local area network. After receiving this type of response message, other switches in the local area network will internally delete the device information and service information of the switch to be exited according to the response message.

[0103] For example, the message fields of the response message corresponding to the network exit are basically consistent with the content of the declaration part fields of the mDNS message listed above, except that <service>The field becomes "_exit", <protocol>The field becomes "_undefined", which is used to indicate that the switch is about to exit the local area network. This embodiment will not be described in detail.

[0104] The embodiments of the present application utilize MDNS and DNS-SD, two lightweight, easy-to-implement and widely compatible network protocols. They inherit the advantages of standard DNS, and also have better scalability and adaptability, and are particularly suitable for communication between all switches in a local area network environment. Based on this, switches supporting this protocol can realize the sharing and synchronization of device information and service information of all switches in the local area network, and also include providing various services and their access paths, while supporting on-demand query of specific services and returning results immediately. In addition, the entire process requires almost no human intervention, all switches can automatically participate in information sharing, and can quickly respond to changes in the configuration information of themselves or other switches, ensuring the consistency and accuracy of information, thereby achieving efficient service and protocol information synchronization between switches in the local area network, greatly simplifying network management and maintenance work, improving work efficiency and reducing the possibility of errors, and then compared with traditional SNMP or other remote management methods, the switch information sharing method of the embodiment of the present application provides a simpler, more efficient and flexible option, which is particularly suitable for enterprises or organizations that need to reduce operation and maintenance costs and improve management efficiency. With the development of Internet of Things technology, such solutions based on lightweight protocols will play an important role in more scenarios in the future. In addition, the mDNS switch can also be expanded to support multiple other types of protocols to meet different needs.

[0105] like Figure 5 As shown, the embodiment of the present application also provides a switch information sharing device, which exemplarily includes:

[0106] The network access announcement module 510 is used to, if it is determined that it is a switch to be networked, multicast a first query message in the local area network to query the service information currently available in the local area network, and after receiving the first response message sent by other switches in the same local area network, multicast a first announcement message carrying its own device information in the local area network;

[0107] The query declaration module 520 is used to periodically multicast the first declaration message in the local area network if it is determined that it is a switch that has joined the network; if it is determined that the preset conditions are met, instantly multicast the first declaration message and / or the first query message and / or the second response message in the local area network; and, receive the second query message and / or the second declaration message and / or the third response message from the other switches in real time.

[0108] It can be understood that the device of this embodiment corresponds to the switch information sharing method of the above embodiment, and the options in the above embodiment are also applicable to this embodiment, so they will not be described repeatedly here.

[0109] The present application also provides an mDNS switch. Exemplarily, the mDNS switch can support both the mDNS protocol and the DNS-SD protocol. The mDNS switch includes a processor and a memory, wherein the memory stores a computer program. The processor runs the computer program, thereby enabling the mDNS switch to execute the functions of each module in the above-mentioned switch information sharing method or the above-mentioned switch information sharing device.

[0110] Among them, the processor can be an integrated circuit chip with signal processing capabilities. The processor can be a general-purpose processor, including a central processing unit (CPU), a graphics processing unit (GPU) and a network processor (NP), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or at least one of other programmable logic devices, discrete gates or transistor logic devices, and discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc., which can implement or execute the disclosed methods, steps and logic block diagrams in the embodiments of the present application.

[0111] The memory may be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc. The memory is used to store a computer program, and the processor may execute the computer program accordingly after receiving an execution instruction.

[0112] The present application also provides a computer storage medium for storing the computer program used in the above-mentioned computer device. The computer storage medium may be a readable storage medium, or a non-volatile storage medium or a volatile storage medium. For example, the computer storage medium may include, but is not limited to, various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0113] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and structure diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in an alternative implementation, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the structure diagram and / or the flow diagram, and the combination of boxes in the structure diagram and / or the flow diagram, can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0114] In addition, the functional modules or units in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0115] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a smart phone, a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application.

[0116] The above description is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.< / protocol> < / service> < / domain> < / protocol> < / service> < / instance> < / domain> < / protocol> < / service> < / instance> < / target> < / name> < / protocol> < / service> < / instance> < / target> < / name> < / protocol> < / service> < / instance> < / domain> < / protocol> < / service> < / instance> < / domain> < / protocol> < / service> < / domain> < / protocol> < / service> < / protocol> < / protocol> < / service> < / service> < / protocol> < / service> < / protocol> < / protocol> < / service> < / domain> < / protocol> < / service> < / domain> < / protocol> < / service>

Claims

1. A switch information sharing method, characterized in that: Applied to an mDNS switch, the method includes: If it is determined that it is a switch to be added to the network, it multicasts a first query message in the local area network to query the service information currently available in the local area network. After receiving the first response message sent by other switches in the same local area network, it multicasts a first announcement message carrying its own device information in the local area network; If it is determined that it is a switch that has been connected to the network, the first declaration message is periodically multicast in the local area network; if it is determined that the preset conditions are met, the second declaration message and / or the second query message and / or the second response message are instantly multicast in the local area network; and the third query message and / or the third declaration message and / or the third response message of the other switch are received in real time.

2. The switch information sharing method according to claim 1, characterized in that: The multicast first query message includes: According to the service information to be queried, the service instance name field of the PTR record is set in the first mDNS message to obtain a first query message; wherein the first query message is used to indicate the service to be queried; and the service instance name field is used to indicate the specific service name to be queried.

3. The switch information sharing method according to claim 1, characterized in that: Before the multicast second response message, the method further includes: According to the received second query message and its own device information, the values ​​of each field of the text record, the pointer record, the service record, the IPV6 address record and the address record are respectively set in the second mDNS message to obtain a second response message; wherein the text record is used to indicate its own device information, the pointer record is used to indicate its own MAC address, the service record is used to indicate the port information of the port where the service involved in the second query message is located, the IPV6 address record is used to indicate its own IPV6 address, and the address record is used to indicate its own IPV4 address.

4. The switch information sharing method according to claim 1, characterized in that: The first announcement message carrying the device information is multicasted in the local area network, including: According to its own device information, set the value of the text record field in the third mDNS message; According to its own domain name, a value of a pointer record field is set in the third mDNS message; the pointer record field is used to indicate a MAC address, so that other switches in the local area network can directly access local services through the MAC address; According to its own service information, set the value of the service record field in the third mDNS message; According to its own IPv4 address and IPv6 address, respectively set the values ​​of the address record field and the IPv6 address record field in the third mDNS message; A first announcement message is obtained according to the third mDNS message in which corresponding fields are set.

5. The switch information sharing method according to claim 1, characterized in that: The preset conditions include: Condition 1: If it is determined that its service information configuration has been updated; Condition 2: If it is determined that the current time has reached the time point where it is necessary to query the service information currently available in the local area network; Condition three: If you are sure that you need to exit the LAN.

6. The switch information sharing method according to claim 1, characterized in that: The method further comprises: Parse the response message and / or the announcement message sent by the other switch to obtain the service information and status information of the other switch; the service information and the status information are used for local direct access to the other switch.

7. The switch information sharing method according to any one of claims 1 to 6, characterized in that: The query message, the declaration message and the response message are all types of mDNS protocol messages, and the mDNS protocol message consists of four fields: service instance name, service type, protocol type and domain name definition, and five record types: pointer record, text record, service record, address record and IPV6 address record.

8. A switch information sharing device, characterized in that: include: The network access announcement module is used to multicast a first query message in the local area network to query the service information currently available in the local area network if it is determined that it is a switch to be networked, and after receiving the first response message sent by other switches in the same local area network, multicast a first announcement message carrying its own device information in the local area network; A query declaration module, configured to periodically multicast the first declaration message in the local area network if it is determined that the switch itself is a switch that has joined the network; If it is determined that the preset condition is met, instantly multicasting the first announcement message and / or the first query message and / or the second response message in the local area network; And, receiving the second query message and / or the second announcement message and / or the third response message of the other switch in real time.

9. An mDNS switch, characterized in that: The mDNS switch includes a processor and a memory, wherein the memory stores a computer program, and the processor is configured to execute the computer program to implement the switch information sharing method according to any one of claims 1 to 7.

10. A computer storage medium, characterized in that: The device stores a computer program, which, when executed on a processor, implements the switch information sharing method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Session sharing and multiplexing method for optimizing controller to centrally manage mass connections

    CN120812037A