A port configuration method and device of a switch, an electronic device, and a storage medium

CN117834434BActive Publication Date: 2026-10-23INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311862387.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-29
Publication Date
2026-10-23
Estimated Expiration
2043-12-29

AI Technical Summary

Technical Problem

目前,现有的Smart Link协议可以判断主端口是否出现故障并切换到备用端口,但无法得知上行交换机非直连端口的故障情况,导致主链路不通,数据丢失

Benefits of technology

[0041]本申请对主交换机和备交换机的端口在两种不同的情况下进行monitor-link的配置,通过配置主交换机和备交换机的端口,以及监控组的设置,实现对整个网络的可靠性管理,当发生脑裂情况时,可以监测和切换故障端口,确保数据包的转发路径可控和可靠。通过配置不同的上行和下行端口,对数据包进行负载均衡的管理,根据实时流量模式和网络负载调整数据包的发送路径,确保网络中的数据流量分布均匀,提高网络的性能和效率。通过灵活运用monitor-link组的配置,可以根据实际情况对数据包的转发路径进行调整和控制。当主交换机和备交换机处于不同状态时,可以根据服务器的实时流量模式和网络负载调整数据包的发送路径,实现灵活的网络管理。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117834434B_ABST
    Figure CN117834434B_ABST
Patent Text Reader

Abstract

The application discloses a port configuration method of a switch, which comprises the following steps: configuring a first port, a third port and a first peer-link port as a first monitor-link group, and configuring a second port, a fourth port and a second peer-link port as a second monitor-link group; in the case that a server transmits a data packet to a core layer device, configuring the first port as an uplink port, and configuring the third port and the first peer-link port as downlink ports; on a backup switch, configuring the second port as an uplink port, and configuring the fourth port and the second peer-link port as downlink ports; on a master switch, configuring the third port as an uplink port, and configuring the first port and the first peer-link port as downlink ports; and on the backup switch, configuring the fourth port as an uplink port, and configuring the second port and the second peer-link port as downlink ports. By using the configuration method, the problem that a data forwarding path is uncertain after mlag brain split is solved, and the controllability of the forwarding path after mlag brain split is realized through flexible use of the monitor-link.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of network communication technology, specifically to a port configuration method, apparatus, electronic device, and storage medium for a switch. Background Technology

[0002] MLAG stands for Multi-Chassis Link Aggregation, which is the ability of two or more switches to function like a single switch when forming a link bundle. This allows a host to connect to two switches for physical diversity, managed by a single bundled interface. Similarly, two switches can use MLAG to connect to two other switches and forward all links. MLAG can increase the maximum bandwidth of the link aggregation interface, improve its reliability, and achieve load balancing. Currently, the existing Smart Link protocol can detect failures in the primary port and switch to a backup port, but it cannot detect failures in non-directly connected ports of the upstream switch, leading to primary link outages and data loss. The Smart Link protocol can only perform failover between directly connected ports and cannot monitor and switch indirectly connected ports. Therefore, in large-scale networks, the Smart Link protocol cannot achieve comprehensive network reliability and load balancing management. Currently, in the event of a split-brain scenario between primary and backup switches, the uncertain packet forwarding path presents shortcomings such as complex configuration, high network construction costs, and low reliability. These shortcomings limit network performance and reliability, necessitating a technology to address these issues. Summary of the Invention

[0003] One of the purposes of this application is to provide a port configuration method, apparatus, electronic device, and storage medium for a switch to solve the aforementioned technical problems.

[0004] To achieve the above objectives, the technical solution adopted in this application is as follows:

[0005] In a first aspect, embodiments of this application provide a port configuration method for a switch. This method is applied to configure ports of an access layer switch in a packet forwarding system. The packet forwarding system includes: a core layer device, an access layer switch, and a server; the access layer switch includes a primary switch and a backup switch; the method includes:

[0006] Configure the first port, third port, and first peer-link port of the main switch as the first monitor-link group, and configure the second port, fourth port, and second peer-link port of the backup switch as the second monitor-link group;

[0007] When the server transmits data packets to the core layer device, on the main switch, the first port is configured as an uplink port, and the third port and the first peer-link port are configured as downlink ports; on the backup switch, the second port is configured as an uplink port, and the fourth port and the second peer-link port are configured as downlink ports.

[0008] When the peer-link link between the first peer-link port and the second peer-link port is disconnected, the server sends data packets to the core layer device through a first transmission path or a second transmission path. The first transmission path is a path from the third port of the main switch to the first port and then forwarded to the core layer device. The second transmission path is a path from the fourth port of the backup switch to the second port and then forwarded to the core layer device.

[0009] Optionally, the method further includes:

[0010] When the core layer device transmits data packets to the server, on the main switch, the third port is configured as an uplink port, and the first port and the first peer-link port are configured as downlink ports;

[0011] On the backup switch, the fourth port is configured as an uplink port, and the second port and the second peer-link port are configured as downlink ports;

[0012] When the peer-link link between the first peer-link port and the second peer-link port is disconnected, the core layer device sends data packets to the server through a third transmission path or a fourth transmission path. The third transmission path is a path from the first port of the master switch to the third port and forwarded to the server, and the fourth transmission path is a path from the second port of the backup switch to the fourth port and forwarded to the server.

