Communication method and system for private ring network of bypass switch
By determining the master node and transmission node in the ring network, and judging the status through the HELLO message, and automatically reselecting the master node, the network storm problem of the bypass switch private ring network when the main node fails, ensuring the normal operation and user experience of the ring network.
Patent Information
- Application Number
- CN202510773127.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-11
- Publication Date
- 2025-08-08
AI Technical Summary
The prior art cannot effectively solve the network storm problem of the bypass switch private ring network when the main node fails, resulting in poor user experience.
Send and receive data packets through switches in the ring network, determine the master node and transmission node, and send HELLO messages regularly through the main port to determine the status of the secondary port, and automatically re-select the master node to ensure the normal operation of the ring network.
It realizes automatic re-selecting of the master node when a network failure occurs in a private ring network, ensuring the normal operation of the ring network and improving the user experience.
Smart Images

Figure CN120455202A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of communication networks, and in particular relates to a communication method and system for a bypass switch private ring network. Background Art
[0002] Currently, the existing ring network structure includes a master node and multiple transmission nodes. The master node and transmission nodes together form a ring structure. In some environments with relatively high service requirements, in addition to networking through the ring network, the cascade port will be bypassed. In the event that one or more switches on the ring are offline, bypass will be used to ensure normal forwarding of some services.
[0003] Normally, if the master switch in a ring network unexpectedly goes offline, the cascaded switch ports use link-down events to reselect a master switch. However, in bypass scenarios, because hardware bypass speeds are in the millisecond range, the switch chip's MAC layer or software cannot detect interface link-down / link-up events. Some approaches monitor the switch chip's PHY layer to obtain port status within milliseconds, but this wastes hardware and software resources and cannot guarantee complete accuracy. In this scenario, the ring network loses its master switch, the initiator and decision-maker of the protocol, leading to a network storm. Summary of the Invention
[0004] In view of the above-mentioned deficiencies in the prior art, the purpose of the present invention is to provide a communication method and system for a bypass switch private ring network, aiming to solve the problem that when a network failure occurs in the private ring network and there is no master node, a loop will be formed, resulting in a network storm and poor user experience.
[0005] In one aspect, the present invention provides a method for communicating in a private ring network of a bypass switch, the method comprising the following steps:
[0006] Step 1: A first switch in a ring network sends a first data packet to multiple second switches, and receives multiple second data packets returned by the second switches;
[0007] The first switch is any switch in the ring network, and the plurality of second switches are a plurality of switches in the ring network other than the first switch; the first data packet includes a first MAC address of the first switch, and the second data packet includes a second MAC address of the second switch;
[0008] Step 2: The first switch determines a master node and multiple transmission nodes in the ring network according to the multiple second data packets, and sets the primary port and the secondary port of the master node and the transmission nodes respectively;
[0009] Step 3: The master node or the transmission node periodically sends a HELLO message to the transmission node through the primary port, and determines whether the secondary port receives the HELLO message within a preset first time period. If not, the process returns to step 1.
[0010] Step 4: The transmission node detects the current state and / or link state, adjusts the current state and / or link state, and sends the adjusted current state to the master node. The master node determines whether step 1 needs to be executed based on the current state of the transmission node.
[0011] Further preferably, the step 2 includes:
[0012] A switch with the largest MAC address is selected from the first switch and the plurality of second switches to be set as the master node, and the remaining plurality of switches are all set as the transmission nodes.
[0013] Preferably, the selecting a switch with the largest MAC address from the first switch and the plurality of second switches to set as the master node, and setting the remaining plurality of switches as the transmission nodes includes:
[0014] The first switch obtains its own first MAC address, and parses a plurality of second data packets corresponding one-to-one to the plurality of second switches to obtain a plurality of second MAC addresses of the second switches;
[0015] The first switch determines whether the second MAC addresses of the plurality of second switches are greater than its own first MAC address. If not, the first switch is determined to be the master node, and the remaining plurality of second switches are all transmission nodes.
[0016] Preferably, the first switch determines whether the second MAC addresses of the plurality of second switches are greater than its own first MAC address, and if so, the first switch sends the third data packet to the second switch with the largest second MAC address;
[0017] The second switch with the largest second MAC address parses the third data packet to obtain a third MAC address. When the third MAC address is equal to the second MAC address of the second switch with the largest second MAC address, the second switch with the largest second MAC address is set as the master node, and the first switch and the remaining plurality of second switches are all set as the transmission nodes.
[0018] The third data packet includes the second MAC address of the second switch with the largest second MAC address.
[0019] Further preferably, the method further comprises:
[0020] When the transmission node detects that the current state is the connected state and the link state of the primary port or the secondary port is the Down state, it adjusts the current state from the connected state to the disconnected state and sends a disconnected state message to the master node.
[0021] Preferably, the method further comprises:
[0022] When the transmission node detects that the current state is the disconnected state and the link state of the primary port or the secondary port is the Up state, it adjusts both the primary port and the secondary port to the Up state and adjusts the current state from the disconnected state to the temporarily blocked state, and sends a temporary blocking state message to the primary node.
[0023] Preferably, the method further comprises:
[0024] When the transmission node detects that the current state is the temporarily blocked state, it determines whether the fourth message sent by the master node is received within a preset second time period; if so, the current state is adjusted from the temporarily blocked state to the connected state, and the connection state message is sent to the master node; if not, the current state is switched from the temporarily blocked state to the connected state and the temporarily blocked port is released, and the connection state message and the release of the temporarily blocked port message are sent to the master node.
[0025] On the other hand, the present invention also provides a communication system for a private ring network of a bypass switch, the system comprising at least one processor; and
[0026] a memory communicatively connected to the at least one processor; wherein,
[0027] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor to enable the at least one processor to execute the above-mentioned communication method for the bypass switch private ring network.
[0028] On the other hand, the present invention also provides a non-volatile computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by one or more processors, the one or more processors can execute the above-mentioned communication method of the bypass switch private ring network.
[0029] On the other hand, the present invention also provides a computer program product, which includes a computer program stored on a non-volatile computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a processor, the processor executes the above-mentioned communication method for the bypass switch private ring network.
[0030] The beneficial effects of the present invention are: through step one: the first switch in the ring network sends a first data packet to multiple second switches, and receives second data packets returned by multiple second switches; step two: the first switch determines a master node and multiple transmission nodes in the ring network according to the multiple second data packets, and sets the master port and the secondary port of the master node and the transmission node respectively; step three: the master node or the transmission node sends a HELLO message to the transmission node through the master port at regular intervals, and determines whether the secondary port receives the HELLO message within a preset first time period, and if not, returns to step one; step four: the transmission node detects the current state and / or link state, adjusts the current state and / or link state, and sends the adjusted current state to the master node, and the master node determines whether step one needs to be executed according to the current state of the transmission node; thereby realizing that when a network failure occurs in the private ring network and there is no master node, the master node is automatically reselected through the above steps to ensure the normal operation of the private ring network, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 This is a flow chart of an implementation method of a bypass switch private ring network communication method provided in the first embodiment of the present invention;
[0032] Figure 2 It is a structural diagram of a communication system of a bypass switch private ring network provided in the second embodiment of the present invention. DETAILED DESCRIPTION
[0033] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0034] The following describes the specific implementation of the present invention in detail with reference to specific embodiments:
[0035] Example 1:
[0036] Figure 1 The following illustrates an implementation flow of a communication method for a bypass switch private ring network provided in Embodiment 1 of the present invention. For ease of illustration, only the portion related to the embodiment of the present invention is shown, which is described in detail as follows:
[0037] In step S101: a first switch in a ring network sends a first data packet to a plurality of second switches, and receives a second data packet returned by the plurality of second switches;
[0038] In an embodiment of the present invention, the first switch is any switch in the ring network, and the multiple second switches are multiple switches in the ring network other than the first switch; the first data packet includes the first MAC address of the first switch, and the second data packet includes the second MAC address of the second switch.
[0039] In step S102: the first switch determines a master node and multiple transmission nodes in the ring network according to the multiple second data packets, and sets the primary port and the secondary port of the master node and the transmission nodes respectively;
[0040] In an embodiment of the present invention, step S102 includes:
[0041] A switch with the largest MAC address is selected from the first switch and the plurality of second switches and is set as a master node, and the remaining plurality of switches are all set as transmission nodes.
[0042] Preferably, selecting a switch with the largest MAC address from the first switch and the plurality of second switches as the master node, and setting the remaining plurality of switches as transmission nodes includes:
[0043] The first switch obtains its own first MAC address, and parses a plurality of second data packets corresponding one-to-one to the plurality of second switches to obtain the second MAC addresses of the plurality of second switches;
[0044] The first switch determines whether the second MAC addresses of the plurality of second switches are greater than its own first MAC address. If not, the first switch is determined to be the master node, and the remaining plurality of second switches are all transmission nodes.
[0045] Further preferably, the first switch determines whether the second MAC addresses of the plurality of second switches are greater than its own first MAC address, and if so, the first switch sends the third data packet to a second switch having the largest second MAC address;
[0046] The second switch with the largest second MAC address parses the third data packet to obtain a third MAC address. When the third MAC address is equal to the second MAC address of the second switch with the largest second MAC address, the second switch with the largest second MAC address is set as the master node, and the first switch and the remaining plurality of second switches are all set as transmission nodes.
[0047] The third data packet includes the second MAC address of a second switch with the largest second MAC address.
[0048] In step S103: the master node or the transit node sends a HELLO message to the transit node via the primary port at regular intervals, and determines whether the secondary port receives the HELLO message within a preset first time period. If not, the process returns to step S101;
[0049] In an embodiment of the present invention, after a master node is elected, when the topology changes, the configuration changes, or a node sends a Link-Down / Up message, all nodes in the private loop are re-reported by sending a RING_TCN message, and the configuration BPDU is resent to elect a master node. When the switch supports Bypass, the Link-Up / Down message is likely to be lost, and the private ring cannot perceive the change in the link and will not re-elect a master node. At this time, the private ring has no master node, and the private ring will form a loop, causing a network storm. In this case, by adding an additional backup mechanism for electing a master node, the device periodically sends a configuration BPDU to elect a master node.
[0050] Furthermore, it also includes: instructing the transmission node to update the MAC address table.
[0051] In step S104: the transmission node detects the current state and / or link state, adjusts the current state and / or link state, and sends the adjusted current state to the master node. The master node determines whether step S101 needs to be executed based on the current state of the transmission node.
[0052] In an embodiment of the present invention, the method further comprises:
[0053] When the transmission node detects that the current state is the connected state and the link state of the primary port or the secondary port is the Down state, it adjusts the current state from the connected state to the disconnected state and sends a disconnection state message to the primary node. The primary node determines whether step S101 needs to be executed, and preferably executes step S101.
[0054] Preferably, the method further comprises:
[0055] When the transmission node detects that the current state is the disconnected state and the link state of the primary port or the secondary port is the Up state, it adjusts both the primary port and the secondary port to the Up state and adjusts the current state from the disconnected state to the temporarily blocked state, and sends a temporary blocking state message to the primary node. The primary node determines whether step S101 needs to be executed, and preferably executes step S101.
[0056] Furthermore, the method further comprises:
[0057] When the transmission node detects that the current state is a temporarily blocked state, it determines whether the fourth message sent by the master node is received within the preset second time period; if so, the current state is adjusted from the temporarily blocked state to the connected state, and the connection state message is sent to the master node; if not, the current state is switched from the temporarily blocked state to the connected state and the temporarily blocked port is released, and the connection state message and the release of the temporarily blocked port message are sent to the master node, wherein the fourth message can be a COMPLETE-FLUSH-FDB message, and the master node determines whether it is necessary to execute step S101, and preferably executes step S101.
[0058] In an embodiment of the present invention, step one: a first switch in a ring network sends a first data packet to a plurality of second switches, and receives a second data packet returned by the plurality of second switches; step two: the first switch determines a master node and a plurality of transmission nodes in the ring network according to the plurality of second data packets, and sets a master port and a slave port of the master node and the transmission node respectively; step three: the master node or the transmission node periodically sends a HELLO message to the transmission node through the master port, and determines whether the slave port receives the HELLO message within a preset first time period, and if not, returns to step one; step four: the transmission node detects the current state and / or link state, adjusts the current state and / or link state, and sends the adjusted current state to the master node, and the master node determines whether step one needs to be executed according to the current state of the transmission node; thereby realizing that when a network failure occurs in the private ring network and there is no master node, the master node is automatically reselected through the above steps to ensure the normal operation of the private ring network, thereby improving the user experience.
[0059] Example 2:
[0060] Figure 2 A communication system of a bypass switch private ring network provided by the second embodiment of the present invention is shown. Figure 2 As shown, the system 10 includes:
[0061] One or more processors 110 and memory 120, Figure 2 In the description, a processor 110 is used as an example. The processor 110 and the memory 120 may be connected via a bus or other means. Figure 2 The bus connection is taken as an example.
[0062] The processor 110 is used to implement various control logics of the device 10. It can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a single-chip microcomputer, an ARM (Acorn RISC Machine) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination of these components. In addition, the processor 110 can also be any traditional processor, microprocessor or state machine. The processor 110 can also be implemented as a combination of computing devices, for example, a combination of a DSP and a microprocessor, multiple microprocessors, one or more microprocessors combined with a DSP core, or any other such configuration.
[0063] Memory 120, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as program instructions corresponding to the communication method for a bypass switch private ring network in the embodiments of the present invention. Processor 110 executes the non-volatile software programs, instructions, and modules stored in memory 120 to execute various functional applications and data processing functions of device 10, thereby implementing the communication method for a bypass switch private ring network in the aforementioned method embodiments.
[0064] Memory 120 may include a program storage area and a data storage area. The program storage area may store applications required to operate the device or at least one function; the data storage area may store data generated based on the use of device 10. Furthermore, memory 120 may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state memory device. In some embodiments, memory 120 may optionally include memory remotely located relative to processor 110, and such remote memory may be connected to device 10 via a network. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0065] One or more units are stored in the memory 120, and when executed by one or more processors 110, execute the communication method of bypassing the private ring network of the switch in any of the above method embodiments, for example, execute the above described Figure 1 Steps S101 to S104 of the method.
[0066] Example 3:
[0067] A third embodiment of the present invention provides a non-volatile computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, which are executed by one or more processors, for example, to execute the above-described Figure 1Steps S101 to S104 of the method.
[0068] As an example, non-volatile storage media can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) as external cache memory. By way of illustration and not limitation, RAM can be obtained in many forms such as synchronous RAM (SRAM), dynamic RAM, (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), and direct Rambus RAM (DRRAM). The disclosed memory components or memories of the operating environment described herein are intended to include one or more of these and / or any other suitable types of memory.
[0069] Example 4:
[0070] The fourth embodiment of the present invention provides a computer program product, which includes a computer program stored on a non-volatile computer-readable storage medium. The computer program includes program instructions. When the program instructions are executed by a processor, the processor executes the communication method of the bypass switch private ring network of the above method embodiment. For example, the above described Figure 1 Steps S101 to S104 of the method.
[0071] The embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected to achieve the objectives of the present embodiments as needed.
[0072] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by software plus a general hardware platform, and of course can also be implemented by hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the relevant technology can be embodied in the form of a software product. This computer software product can be present in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for causing a computer electronic device (which can be a personal computer, a server, or a network electronic device, etc.) to execute the methods of each embodiment or certain parts of the embodiment.
[0073] Conditional language such as "can," "may," or "might," among others, unless specifically stated otherwise or otherwise understood within the context as used, is generally intended to convey that particular embodiments can include, while other embodiments do not, particular features, elements, and / or operations. Thus, such conditional language is generally not intended to imply that features, elements, and / or operations are in any way required for one or more embodiments or that one or more embodiments must include logic for determining, with or without student input or prompting, whether such features, elements, and / or operations are included or will be performed in any particular embodiment.
[0074] What has been described herein in this specification and the accompanying drawings includes examples of communication methods and systems that can provide a bypass switch private ring network. Of course, it is not possible to describe every conceivable combination of components and / or methods for the purpose of describing the various features of the present disclosure, but it will be appreciated that many other combinations and permutations of the disclosed features are possible. Therefore, it will be apparent that various modifications can be made to the present disclosure without departing from the scope or spirit of the present disclosure. In addition, or in the alternative, other embodiments of the present disclosure may become apparent from consideration of this specification and the accompanying drawings and from practice of the present disclosure as presented herein. It is intended that the examples set forth in this specification and the accompanying drawings be considered in all respects to be illustrative and not restrictive. Although specific terms are employed herein, they are used in a general and descriptive sense and not for purposes of limitation.
Claims
1. A communication method for a private ring network bypassing a switch, characterized in that: The method comprises the following steps: Step 1: A first switch in a ring network sends a first data packet to multiple second switches, and receives multiple second data packets returned by the second switches; The first switch is any switch in the ring network, and the plurality of second switches are a plurality of switches in the ring network other than the first switch; the first data packet includes a first MAC address of the first switch, and the second data packet includes a second MAC address of the second switch; Step 2: The first switch determines a master node and multiple transmission nodes in the ring network according to the multiple second data packets, and sets the primary port and the secondary port of the master node and the transmission nodes respectively; Step 3: The master node or the transmission node periodically sends a HELLO message to the transmission node through the primary port, and determines whether the secondary port receives the HELLO message within a preset first time period. If not, the process returns to step 1. Step 4: The transmission node detects the current state and / or link state, adjusts the current state and / or link state, and sends the adjusted current state to the master node. The master node determines whether step 1 needs to be executed based on the current state of the transmission node.
2. The method according to claim 1, wherein The second step includes: A switch with the largest MAC address is selected from the first switch and the plurality of second switches to be set as the master node, and the remaining plurality of switches are all set as the transmission nodes.
3. The method according to claim 2, wherein The step of selecting a switch with the largest MAC address from the first switch and the plurality of second switches as the master node, and setting the remaining plurality of switches as the transmission nodes includes: The first switch obtains its own first MAC address, and parses a plurality of second data packets corresponding one-to-one to the plurality of second switches to obtain a plurality of second MAC addresses of the second switches; The first switch determines whether the second MAC addresses of the plurality of second switches are greater than its own first MAC address. If not, the first switch is determined to be the master node, and the remaining plurality of second switches are all transmission nodes.
4. The method according to claim 3, wherein The first switch determines whether the second MAC addresses of the plurality of second switches are greater than the first MAC address of the first switch, and if so, sends the third data packet to the second switch with the largest second MAC address; The second switch with the largest second MAC address parses the third data packet to obtain a third MAC address. When the third MAC address is equal to the second MAC address of the second switch with the largest second MAC address, the second switch with the largest second MAC address is set as the master node, and the first switch and the remaining plurality of second switches are all set as the transmission nodes. The third data packet includes the second MAC address of the second switch with the largest second MAC address.
5. The method according to claim 1, wherein The method further comprises: When the transmission node detects that the current state is the connected state and the link state of the primary port or the secondary port is the Down state, it adjusts the current state from the connected state to the disconnected state and sends a disconnected state message to the master node.
6. The method according to claim 1, wherein The method further comprises: When the transmission node detects that the current state is the disconnected state and the link state of the primary port or the secondary port is the Up state, it adjusts both the primary port and the secondary port to the Up state and adjusts the current state from the disconnected state to the temporarily blocked state, and sends a temporary blocking state message to the primary node.
7. The method according to claim 6, wherein The method further comprises: When the transmission node detects that the current state is the temporarily blocked state, it determines whether the fourth message sent by the master node is received within a preset second time period; if so, the current state is adjusted from the temporarily blocked state to the connected state, and the connection state message is sent to the master node; if not, the current state is switched from the temporarily blocked state to the connected state and the temporarily blocked port is released, and the connection state message and the release of the temporarily blocked port message are sent to the master node.
8. A communication system for a private ring network bypassing a switch, characterized in that: The system includes at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the communication method of the bypass switch private ring network according to any one of claims 1-7.
9. A non-volatile computer-readable storage medium, characterized in that: The non-volatile computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are executed by one or more processors, the one or more processors can execute the communication method of the bypass switch private ring network according to any one of claims 1 to 7.
10. A computer program product, characterized in that The computer program product includes a computer program stored on a non-volatile computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a processor, the processor executes the communication method for a bypass switch private ring network according to any one of claims 1 to 7.