Data synchronization method for switch stacking system
By determining the master-slave switch in the switch stacking system and performing configuration information synchronization, the problem of poor data synchronization reliability is solved, and the system stability and data synchronization reliability are improved.
Patent Information
- Application Number
- CN202411768931.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2044-12-04
AI Technical Summary
There is a problem of poor reliability of data synchronization in the switch stacking system.
By obtaining the device priority and number of each switch in the switch stacking system, the master switch and the slave switch are determined, and upon receiving the join request from other switches, it determines whether it is allowed to join based on the device address and device identification, and performs the software and hardware configuration information synchronization process.
It improves the stability of the switch stacking system and the reliability of data synchronization, avoids conflicts between switches, and ensures the normal operation of the system.
Smart Images

Figure CN119254719B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of switches, and in particular to a data synchronization method for a switch stacking system. Background Art
[0002] A switch is a network device used for forwarding electrical (optical) signals. It can provide an exclusive electrical signal path for any two network nodes connected to the switch.
[0003] Stacking technology is a technology that connects multiple devices together through a medium and logically virtualizes them into one device. By stacking multiple switches into a switch stacking system, the overall scalability, reliability, throughput and management efficiency of the system can be improved. In stacking technology, data synchronization technology plays an important role in improving network performance and management efficiency, but it also faces many technical difficulties in the implementation process, resulting in poor reliability of data synchronization in the switch stacking system. Summary of the invention
[0004] The present application provides a data synchronization method for a switch stacking system, which can solve the problem of poor reliability of data synchronization.
[0005] The present application provides a data synchronization method for a switch stack system, which is applied to the switch stack system. The data synchronization method includes:
[0006] Obtaining the device priority and number of each switch in the switch stack system, and determining a master switch and multiple slave switches according to the device priorities and numbers of all switches;
[0007] When receiving a joining request from another switch that does not belong to the switch stack system, if the device address and device identifier of the other switch carried in the joining request meet the joining conditions, the other switch is allowed to join the switch stack system as a slave switch;
[0008] Execute the software configuration information synchronization process, and use the stacking software protocol message to synchronize the software configuration information of the master switch to each first slave switch; the stacking software protocol message is used to carry all the software configuration information of the master switch, and the first slave switch is the slave switch that needs to synchronize the software configuration information;
[0009] Execute the hardware configuration information synchronization process, and use the stacking hardware protocol message to synchronize the hardware configuration information of the switch stacking system to each second slave switch; the stacking hardware protocol message is used to carry the hardware configuration information, and the second slave switch is the slave switch that needs to synchronize the hardware configuration information.
[0010] Optionally, a master switch and multiple slave switches are determined according to the device priorities and numbers of all switches, including:
[0011] The switch with the highest device priority is selected as the candidate switch;
[0012] If the number of candidate switches is greater than 1, the candidate switch with the smallest number will be used as the master switch;
[0013] If the number of candidate switches is equal to 1, the candidate switch is used as the main switch;
[0014] Make each switch in the switch stack system, except the master switch, a slave switch.
[0015] Optionally, add the following conditions:
[0016] The device addresses of other switches do not conflict with the device addresses of all switches in the switch stack system, and the device identifiers of other switches do not conflict with the device identifiers of all switches in the switch stack system.
[0017] Optionally, executing a software configuration information synchronization process, synchronizing the software configuration information of the master switch to each first slave switch by using a stacking software protocol message, includes:
[0018] receiving a configuration command for indicating a target process that needs to perform information synchronization;
[0019] Encapsulate the software configuration information of the target process in the main switch into a stacking software protocol message;
[0020] The stacking software protocol message is sent to each first slave switch; the first slave switch decapsulates the received stacking software protocol message to obtain the software configuration information of the target process, and synchronizes the information of the process corresponding to the target process with itself as the software configuration information.
[0021] Optionally, the stack software protocol message includes software configuration information and a stack software protocol message header;
[0022] The stacking software protocol message header includes the device identification of all first slave switches, the device type, the command and sub-command, the configuration priority of the stacking software protocol message, the version of the stacking software protocol message, and the verification code.
[0023] Optionally, executing a hardware configuration information synchronization process, synchronizing the hardware configuration information of the switch stack system to each second slave switch using a stack hardware protocol message, includes:
[0024] The master switch obtains the hardware configuration information of the switch stack system stored on itself, and encapsulates the hardware configuration information into a stack hardware protocol message;
[0025] The stacking hardware protocol message is sent to each second slave switch by using the master switch; the second slave switch decapsulates the stacking hardware protocol message to obtain the hardware configuration information, and synchronizes its own hardware configuration information as the hardware configuration information.
[0026] Optionally, the stacking hardware protocol message includes hardware configuration information and a stacking hardware protocol message header;
[0027] The stack hardware protocol message header includes a command, a device type, and device identifiers of all second slave switches.
[0028] Optionally, the data synchronization method further includes:
[0029] Each slave switch in the switch stack system sends a first online message to the master switch at a preset period; the first online message is used to describe that the slave switch is in an online state;
[0030] For each slave switch, if the master switch does not receive the first online message sent by the slave switch at the end of the preset period, the slave switch is considered to be in an offline state, and the slave switch is removed from the switch stack system.
[0031] Optionally, the data synchronization method further includes:
[0032] The master switch in the switch stack system sends a second online message to each slave switch at a preset period; the second online message is used to describe that the master switch is in an online state;
[0033] If all slave switches do not receive the second online message sent by the master switch at the end of the preset period, the master switch is considered to be offline, and the master switch is removed from the switch stack system, and a new master switch is determined from all slave switches according to the device priority and number of all slave switches.
[0034] The above solution of the present application has the following beneficial effects:
[0035] In an embodiment of the present application, by obtaining the device priority and number of each switch in the switch stacking system, and determining the master switch and multiple slave switches according to the device priority and number of all switches, when receiving a joining request of other switches that do not belong to the switch stacking system, if the device address and device identification of other switches carried in the joining request meet the joining conditions, the other switches are allowed to join the switch stacking system as slave switches, and then the software configuration information synchronization process is executed, and the software configuration information of the master switch is synchronized to each first slave switch using the stacking software protocol message, and finally the hardware configuration information synchronization process is executed, and the hardware configuration information of the master switch is synchronized to each second slave switch using the stacking hardware protocol message. Among them, judging whether to allow other switches to join the switch stacking system according to the device address and device identification of other switches avoids conflicts between switches in the switch stacking system, improves the stability of the switch stacking system, and uses different processes and protocol messages to synchronize software configuration information and hardware configuration information respectively, which can effectively improve the reliability of data synchronization.
[0036] Other beneficial effects of the present application will be described in detail in the subsequent specific implementation section. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0038] Figure 1 A flow chart of a data synchronization method for a switch stack system provided in an embodiment of the present application;
[0039] Figure 2 A flowchart of processing of going offline from a switch provided in an embodiment of the present application;
[0040] Figure 3 A flowchart of a process of a master switch going offline provided in an embodiment of the present application;
[0041] Figure 4 A processing flow chart of adding other switches to a switch stacking system provided in an embodiment of the present application;
[0042] Figure 5 A schematic diagram of the synchronization process of software configuration information provided in an embodiment of the present application;
[0043] Figure 6 A schematic diagram of the format of a stacking software protocol message header provided in an embodiment of the present application;
[0044] Figure 7 A schematic diagram of the synchronization process of hardware configuration information provided in an embodiment of the present application;
[0045] Figure 8 A schematic diagram of the format of a stacking hardware protocol message header provided in an embodiment of the present application;
[0046] Fig. 9 A schematic diagram of a stacking packet sending process provided in an embodiment of the present application;
[0047] Fig.10 A schematic diagram of a stacking packet receiving process provided in an embodiment of the present application. DETAILED DESCRIPTION
[0048] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0049] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0050] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0051] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0052] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0053] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0054] In view of the problem of poor reliability of data synchronization in the existing switch stacking system, an embodiment of the present application provides a data synchronization method for a switch stacking system, wherein the data synchronization method obtains the device priority and number of each switch in the switch stacking system, and determines the master switch and multiple slave switches according to the device priority and number of all switches. When receiving a joining request of other switches that do not belong to the switch stacking system, if the device address and device identification of the other switches carried in the joining request meet the joining conditions, the other switches are allowed to join the switch stacking system as slave switches, and then the software configuration information synchronization process is executed, and the software configuration information of the master switch is synchronized to each first slave switch using the stacking software protocol message, and finally the hardware configuration information synchronization process is executed, and the hardware configuration information of the master switch is synchronized to each second slave switch using the stacking hardware protocol message. Among them, judging whether to allow other switches to join the switch stacking system according to the device address and device identification of other switches avoids conflicts between switches in the switch stacking system, improves the stability of the switch stacking system, and uses different processes and protocol messages to synchronize the software configuration information and the hardware configuration information respectively, which can effectively improve the reliability of data synchronization.
[0055] The data synchronization method of the switch stacking system provided in the present application is applied to the switch stacking system, and the switch stacking system is a system formed by stacking multiple switches through stacking technology.
[0056] Next, the data synchronization method of the switch stack system provided by the present application is exemplified.
[0057] like Figure 1 As shown, the data synchronization method of the switch stack system provided in the present application includes the following steps:
[0058] Step 11: Obtain the device priority and number of each switch in the switch stack system, and determine the master switch and multiple slave switches according to the device priorities and numbers of all switches.
[0059] The above device priority is configured based on the usage of the switch, such as the number of processes on the switch. The more processes there are, the higher the device priority of the switch. The process of the switch is the task running on the switch.
[0060] In some embodiments of the present application, the above step of determining the master switch and multiple slave switches according to the device priorities and numbers of all switches is specifically as follows:
[0061] In the first step, the switch with the highest device priority is selected as a candidate switch.
[0062] If the number of candidate switches is greater than 1, the candidate switch with the smallest number is selected as the master switch.
[0063] If the number of candidate switches is equal to 1, the candidate switch is used as the main switch.
[0064] The second step is to make each switch in the switch stack system, except the master switch, a slave switch.
[0065] Exemplarily, the switch stacking system includes 5 switches, wherein the device priority of the first switch and the third switch is the same and higher than that of the other three switches, then the first switch and the third switch are both used as candidate switches, the number of the first switch is smaller than the number of the third switch, the first switch is used as the master switch, and the second switch, the third switch, the fourth switch, and the fifth switch are all slave switches.
[0066] Step 12: when a joining request of another switch that does not belong to the switch stack system is received, if the device address and device identifier of the other switch carried in the joining request meet the joining condition, the other switch is allowed to join the switch stack system as a slave switch.
[0067] The above joining conditions are: the device addresses of other switches do not conflict with the device addresses of all switches in the switch stacking system, and the device identifiers of other switches do not conflict with the device identifiers of all switches in the switch stacking system.
[0068] Exemplarily, the above-mentioned non-conflict between device addresses specifically means: the device address is a legal address and is different from all other device addresses in the stacking system, such as a switch with a device address of 000000000001 does not conflict with a stacking system composed of two switches with device addresses of 000000000000 and 000000000003. The non-conflict between device identifiers specifically means: the device identifier is within a set range, and the device address is different from other device identifiers in the stacking system, such as the maximum number of stacking devices is configured to be 6, the valid identifiers are 0 to 5, and the switch with a device identifier of 3 does not conflict with a stacking system composed of three switches with device identifiers of 1, 4, and 5.
[0069] It should be noted that, in the switch stacking system, each slave switch in the switch stacking system sends a first online message to the master switch at a preset period, and the first online message is used to describe that the slave switch is in an online state. For each slave switch, if the master switch does not receive the first online message sent by the slave switch at the end of the preset period, the slave switch is considered to be in an offline state, and the slave switch is removed from the switch stacking system. The preset time period is greater than the preset period.
[0070] The master switch in the switch stacking system sends a second online message to each slave switch at a preset period. The second online message is used to describe that the master switch is in an online state. If all slave switches do not receive the second online message sent by the master switch at the end of the preset period, the master switch is considered to be in an offline state, and the master switch is removed from the switch stacking system, and a new master switch is determined from all slave switches according to the device priority and number of all slave switches. Specifically, according to the process of determining the master switch in step 11, a new master switch is determined from all slave switches.
[0071] Exemplarily, the preset period is 10 minutes, the slave switch sends a first online message to the master switch once per minute, and the master switch sends a second online message to all slave switches once per minute. If the master switch does not receive the first online message sent by the slave switch at the end of 10 minutes, the switch is removed. If all slave switches do not receive the second online message sent by the master switch at the end of 10 minutes, the master switch is removed and a new master switch is determined.
[0072] It should be noted that after determining the new master switch, the new master switch needs to reset part of the configuration bound to the data of the original switch stack system, and then compare its existing configuration with the configuration information of the device backup, and send or update its own configuration to keep its existing information consistent with the configuration information of the original master switch. In this process, while the new master switch completes the operation of its own hardware table items, it synchronously sends it to the slave switch to complete the operation of the slave switch hardware table items. After completing the configuration reset, the new master switch verifies whether its own software table items are consistent with the slave switch (theoretically, the configurations of the new master switch and the slave switch are consistent with the configuration of the original master switch, and the configurations are generally synchronized at this stage). If they are inconsistent, the configuration of the slave switch is updated to keep the configurations of the master and slave switches consistent.
[0073] It is worth mentioning that judging whether to allow other switches to join the switch stacking system based on the device addresses and device identifiers of other switches avoids conflicts between switches in the switch stacking system and improves the stability of the switch stacking system. Determining whether a switch is offline by sending messages and taking corresponding measures for offline switches can ensure the normal operation of the switch stacking system, avoid system downtime, and avoid time-consuming processing such as restarting.
[0074] The above steps are illustrated below with reference to a specific example.
[0075] The process of processing a slave device (i.e., a slave switch) going offline is as follows: Figure 2 As shown. The master device and slave device 1 (i.e., slave switch) periodically send hello messages to describe that they are online. Slave device 1 and slave device 2 also periodically send hello messages. Slave device 1 is offline, and the hello message sent by slave device 1 to the master device times out. The master device ages and times out. Slave device 1 is removed from the switch stacking system, and the stacking network topology is updated. The hello message sent by slave device 1 to slave device 2 times out, and it is determined that slave device 1 is offline. Slave device 2 maintains the slave device status, and updates the stacking topology information to form a new stacking system. Then, the master device and slave device 2 periodically send hello messages to each other.
[0076] The process of handling the main device (i.e. main switch) going offline is as follows: Figure 3As shown. The master device and slave device 1 (i.e., slave switch) periodically send hello messages to describe that they are online. Slave device 1 and slave device 2 also periodically send hello messages. The hello message sent by the master device times out, and it is determined that the master device is offline. The master device is re-elected. Slave device 1 is elected as the master device and enters the swap state (i.e., the new master switch needs to reset part of the configuration bound to the original switch stack system data, and then compare its existing configuration with the configuration information of the device backup, issue or update its own configuration, and keep its existing information consistent with the configuration information of the original master switch). Slave device 2 is not elected as the master device and remains in the slave state. Then, slave device 1 clears the original master device configuration information, and synchronously clears the configuration message to the slave device. Slave device 2 receives the processing message and clears the original master device configuration information. The new master device issues the new master device configuration information and synchronously sends the configuration message to the slave device. Slave device 2 receives the processing message and issues the new master device configuration information. The device reset is completed, and the new master device enters the master state (i.e., starts normal operation and processes related protocol messages), and periodically sends hello messages to slave device 2.
[0077] The process of adding other switches to the switch stack system is as follows: Figure 4 As shown. The joined device (i.e., the slave switch that already exists in the switch stacking system) sends hello messages to the master device (i.e., the master switch) at regular intervals. The new device (i.e., other switches) sends a discovery message (exploration message, including device information) to the master device to announce its own stacking system. The master device learns new neighbors (i.e., updates the device information in the discovery message in the neighbor topology table). After the discovery message times out, the new device enters the select state (in the election state, the role of the new device is confirmed). In the select state, the new device sends a join request message to the master device to request to join the switch stacking system. After receiving the message, the master device determines whether the new device meets the joining conditions.
[0078] If the joining conditions are met, the join message will be responded to (join message), and the new device will be allowed to join. The stacking topology information (i.e. the topology structure of the switch stacking system) will be updated. The new device allowed to join the stacking system will be confirmed as a slave device (slave switch) at this stage, and the slave device will enter syn (synchronous state, completing device information synchronization).
[0079] If the joining conditions are not met, the master device refuses to allow the new device to join the stack system and responds with a deny message (reject message). The new device becomes the new master device and the system becomes an isolated one.
[0080] If the master device is busy, it responds with a wait message. The new device waits and resends a join request message, waiting for the master device to respond. Under normal circumstances (that is, it is allowed to join the stack system), the new device changes to the syn state, requests synchronization configuration, and sends a synchronization configuration request message to the master device. Then the master device obtains the stack system configuration and sends it to the slave device. The new device saves the configuration information sent by the master device and sends the configuration. After the synchronization is completed, the new device enters the slave device state and starts normal operation. The new device and the master device send hello messages periodically.
[0081] Step 13: execute the software configuration information synchronization process, and synchronize the software configuration information of the master switch to each first slave switch using stacking software protocol messages.
[0082] The stacking software protocol message is used to carry all software configuration information of the master switch, and the first slave switch is a slave switch that needs to synchronize software configuration information. The software configuration information includes data such as structures, linked lists, and global variables maintained by the switch process.
[0083] In some embodiments of the present application, the above-mentioned execution software configuration information synchronization process, the steps of synchronizing the software configuration information of the master switch to each first slave switch using the stacking software protocol message are:
[0084] The first step is to receive a configuration command for indicating a target process that needs to perform information synchronization.
[0085] It should be noted that the above configuration command may be issued to the master switch by the administrator of the switch stack system through a serial port, a network management interface, etc. There may be multiple target processes.
[0086] The second step is to encapsulate the software configuration information of the target process in the master switch into a stacking software protocol message.
[0087] The stacking software protocol message includes software configuration information and a stacking software protocol message header. The stacking software protocol message header includes the device identification, device type, command and sub-command of all first slave switches, the configuration priority of the stacking software protocol message, the version of the stacking software protocol message, and the checksum. The encapsulation frame type of the stacking software protocol message is 0x1386. The device identification is a unique number of the device, which is used to distinguish different devices. The device type is represented by the device model (i.e., the model of the device sending the message). The command and sub-command are represented by the number of the command and its sub-command, which is used to distinguish different commands when parsing the command and make corresponding processing. The configuration priority is represented by the priority of this protocol message. The message that needs to be processed first can be configured with a high priority and forwarded and processed first in the stacking system. The version is represented by the version of this protocol message. The checksum is calculated and generated based on the message content.
[0088] The third step is to send the stacking software protocol message to each first slave switch.
[0089] The first slave switch decapsulates the received stacking software protocol message to obtain the software configuration information of the target process, and synchronizes the information of the process corresponding to the target process with the information of the process itself as the software configuration information.
[0090] Exemplarily, the target process is a port mirroring function, such as Figure 5 As shown, the administrator transmits the configuration command to the serial port, management port, etc. of the master device (i.e., the master switch) through the management interface such as CLI and web. After receiving the configuration command, the master device sends the configuration command message to the mirror process through the API call. After receiving the configuration command message, the mirror process records its own software configuration information, and encapsulates the software configuration information into a stacking message (i.e., a stacking software protocol message) through the stacking process, and sends the stacking message to the slave device (i.e., the first slave switch) through the stacking port. The slave device decapsulates the stacking message through the stacking process to obtain the software configuration information, and synchronizes the information of its own mirroring process to the software configuration information. Figure 5 The code for the configuration command in the embodiment shown is:
[0091] mirror group 1 destination-interface ethernet 1 / 0 / 46;
[0092] mirror group 1 source-interface ethernet 0 / 0 / 2 ethernet 1 / 0 / 12ethernet 2 / 0 / 22 ingress;
[0093] mirror group 1 source-interface ethernet 0 / 0 / 2 ethernet 1 / 0 / 12ethernet 2 / 0 / 22 egress.
[0094] The stacking process performs corresponding processing according to the command and subcommand in the stacking software protocol message. Exemplarily, the code of the command is:
[0095] / Command Type /
[0096] Typedef enum ISTK_CMD_tag{
[0097] ISTK_CMD_PROTOCOL = 0, / Stack flow commands /
[0098] ISTK_CMD_DRIVER, / Virtual Drive Interface /
[0099] ISTK_CMD_SYN, / Synchronization message /
[0100] ISTK_CMD_CONFIG, / Configuration Synchronization /
[0101] ISTK_CMD_EVENT, / The switch's MAC address, port link status, and other time /
[0102] ISTK_CMD_BIGBUFF, / Run configuration, app, bootrom and other large file transfers /
[0103] ISTK_CMD_SYN_SOFTWARE, / Synchronous software table /
[0104] ISTK_CMD_MAX / Need to use the array size in g_igubCmdMaxNum /
[0105] }ISTK_CMD.
[0106] The subcommand code is:
[0107] / Subcommand types for ISTK_CMD_DRIVER /
[0108] Typedef enum ISTK_SUBCMD_DRIVER_tag{
[0109] ISTK_SUBCMD_DRIVER_CONFIG,
[0110] ISTK_SUBCMD_DRIVER_RESPONSE,
[0111] ISTK_SUBCMD_DRIVER_MAX / Need to be used in order in g_igubCmdMaxNum /
[0112] }ISTK_SUBCMD_DRIVER;
[0113] / Subcommand type of ISTK_CMD_BIGBUFF /
[0114] Typedef enum ISTK_SUBCMD_BIGBUFF_tag{
[0115] ISTK_SUBCMD_BIGBUFF_CONFIG,
[0116] ISTK_SUBCMD_BIGBUFF_STATUS,
[0117] ISTK_SUBCMD_BIGBUFF_RESPONSE,
[0118] ISTK_SUBCMD_BIGBUFF_MAX / Need to be used in order in g_igubCmdMaxNum /
[0119] }ISTK_SUBCMD_BIGBUFF;
[0120] / Subcommand type of ISTK_CMD_BIGBUFF /
[0121] Typedef enum ISTK_SUBCMD_SYN_SOFTWARE_tag{
[0122] ISTK_SUBCMD_SYN_SOFTWARE_CONFIG, / Synchronize smd MsgRequestByName configuration message /
[0123] ISTK_SUBCMD_SYN_SOFTWARE_MAX / Need to be used in order in g_igubCmdMaxNum /
[0124] }ISTK_SUBCMD_SYN_SOFTWARE.
[0125] The stacking software protocol message header is exemplarily described below with reference to a specific example.
[0126] The format of the stack software protocol message header is as follows: Figure 6 As shown in the figure, Destination Mac represents the Mac information of the destination device (i.e., the first slave switch that needs to synchronize software information), Source Mac represents the Mac information of the source device (i.e., the master switch that sends the stacking software protocol message), Ether Type represents the type of Layer 2 network frame, Verison represents the version of this protocol (stacking software protocol) used, Command represents the command number to be executed, SubCommand represents the subcommand number to be executed, the Flags field represents the message processing action, DeviceType represents the device (switch) type, DeviceID represents the unique identifier of the device (ranging from 0 to the maximum number of devices minus 1), Hops represents the number of devices the message passes through, DevicePort represents the message sending port, Priority represents the message priority, AuthenType represents the message authentication method, Authen Info represents the message authentication information, Stack ID represents the switch stacking system unique identifier, and PacketLength represents the message length.
[0127] Step 14: Execute the hardware configuration information synchronization process, and synchronize the hardware configuration information of the switch stack system to each second slave switch using a stack hardware protocol message.
[0128] The above stacking hardware protocol message is used to carry hardware configuration information, and the second slave switch is a slave switch that needs to synchronize hardware configuration information. The above hardware configuration information is the hardware configuration generated by configuring the switch stacking system before use. The hardware configuration information includes hardware table items for recording the register type and table item type of the switch. The table item type is used to describe the table item class data in the switch. The table item class data of all switches in the switch stacking system should be consistent. Taking the mac address table as an example, manually bind a mac address table item. The master switch synchronizes the configuration message to the slave switch, and the master and slave switches send it to their own hardware table items to keep the master and slave switch table items consistent and maintain normal operation of the system.
[0129] The above-mentioned steps of synchronizing the hardware configuration information of the master switch to each second slave switch by using the stacking hardware protocol message are specifically as follows:
[0130] In the first step, the master switch obtains the hardware configuration information of the switch stack system stored on itself, and encapsulates the hardware configuration information into a stack hardware protocol message.
[0131] In the second step, the master switch is used to send the stacking hardware protocol message to each second slave switch.
[0132] The second slave switch decapsulates the stacking hardware protocol message to obtain hardware configuration information, and synchronizes its own hardware configuration information as the hardware configuration information.
[0133] It should be noted that the stacking hardware protocol message includes hardware configuration information and a stacking hardware protocol message header. The encapsulation frame type of the stacking hardware protocol message is 0x1387.
[0134] The stack hardware protocol message header includes the command, device type, and device identifiers of all second slave switches. The command is represented by the command number of the hardware configuration, which is used to distinguish different hardware configuration commands. The device type is represented by the device model (i.e., the model of the device sending the message).
[0135] Exemplarily, the synchronization process of hardware configuration information is as follows: Figure 7 As shown, since the stacking hardware protocol message is encapsulated in the driver layer of the switch stacking system, the driver function (such as using the VD interface function in this example) can be directly called to send the stacking hardware protocol message to the master switch. In this embodiment, the master switch processes the stacking software protocol message through the system maintenance process and the stacking process, parses the stacking software protocol message, obtains the hardware configuration command, generates hardware configuration information, and encapsulates the generated hardware configuration information into a stacking hardware protocol message, and sends the stacking hardware protocol message to the slave switch through the stacking port. The slave switch processes the stacking hardware protocol message through the stacking process, obtains the hardware configuration information carried in the stacking hardware protocol message, and synchronizes its own hardware configuration information with the hardware configuration information carried in the message. Figure 7 The transmission process of stack hardware protocol messages during hardware configuration information synchronization is shown in the figure. Figure 7 The code for the configuration command in the embodiment shown is:
[0136] mirror group 1 destination-interface ethernet 1 / 0 / 46;
[0137] mirror group 1 source-interface ethernet 0 / 0 / 2 ethernet 1 / 0 / 12ethernet 2 / 0 / 22 ingress;
[0138] mirror group 1 source-interface ethernet 0 / 0 / 2 ethernet 1 / 0 / 12ethernet 2 / 0 / 22 egress.
[0139] The stack hardware protocol message sends hardware configuration information to the hardware according to the command in it. The code of the command is:
[0140] / Command Type /
[0141] typedef enum ISTK_SMD_CMD_tag{
[0142] ISTK_SMD_CMD_PORT_CHG = 0, / Port change command /
[0143] ISTK_SMD_CMD_PORT_LINK_UPDATE, / *Synchronously update port_link status /
[0144] ISTK_SMD_CMD_MAX, / You can add command types in front of it later if needed. /
[0145] }ISTK_SMD_CMD.
[0146] The above stacking hardware protocol message header is exemplarily described below with reference to a specific example.
[0147] The format of the stack hardware protocol message header is as follows: Figure 8 As shown in the figure, Destination Mac represents the Mac information of the destination device (the second slave switch that needs to synchronize hardware configuration information), Source Mac represents the Mac information of the source device (the master switch that sends the stacking hardware protocol message), Ether Type represents the Layer 2 frame type, Verison represents the protocol version (stack hardware protocol) used, Command represents the command number to be processed, DeviceType represents the device (switch) type, and Packet Length represents the message length.
[0148] It is worth mentioning that whether other switches are allowed to join the switch stacking system is determined based on the device addresses and device identifiers of other switches, which avoids conflicts between switches in the switch stacking system and improves the stability of the switch stacking system. Different processes and protocol messages are used to synchronize software configuration information and hardware configuration information respectively, which can effectively improve the reliability of data synchronization.
[0149] The data synchronization method of the present application is exemplarily described below with reference to a specific example.
[0150] The process of stack packet sending (i.e. encapsulating packets to obtain stack software protocol packets or stack hardware protocol packets) is as follows: Fig. 9As shown, after the stack sends the packet, it determines the type of message to be encapsulated. If it is a stack protocol message (that is, a stack software protocol message), the message content is encapsulated, and then the stack protocol header is encapsulated, and the command, sub-command, packet receiving device ID and other fields are added. The configuration version, priority, fill in the check code, etc., the frame type is encapsulated as 0x1386, and then the local stack port is obtained. The interface calls the notification driver layer for processing. If it is a stack SDK communication protocol message (that is, a stack hardware protocol message), the message content is encapsulated, and then the stack protocol header is encapsulated, and the command, sub-command, packet receiving device ID and other fields are added. The frame type is encapsulated as 0x1387, and then the local stack port is obtained, and the driver function is called to send the packet.
[0151] After a stacking device (i.e., the master and slave switches in a switch stacking system) receives stacking packets from other devices to its stacking port, it enters the stacking packet receiving process and completes the corresponding operation. Non-stacked packets follow the non-stacked packet process, and packets with device or port errors are not processed.
[0152] The stack packet receiving process (i.e. after receiving the message from the switch) is as follows: Fig.10 As shown, after the stack receives the packet, it determines the frame type. If the frame type is 0x1386, it checks whether the device ID, check code, version and other information in the message are correct. If they are correct, it notifies the stack process to process the stack protocol message, parses the command and sub-command, searches for the command parsing function and processes it. If the frame type is 0x1387, it checks whether the device ID, version and other information in the message are correct. If they are correct, it parses the command and sub-command, searches for the command parsing function and processes it.
[0153] Taking the port status change as an example, there are two commands in the stack hardware protocol message: port change command (PORT_CHG) and port link status list synchronization (PORT_LINK_UPDATE).
[0154] The port change command (PORT_CHG) is responsible for processing port status changes within the switch stacking system, such as (UP->DOWN). After the switch port status changes, the driver layer triggers a link change event, which is then passed to the AP and ag layers for processing. The AP and AP layers notify the registration module of the port change and notify other switches in the stacking system of the port status change through the stacking protocol message PORG_CHG command.
[0155] Port link status list synchronization (PORT_LINK_UPDATE) enables other switches to synchronize their own link status lists. This command is initiated by the master switch and is used to synchronize the link status records of the master and slave switches, so that after the master-slave switch, each switch in the new stack system can correctly set the system's port link status.
[0156] The above is a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles described in the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A data synchronization method for a switch stacking system, applied to a switch stacking system, characterized in that: include: Obtaining the device priority and number of each switch in the switch stack system, and determining a master switch and multiple slave switches according to the device priorities and numbers of all switches; When receiving a joining request from another switch that does not belong to the switch stack system, if the device address and device identifier of the other switch carried in the joining request meet the joining condition, allowing the other switch to join the switch stack system as a slave switch; Execute the software configuration information synchronization process, and use the stacking software protocol message to synchronize the software configuration information of the master switch to each first slave switch; the stacking software protocol message is used to carry all the software configuration information of the master switch, and the first slave switch is a slave switch that needs to synchronize the software configuration information; Execute the hardware configuration information synchronization process, and use the stacking hardware protocol message to synchronize the hardware configuration information of the switch stacking system to each second slave switch; the stacking hardware protocol message is used to carry the hardware configuration information, and the second slave switch is a slave switch that needs to synchronize the hardware configuration information.
2. The data synchronization method according to claim 1, characterized in that: The step of determining the master switch and the plurality of slave switches according to the device priorities and numbers of all switches includes: The switch with the highest device priority is selected as the candidate switch; If the number of candidate switches is greater than 1, the candidate switch with the smallest number will be used as the master switch; If the number of candidate switches is equal to 1, the candidate switch is used as the main switch; Make each switch in the switch stack system, except the master switch, a slave switch.
3. The data synchronization method according to claim 1, characterized in that: The joining conditions are: The device addresses of the other switches do not conflict with the device addresses of all switches in the switch stacking system, and the device identifiers of the other switches do not conflict with the device identifiers of all switches in the switch stacking system.
4. The data synchronization method according to claim 1, characterized in that: The execution software configuration information synchronization process, using stacking software protocol messages to synchronize the software configuration information of the master switch to each first slave switch, includes: receiving a configuration command for indicating a target process that needs to perform information synchronization; Encapsulating the software configuration information of the target process in the master switch into a stacking software protocol message; The stacking software protocol message is sent to each first slave switch; the first slave switch decapsulates the received stacking software protocol message to obtain the software configuration information of the target process, and synchronizes the information of the process corresponding to the target process with the information of the first slave switch as the software configuration information.
5. The data synchronization method according to claim 4, characterized in that: The stack software protocol message includes software configuration information and a stack software protocol message header; The stacking software protocol message header includes the device identification, device type, command and sub-command of all first slave switches, the configuration priority of the stacking software protocol message, the version of the stacking software protocol message, and a verification code.
6. The data synchronization method according to claim 1, characterized in that: The execution of the hardware configuration information synchronization process, using the stacking hardware protocol message to synchronize the hardware configuration information of the switch stacking system to each second slave switch, includes: The master switch obtains the hardware configuration information of the switch stack system stored on itself, and encapsulates the hardware configuration information into a stack hardware protocol message; The stacking hardware protocol message is sent to each of the second slave switches by using the master switch; the second slave switches decapsulate the stacking hardware protocol message to obtain the hardware configuration information, and synchronize their own hardware configuration information as the hardware configuration information.
7. The data synchronization method according to claim 6, characterized in that: The stacking hardware protocol message includes hardware configuration information and a stacking hardware protocol message header; The stacking hardware protocol message header includes a command, a device type, and device identifiers of all second slave switches.
8. The data synchronization method according to claim 1, characterized in that: The data synchronization method further includes: Each slave switch in the switch stacking system sends a first online message to the master switch at a preset period; the first online message is used to describe that the slave switch is in an online state; For each of the slave switches, if the master switch does not receive the first online message sent by the slave switch at the end of the preset period, the slave switch is considered to be in an offline state, and the slave switch is removed from the switch stack system.
9. The data synchronization method according to claim 8, characterized in that: The data synchronization method further includes: The master switch in the switch stack system sends a second online message to each of the slave switches at the preset period; the second online message is used to describe that the master switch is in an online state; If all slave switches do not receive the second online message sent by the master switch at the end time of the preset period, the master switch is considered to be in an offline state, the master switch is removed from the switch stack system, and a new master switch is determined from all slave switches according to the device priorities and numbers of all slave switches.
Citation Information
Patent Citations
Stack system and hardware resource management method for stack switch
CN106789157A
MAC (Media Access Control) address synchronization method for multi-switch chip stacking in hardware learning mode
CN114884878A