[0013] Optionally, if the number of servers is one, the method further includes:

[0014] The first monitor-link group monitors whether all uplink ports within the group are in a down state; when the first monitor-link group detects that all uplink ports within the group are in a down state, it sets all downlink ports within the first monitor-link group to a down state.

[0015] The second monitor-link group monitors whether all uplink ports within the group are in a down state; when the second monitor-link group detects that all uplink ports within the group are in a down state, it sets all downlink ports within the second monitor-link group to a down state.

[0016] Optionally, if the number of servers is one, the method further includes:

[0017] The first monitor-link group monitors whether at least one uplink port in the group changes from a down state to an up state.

[0018] When the first monitor-link group detects that at least one uplink port in the group has changed from down to up, it sets all downlink ports in the first monitor-link group to up.

[0019] The second monitor-link group monitors whether at least one uplink port in the group changes from a down state to an up state.

[0020] When the second monitor-link group detects that at least one uplink port in the group has changed from a down state to an up state, it sets all downlink ports in the second monitor-link group to the up state.

[0021] Optionally, when the number of servers is multiple, the method further includes:

[0022] The first monitor-link group monitors whether at least one uplink port in the group is in a down state.

[0023] When the first monitor-link group detects that at least one uplink port in the group is in a down state, it sets all downlink ports in the first monitor-link group to a down state.

[0024] The second monitor-link group monitors whether at least one uplink port in the group is in a down state.

[0025] When the second monitor-link group detects that at least one uplink port in the group is in a down state, it sets all downlink ports in the second monitor-link group to a down state.

[0026] Optionally, when the number of servers is multiple, the method further includes:

[0027] The first monitor-link group monitors whether all uplink ports within the group have returned to the up state;

[0028] When the first monitor-link group detects that all uplink ports in the group have returned to the up state, it sets all downlink ports in the first monitor-link group to the up state.

[0029] The second monitor-link group monitors whether all uplink ports within the group have returned to the up state;

[0030] When the second monitor-link group detects that all uplink ports in the group have returned to the up state, it sets all downlink ports in the first monitor-link group to the up state.

[0031] Optionally, the method further includes:

[0032] Monitor the status of the peer-link link between the first peer-link port and the second peer-link port;

[0033] When the peer-link is detected to be in a connected state, data packet transmission between the core layer device and the server is carried out based on the peer-link.

[0034] Secondly, embodiments of this application provide a port configuration device for a switch, used to configure ports of an access layer switch in a packet forwarding system. The packet forwarding system includes: a core layer device, an access layer switch, and a server; the access layer switch includes a primary switch and a backup switch; the primary switch has a first port, a third port, and a first peer-link port; the backup switch has a second port, a fourth port, and a second peer-link port; the device includes:

[0035] The first configuration module is configured to configure the first port, third port and first peer-link port of the master switch as the first monitor-link group, and configure the second port, fourth port and second peer-link port of the backup switch as the second monitor-link group.

[0036] The second configuration module is configured to, when the server transmits data packets to the core layer device, configure the first port as an uplink port and the third port and the first peer-link port as downlink ports on the main switch; and configure the second port as an uplink port and the fourth port and the second peer-link port as downlink ports on the backup switch.

[0037] The transmission module is configured to send data packets to the core layer device via a first transmission path or a second transmission path when the peer-link link between the first peer-link port and the second peer-link port is disconnected. The first transmission path is a path forwarded to the core layer device through the third port and the first port of the master switch, and the second transmission path is a path forwarded to the core layer device through the fourth port and the second port of the backup switch.

[0038] Thirdly, this application proposes an electronic device, including: a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the steps of port configuration of a switch.

[0039] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of port configuration of a switch.

[0040] The technical solutions provided by the embodiments of this disclosure bring at least the following beneficial effects:

[0041] This application configures monitor-link settings for the ports of the primary and backup switches under two different conditions. By configuring the ports of the primary and backup switches and setting up monitoring groups, it achieves reliability management of the entire network. In the event of a split-brain scenario, it can monitor and switch over faulty ports, ensuring that the forwarding path of data packets is controllable and reliable. By configuring different uplink and downlink ports, it manages data packet load balancing, adjusting the data packet sending path according to real-time traffic patterns and network load, ensuring even distribution of data traffic in the network and improving network performance and efficiency. By flexibly utilizing the monitor-link group configuration, the forwarding path of data packets can be adjusted and controlled according to actual conditions. When the primary and backup switches are in different states, the data packet sending path can be adjusted according to the real-time traffic patterns of the server and network load, achieving flexible network management. Attached Figure Description

[0042] Figure 1 This is a schematic diagram illustrating the application environment of a port configuration method for a switch provided in one embodiment of this application;

[0043] Figure 2 This is a schematic diagram illustrating the application environment of another port configuration method for a switch provided in one embodiment of this application;

[0044] Figure 3 This is a flowchart of a port configuration method for a switch provided in one embodiment of this application;

[0045] Figure 4 This is a block diagram of a port configuration device for a switch provided in an embodiment of this application. Detailed Implementation

[0046] The embodiments of this application will be described below with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. This application can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application. It should be understood that the preferred embodiments are only for illustrating this application and are not intended to limit the scope of protection of this application.

[0047] The port configuration method for switches provided in this application can be applied to various network scenarios, such as large-scale networking environments, enterprise networks, or cloud computing environments. In large-scale networking environments, multiple switches and servers are typically connected. The port configuration method of this application can be used to configure the ports of access layer switches, enabling the management of the reliability and load balancing of the entire network. In enterprise networks, multiple switches and servers are typically connected. The port configuration method of this application can be used to configure access layer switches in enterprise networks, enabling the management of the reliability and load balancing of the entire network, improving the performance and reliability of the enterprise network, and ensuring the secure and efficient transmission of data. In cloud computing environments, a large number of virtual machines and physical servers are typically connected. The port configuration method of this application can be used to configure access layer switches in cloud computing environments, enabling controllable and reliable management of data packet forwarding paths, improving the performance and reliability of the cloud computing environment, and ensuring data transmission and communication between virtual machines and physical servers.

[0048] This application addresses the problem of uncontrollable packet forwarding paths after a split-brain scenario in a MLAG environment. For understanding the following text, the split-brain scenario is explained here. In a MLAG environment, the primary and backup switches need to maintain real-time communication to ensure their states are synchronized. If communication between the primary and backup switches is interrupted for some reason (e.g., network problems, equipment failure), a split-brain occurs. When a split-brain occurs, the primary and backup switches cannot share state information, and therefore they may make inconsistent decisions regarding different parts of the network. This can lead to a situation where the entire network is split-brained, with different parts believing themselves to be the effective leaders of the network. Without an effective coordination mechanism, the split-brain will cause data inconsistency because the primary and backup switches will simultaneously perform write operations on the same resources without coordination, which will lead to data corruption or loss. Figure 1 As shown, when a split-brain event occurs, it can be understood that the peer-link ports on the primary and backup switches will be in a down state, and the primary and backup switches will be unable to communicate or forward data packets.

[0049] The port configuration method for a switch provided in this application embodiment is applied to the configuration of ports of an access layer switch in a packet forwarding system. Figure 1 This is a schematic diagram illustrating the application environment of a switch port configuration method according to an embodiment of this application. The packet forwarding system is a forwarding system based on an MLAG environment. MLAG is a network configuration environment used to improve network reliability and bandwidth. In an MLAG environment, multiple switches or network devices are combined into a logical unit to achieve link aggregation and redundancy. Figure 1As shown, the packet forwarding system includes: core layer devices, access layer switches, and servers; the access layer switches include a primary switch (active) and a standby switch (standby). The primary switch has a first port, a third port, and a first peer-link port; the standby switch has a second port, a fourth port, and a second peer-link port. The core layer is a layer in the MLAG environment, ensuring network availability even when a switch or stack fails. In this embodiment, the core layer devices can be network devices such as switches and routers, which can be understood as the external network environment connected to the primary and standby switches. The primary and standby switches refer to the two switches that play primary and backup roles in the packet forwarding system. The primary switch is the main switch in the network, responsible for handling packet forwarding and routing. The standby switch takes over the functions of the primary switch when it fails or becomes unavailable, ensuring network connectivity and reliability. When the primary switch fails or becomes unavailable, the standby switch takes over the functions of the primary switch and continues to handle packet forwarding and routing. This ensures network connectivity and reliability and avoids data loss or network interruption. The primary and backup switches reside in the access layer of the MLAG environment. The main goal of the access layer is to provide network access for terminal devices and connect these devices to the core layer to achieve high availability and redundancy for the entire network. Access layer switches provide physical and logical interfaces for terminal devices (switches) to access the network. To differentiate the interfaces on the primary and backup switches, this application defines the port connected to the core layer devices on the primary switch as the first port and the port connected to the server as the third port; similarly, the port connected to the core layer devices on the backup switch is defined as the second port, and the port connected to the server as the fourth port. Both primary and backup switches have peer-link ports. For differentiation, this application defines the primary switch as having a first peer-link port and the backup switch as having a second peer-link port. The peer-link port enables data synchronization and backup between the primary and backup switches. Through the peer-link port, the primary and backup switches can transmit data packets and status information to each other to maintain network consistency and reliability. When the primary switch fails or becomes unavailable, the backup switch can take over the functions of the primary switch through the peer-link port and continue to handle data packet forwarding and routing. The forwarding system also includes servers, which are typically used to transmit data packets to core layer devices or to receive data packets transmitted by core layer devices. This transmission is bidirectional, and users need to configure the corresponding monitor-link function on the primary and backup switches based on the direction of data packet transmission. This will be explained in detail later.There can be one or multiple servers. In most cases, data packets are sent by the server, so the server typically plays the role of providing services and resources. It can be a computer used for storing and processing data, or a device used to provide network services, such as a web server or database server. In the embodiments of this application, the server supports the normal operation and communication of the network throughout the mlag environment. The server can have two modes, A and B, which can be understood as the server itself selecting the primary and backup links for sending data. Normally, the server uses mode A, that is, using the primary link to interact with the access layer switch. When the primary link fails, the server activates mode B, and starts interacting with the access layer switch using the backup link.

[0050] Based on the aforementioned packet forwarding system, this application proposes a port configuration method for a switch. Figure 3 This is a flowchart illustrating a port configuration method for a switch according to one embodiment of this application, as shown below. Figure 3 As shown, the method includes:

[0051] Step S101: Configure the first port, third port and first peer-link port of the main switch as the first monitor-link group, and configure the second port, fourth port and second peer-link port of the backup switch as the second monitor-link group.

[0052] In step S102, when the server transmits data packets to the core layer device, on the main switch, the first port is configured as an uplink port, and the third port and the first peer-link port are configured as downlink ports; on the backup switch, the second port is configured as an uplink port, and the fourth port and the second peer-link port are configured as downlink ports.

[0053] In step S103, when the peer-link link between the first peer-link port and the second peer-link port is disconnected, the server sends a data packet to the core layer device through a first transmission path or a second transmission path. The first transmission path is the path from the third port of the main switch to the first port and forwarded to the core layer device, and the second transmission path is the path from the fourth port of the backup switch to the second port and forwarded to the core layer device. Regarding step S101, a monitor link group, also called a monitoring link group, consists of uplink ports and downlink ports. A monitor link group can have multiple uplink ports or downlink ports, but a port can only belong to one monitor link group. The monitor link group is used to monitor the status of the uplink ports and set the status of the downlink ports based on the monitoring results. In this embodiment, the first port, third port, and first peer-link port of the main switch are configured as the first monitor link group, and the second port, fourth port, and second peer-link port of the backup switch are configured as the second monitor link group. The first monitor-link group and the second monitor-link group are two independent groups used to monitor and manage the port status of access layer switches. They monitor the status of uplink ports and set the status of downlink ports based on the monitoring results.

[0054] In step S102, the main switch is configured as follows: the first port is configured as an uplink port, and the third port and the first peer-link port are configured as downlink ports. This means that server packets will be sent to the main switch through the first port, and then forwarded to the downlink device through the third port or the first peer-link port. Simultaneously, the backup switch is configured as follows: the second port is configured as an uplink port, and the fourth port and the second peer-link port are configured as downlink ports. This means that server packets will be sent to the backup switch through the second port, and then forwarded to the downlink device through the fourth port or the second peer-link port. This configuration ensures that packets transmitted from the server to the core layer devices are forwarded according to the designed forwarding path, thereby achieving controllability and predictability of the forwarding path after a split-brain scenario. This configuration scheme improves network reliability and performance and simplifies subsequent maintenance.

[0055] In step S103, when the peer-link link between the first peer-link port and the second peer-link port is disconnected, the server sends a data packet to the core layer device through a first transmission path or a second transmission path. The first transmission path is a path from the third port of the main switch to the first port and then forwarded to the core layer device. The second transmission path is a path from the fourth port of the backup switch to the second port and then forwarded to the core layer device.

[0056] This step involves the background of LACP negotiation. LACP (Link Aggregation Control Protocol) negotiation is a protocol used to establish link aggregation between network devices. Link aggregation bundles multiple physical links into a single logical link to increase bandwidth and improve reliability. During LACP negotiation, devices send LACPDUs to negotiate link aggregation. When the link aggregation parameters and states of two devices are consistent, the link aggregation is established. LACP allows devices to dynamically negotiate the parameters and states of link aggregation, ensuring that aggregation can be adaptively established or revoked when the network changes. In this embodiment of the invention, if the server needs to send data packets to the core layer device, both the server and the core layer device will select their respective primary and backup links through LACP negotiation. It is important to note that the primary and backup links are different from the links where the primary and backup switches reside. As explained earlier regarding the server's A / B mode, the primary and backup links can be understood as the server's A / B mode. In other words, LACP negotiation is equivalent to the server and the core layer device each choosing between the primary switch and the backup switch for data transmission. During LACP negotiation, the selection of primary and backup links involves considerations of link load balancing and redundancy to optimize network performance. When the peer-link link between the first and second peer-link ports breaks (i.e., a split-brain scenario occurs), to avoid data packets being forwarded through the peer-link port, the downlink port where the server resides passively selects the uplink port as the data packet transmission path. If the server passively selects the third downlink port, it will choose the first transmission path to send data packets to the core layer device; if it passively selects the fourth downlink port, it will choose the second transmission path. Here, the first and second transmission paths have the same transmission direction but different transmission paths. Similarly, when a split-brain scenario occurs, the core layer device sends data packets to the server through the third or fourth transmission path, also for the same reasons, which will not be elaborated further here. This method allows data packets to be processed and forwarded directly on the primary or backup switch, even in a split-brain scenario, without going through the peer-link, thus improving network availability in split-brain situations.

[0057] Considering that data packet transmission between the server and the core layer device is bidirectional, this application embodiment proposes that the method further includes: step S201, when the core layer device transmits data packets to the server, on the main switch, the third port is configured as an uplink port, and the first port and the first peer-link port are configured as downlink ports; on the backup switch, the fourth port is configured as an uplink port, and the second port and the second peer-link port are configured as downlink ports; when the peer-link link between the first peer-link port and the second peer-link port is disconnected, the server sends data packets to the core layer device through a first transmission path or a second transmission path, wherein the first transmission path is a path from the third port of the main switch to the first port and forwarded to the core layer device, and the second transmission path is a path from the fourth port of the backup switch to the second port and forwarded to the core layer device.

[0058] Users will configure different monitor-link functions for the primary and backup switches for different data packet transmission directions. Uplink ports and downlink ports are two port roles within the Monitor Link group: the uplink port, also known as the Uplink port, is the port monitored within the Monitor Link group, and the state of the Monitor Link group is linked to it. When the up / down state of the Monitor Link group changes, the state of the downlink port will change accordingly, thus maintaining consistency with the state of the Monitor Link group. Based on this linkage logic, this application embodiment proposes that, when the number of servers is one, the method further includes: step S201, the first monitor-link group monitors whether all uplink ports within the group are in a down state; when the first monitor-link group detects that all uplink ports within the group are in a down state, it sets all downlink ports within the first monitor-link group to a down state; the second monitor-link group monitors whether all uplink ports within the group are in a down state; when the second monitor-link group detects that all uplink ports within the group are in a down state, it sets all downlink ports within the second monitor-link group to a down state.

[0059] Based on the configurations in steps S101 and S102, the uplink and downlink port linkage logic described in step S201 is explained as follows.

[0060] When an access layer switch connects to only one core layer device, when a data packet is sent from the server to the core layer device, after configuration in step S102, the first port (eh1) and the second port (eh2) are configured as uplink ports, while the peer-link port, the third port (eh3), and the fourth port (eh4) are configured as downlink ports. First, the access layer device and the server each negotiate using LACP to select one port from the primary or backup switch as the transmission path. Through LACP negotiation, dynamic management and automatic configuration of link aggregation can be achieved, improving network reliability and performance. Simultaneously, LACP also supports link failure detection and failover; when a link fails, it can automatically switch to another normal link to ensure continuous data transmission. Figure 1 As shown, before a split-brain scenario occurs, if the server selects the third port of the primary switch and the core layer device selects the second port of the backup switch after LACP negotiation, then data packets will be forwarded between the primary and backup switches via the peer-link port. However, if a split-brain scenario occurs, i.e., the peer-link port is down, then data packet loss will occur. To solve this problem, this application specifies the following monitor-link logic: when the monitor-link group detects that all uplink ports within the group are down, it sets all downlink ports within the monitor-link group to a down state. Returning to the previous example, if the core layer device selects the second port of the backup switch as its uplink port, and the first port is down, according to this logic, the downlink ports (the third port and the first peer-link port) that are monitored in the first monitor-link group will be set to a down state. At this time, the server can no longer send data packets to the core layer device through the third port of the primary switch, and instead passively selects the second port of the backup switch to send data packets to the core layer device. In this case, the data packets do not need to be forwarded through the peer-link and are processed directly on the backup switch. Therefore, for the primary and backup links of the server, regardless of which is selected as the downlink port, the final selection result of the access layer switch will be the standard. This configuration logic solves the problem of uncertain data forwarding paths after a split-brain scenario. By flexibly utilizing the monitor-link group settings, the controllability of the forwarding path after a split-brain scenario is achieved, avoiding packet loss problems caused by transmission through peer-links in a split-brain state.

[0061] When the core layer device transmits data packets to the server, steps S101 and S201 are combined. This is based on the uplink / downlink port linkage logic described in step S201 to address the uncertainty of the data forwarding path after a split-brain scenario. This can be considered analogously to the example above. At this point, after the configuration in step S201, the third port (eh3) and the fourth port (eh4) are configured as uplink ports, while the peer-link port, the first port (eh1), and the second port (eh2) are configured as downlink ports. For example... Figure 1 As shown, before a split-brain scenario occurs, if the server selects the third port of the primary switch and the core layer device selects the second port of the backup switch after LACP negotiation, then data packets will be forwarded between the primary and backup switches via the peer-link port. However, if a split-brain scenario occurs, i.e., the peer-link port is down, then data packet loss will occur. To solve this problem, this application specifies the following monitor-link logic: when the monitor-link group detects that all uplink ports within the group are down, it sets all downlink ports within the monitor-link group to a down state. Returning to the previous example, if the server selects the third port of the primary switch as the uplink port, and the fourth port is down, according to this logic, the downlink ports (the second port and the second peer-link port) that are monitored in the second monitor-link group will be set to a down state. At this time, the core layer device can no longer send data packets to the server through the second port of the backup switch, and instead passively selects the first port of the primary switch to send data packets to the server. In this case, the data packets do not need to be forwarded through the peer-link and are processed directly on the backup switch.

[0062] When the number of servers is one, the method further includes: step S301, the first monitor-link group monitors whether at least one uplink port in the group changes from a down state to an up state; when the first monitor-link group detects that at least one uplink port in the group changes from a down state to an up state, it sets all downlink ports in the first monitor-link group to an up state.

[0063] The second monitor-link group monitors whether at least one uplink port in the group changes from a down state to an up state; when the second monitor-link group detects that at least one uplink port in the group changes from a down state to an up state, it sets all downlink ports in the second monitor-link group to the up state.

[0064] Corresponding to the down logic described in step S201, the logic configured here corresponds to the situation after members resume communication under the mlag environment. For example, when the second port of the core layer and the backup switch recovers communication after a connection failure, before the failure, because the fourth port and the second peer-link port, as downlink ports within the second monitor-link group, were all in a down state along with the second port, the server could not interact with the core layer device through the backup switch. However, when the second port recovers from the down state to the up state, all downlink ports within the second monitor-link group should recover to the up state, i.e., the fourth port recovers to the up state. In this way, the server can continue to send data packets to the core layer device from the backup switch, realizing seamless switching and continuous data transmission after the connection failure is recovered. Through the monitoring group and the corresponding state switching logic, the system implements an automated network maintenance mechanism. Without manual intervention, the system can intelligently adjust the configuration according to changes in the state of network members to ensure network stability and availability.

[0065] When there are multiple servers, the method further includes: the first monitor-link group monitors all uplink ports within the group to see if at least one uplink port is in a down state; when the first monitor-link group detects that at least one uplink port within the group is in a down state, it sets all downlink ports within the first monitor-link group to a down state; the second monitor-link group monitors all uplink ports within the group to see if at least one uplink port is in a down state; when the second monitor-link group detects that at least one uplink port within the group is in a down state, it sets all downlink ports within the second monitor-link group to a down state.

[0066] Figure 2 This is a schematic diagram illustrating the application environment of another port configuration method for a switch provided in one embodiment of this application, as shown below. Figure 2As shown, in this environment, the number of servers is expanded from one to multiple. When multiple servers are connected to a single access layer switch, the method further includes: a first monitor-link group monitoring whether at least one uplink port within the group is in a down state; when the first monitor-link group detects that at least one uplink port is in a down state, setting all downlink ports within the first monitor-link group to a down state; a second monitor-link group monitoring whether at least one uplink port within the group is in a down state; when the second monitor-link group detects that at least one uplink port is in a down state, setting all downlink ports within the second monitor-link group to a down state.

[0067] To address this situation, the monitor-link logic described earlier needs to be revised. If a core layer device needs to send data packets to multiple servers simultaneously, and the connection between server A and the main switch's uplink port happens to be broken, continuing to send data packets to server A will result in data loss. With the revised logic, if one of the main switch's uplink ports is down, the main switch's downlink port is also set to down. In this case, the core layer device can only communicate with server A through the backup switch, ensuring that data packets are not lost during transmission. The revised logic isolates faulty paths by automatically setting the down state, ensuring seamless switching to the backup path in the event of connection drops or other failures, thus improving the overall system availability. This automated fault isolation and path switching mechanism allows the network to maintain a high level of availability without manual intervention. Overall, this revision emphasizes real-time monitoring and intelligent control of connection status to ensure a rapid and reliable system response in the event of a failure, preventing potential data loss and improving the stability and availability of the entire network.

[0068] Similarly, data interaction between multiple servers and core layer devices follows the transmission path rules described above. Likewise, when a core layer device needs to send data packets to a server, it will negotiate its primary and backup links via LACP, meaning it will choose one of the primary or backup switches for data forwarding. If the core layer device passively selects the first port of the primary switch as its downlink port, it will send data packets to servers A, B, C, and D via the third link. In this way, even in a split-brain scenario, data packets can be processed and forwarded directly on the primary or backup switch without going through a peer-link, improving network availability in split-brain situations.

[0069] In the case where multiple servers are connected to one access layer switch, the method further includes: the method further includes: the first monitor-link group monitoring whether all uplink ports within the group have recovered to the up state; when the first monitor-link group detects that all uplink ports within the group have recovered to the up state, setting all downlink ports within the first monitor-link group to the up state; the second monitor-link group monitoring whether all uplink ports within the group have recovered to the up state; when the second monitor-link group detects that all uplink ports within the group have recovered to the up state, setting all downlink ports within the first monitor-link group to the up state.

[0070] If a core layer device needs to send data packets to multiple servers simultaneously, and the connection between server A and the master switch's uplink port happens to be broken, continuing to send data packets to server A will result in data loss. Once server A reconnects to the master switch's uplink port (i.e., the uplink port connecting server A to the master switch is in the up state), the first monitor-link group will detect that the uplink ports connecting servers A, B, C, and D to the master switch are all in the up state. At this point, the servers and core layer devices can continue LACP negotiation with the master and backup switches to further execute subsequent data interactions. The revised logic can set the corresponding downlink port to the up state when all uplink ports are detected to be back to the up state, achieving automatic fault detection and recovery. This helps ensure that the network can promptly re-establish normal communication paths after fault repair, improving system availability and stability.

[0071] Based on the method proposed above, the method further includes: monitoring the status of the peer-link link between the first peer-link port and the second peer-link port; when the peer-link is detected to be in a connected state, transmitting data packets between the core layer device and the server based on the peer-link.

[0072] Suppose an access layer switch is connected to server A. After a split-brain event occurs, in addition to monitoring the status of the uplink ports, the monitor-link group will also monitor the status of the peer-link link between the first and second peer-link ports. When the peer-link is detected to be connected, it indicates that the link between the two switches is normal. In this case, the peer-link can be used for packet transmission between the core layer device and the server. This ensures that packets can be transmitted through a reliable link, improving network reliability and performance. In summary, the purpose of this method is to monitor the status of the peer-link link and utilize it for packet transmission when the link is connected, thereby improving network reliability and performance.

[0073] It's worth noting that when multiple servers are connected to an access layer switch, if the monitor-link group of one of the primary or backup switches is down, all data sent or received by the server will be transmitted through the link of the other switch, resulting in excessive data load on the link. Therefore, it's necessary to adjust the data packet transmission path based on the server's real-time traffic patterns and network load. This application provides the following solutions: First, using traffic-based load balancing technology, including hash algorithms based on data source and destination IP addresses, port numbers, etc., to evenly distribute traffic; second, pre-setting reasonable Quality of Service (QoS) policies to ensure priority transmission of critical business data while limiting low-priority traffic to avoid link congestion; third, using dynamic routing protocols (such as OSPF and BGP) to automatically select the optimal path and adjust routes according to network conditions. In general, managing traffic in a MLAG environment requires comprehensive consideration of network device support capabilities, network architecture, and business requirements. In practical implementation, collaboration with network device vendors may be necessary to ensure correct configuration and network stability.

[0074] This application proposes a linkage logic for monitoring group members to recover from a down state to an up state. Based on this, after the first or second monitor-link group detects that the primary switch and backup switch have resumed communication, it needs to renegotiate the Link Aggregation Control Protocol (LACP) and restore the original packet forwarding path. This is because the original LACP negotiation state may have become invalid or inaccurate during the fault. After the LACP renegotiation is completed, the system will restore the packet forwarding path before the fault occurred. This means that data flows will be redistributed to the original physical links. By automatically detecting the link status and renegotiating LACP after the fault is recovered, the network can quickly recover to its optimal state, reducing downtime. At the same time, restoring the original packet forwarding path helps to rebalance the network load and avoid overloading of a single link.

[0075] This process is usually transparent to the end user and does not affect ongoing services or applications.

[0076] Figure 4 This is a block diagram of a port configuration device for a switch provided in an embodiment of this application, such as... Figure 4 As shown, the device includes: a first configuration module 201, configured to configure the first port, third port and first peer-link port of the master switch as a first monitor-link group, and configure the second port, fourth port and second peer-link port of the backup switch as a second monitor-link group;

[0077] The second configuration module 202 is configured to, when the server transmits data packets to the core layer device, configure the first port as an uplink port and the third port and the first peer-link port as downlink ports on the main switch; and configure the second port as an uplink port and the fourth port and the second peer-link port as downlink ports on the backup switch.

[0078] The transmission module 203 is configured to send data packets to the core layer device via a first transmission path or a second transmission path when the peer-link link between the first peer-link port and the second peer-link port is disconnected. The first transmission path is a path forwarded to the core layer device through the third port and the first port of the master switch, and the second transmission path is a path forwarded to the core layer device through the fourth port and the second port of the backup switch.

[0079] This application also provides an electronic device, including a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, it implements the various processes of the above-described port configuration method embodiment in a switch and achieves the same technical effect. To avoid repetition, it will not be described again here.

[0080] This application also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the various processes of the above-described port configuration method embodiments in a switch, achieving the same technical effects. To avoid repetition, these will not be repeated here. The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to mutually.

[0081] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus, or computer program products. Therefore, embodiments of this application can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of this application can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD / ROM, optical storage, etc.) containing computer-usable program code.

[0082] This application describes embodiments with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 The computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1The functions specified in one or more boxes. These computer program instructions may also be loaded onto a computer or other programmable data processing terminal equipment to cause a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0083] Although preferred embodiments of the present application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present application.

[0084] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the term "comprising" or any other variations thereof is intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element. The above provides a detailed description of a port configuration method, apparatus, electronic device, and storage medium for a switch provided by this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application; at the same time, for those skilled in the art, based on the ideas of this application, there will be changes in specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A port configuration method for a switch, characterized in that, This method is used to configure ports of access layer switches in a packet forwarding system, which includes: core layer devices, access layer switches, and servers; the access layer switches include a primary switch and a backup switch; the method includes: Configure the first port, third port, and first peer-link port of the main switch as the first monitor-link group, and configure the second port, fourth port, and second peer-link port of the backup switch as the second monitor-link group; When the server transmits data packets to the core layer device, on the main switch, the first port is configured as an uplink port, and the third port and the first peer-link port are configured as downlink ports; on the backup switch, the second port is configured as an uplink port, and the fourth port and the second peer-link port are configured as downlink ports. When the peer-link link between the first peer-link port and the second peer-link port is disconnected, the server sends data packets to the core layer device through a first transmission path or a second transmission path. The first transmission path is the path from the third port of the main switch to the first port and forwarded to the core layer device, and the second transmission path is the path from the fourth port of the backup switch to the second port and forwarded to the core layer device. The method further includes: When the core layer device transmits data packets to the server, on the main switch, the third port is configured as an uplink port, and the first port and the first peer-link port are configured as downlink ports; On the backup switch, the fourth port is configured as an uplink port, and the second port and the second peer-link port are configured as downlink ports; When the peer-link link between the first peer-link port and the second peer-link port is disconnected, the core layer device sends data packets to the server through a third transmission path or a fourth transmission path. The third transmission path is a path from the first port of the main switch to the third port and forwarded to the server, and the fourth transmission path is a path from the second port of the backup switch to the fourth port and forwarded to the server. When the number of servers is one, the method further includes: The first monitor-link group monitors whether all uplink ports within the group are in a down state; when the first monitor-link group detects that all uplink ports within the group are in a down state, it sets all downlink ports within the first monitor-link group to a down state. The second monitor-link group monitors whether all uplink ports within the group are in a down state; when the second monitor-link group detects that all uplink ports within the group are in a down state, it sets all downlink ports within the second monitor-link group to a down state.

2. The method according to claim 1, characterized in that, When the number of servers is one, the method further includes: The first monitor-link group monitors whether at least one uplink port in the group changes from a down state to an up state. When the first monitor-link group detects that at least one uplink port in the group has changed from down to up, it sets all downlink ports in the first monitor-link group to up. The second monitor-link group monitors whether at least one uplink port in the group changes from a down state to an up state. When the second monitor-link group detects that at least one uplink port in the group has changed from a down state to an up state, it sets all downlink ports in the second monitor-link group to the up state.

3. The method according to claim 1, characterized in that, When the number of servers is multiple, the method further includes: The first monitor-link group monitors whether at least one uplink port in the group is in a down state. When the first monitor-link group detects that at least one uplink port in the group is in a down state, it sets all downlink ports in the first monitor-link group to a down state. The second monitor-link group monitors whether at least one uplink port in the group is in a down state. When the second monitor-link group detects that at least one uplink port in the group is in a down state, it sets all downlink ports in the second monitor-link group to a down state.

4. The method according to claim 1, characterized in that, When the number of servers is multiple, the method further includes: The first monitor-link group monitors whether all uplink ports within the group have returned to the up state; When the first monitor-link group detects that all uplink ports in the group have returned to the up state, it sets all downlink ports in the first monitor-link group to the up state. The second monitor-link group monitors whether all uplink ports within the group have returned to the up state; When the second monitor-link group detects that all uplink ports in the group have returned to the up state, it sets all downlink ports in the first monitor-link group to the up state.

5. The method according to any one of claims 1-4, characterized in that, The method further includes: Monitor the status of the peer-link link between the first peer-link port and the second peer-link port; When the peer-link is detected to be in a connected state, data packet transmission between the core layer device and the server is carried out based on the peer-link.

6. A port configuration device for a switch, characterized in that, This device is used to configure ports of access layer switches in a packet forwarding system, which includes: core layer devices, access layer switches, and a server; the access layer switches include a primary switch and a backup switch; the device includes: The first configuration module is configured to configure the first port, third port and first peer-link port of the master switch as the first monitor-link group, and configure the second port, fourth port and second peer-link port of the backup switch as the second monitor-link group. The second configuration module is configured to, when the server transmits data packets to the core layer device, configure the first port as an uplink port and the third port and the first peer-link port as downlink ports on the main switch; and configure the second port as an uplink port and the fourth port and the second peer-link port as downlink ports on the backup switch. The transmission module is configured to send data packets to the core layer device via a first transmission path or a second transmission path when the peer-link link between the first peer-link port and the second peer-link port is disconnected. The first transmission path is a path forwarded to the core layer device through the third port and the first port of the master switch, and the second transmission path is a path forwarded to the core layer device through the fourth port and the second port of the backup switch. The device further includes: The third configuration module is configured to, when the core layer device transmits data packets to the server, configure the third port as an uplink port and the first port and the first peer-link port as downlink ports on the main switch; and configure the fourth port as an uplink port and the second port and the second peer-link port as downlink ports on the backup switch; when the peer-link link between the first peer-link port and the second peer-link port is disconnected, the core layer device sends data packets to the server through a third transmission path or a fourth transmission path, wherein the third transmission path is a path from the first port of the main switch to the third port and forwarded to the server, and the fourth transmission path is a path from the second port of the backup switch to the fourth port and forwarded to the server. When the number of servers is one, the apparatus further includes: The monitoring module is configured to: monitor whether all uplink ports within the first monitor-link group are in a down state; when the first monitor-link group detects that all uplink ports within the group are in a down state, set all downlink ports within the first monitor-link group to a down state; monitor whether all uplink ports within the second monitor-link group are in a down state; when the second monitor-link group detects that all uplink ports within the second monitor-link group are in a down state, set all downlink ports within the second monitor-link group to a down state.

7. An electronic device, characterized in that, include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the steps of the method as described in any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, which, when executed by a processor, implements the steps of the method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Cross-device link communication method, switch, system and storage medium

    CN115514699A

  • Data processing method and device based on MLAG and medium

    CN115766579A