Port setting method, device and equipment

By receiving and utilizing the tier number in Ethernet to set the port status of network devices, loop connections are avoided, solving the problem of high complexity in anti-loop protocols and achieving simple configuration and efficient fault handling.

CN121462401APending Publication Date: 2026-02-03RUIJIE NETWORKS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411059636.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-02
Publication Date
2026-02-03

AI Technical Summary

Technical Problem

In existing technologies, anti-loop protocols for network devices are highly complex, especially in cases of complex network topologies. They require complex configuration by administrators, which may lead to unexpected port blocking and require breaking the loop connection when a loop is established.

Method used

Network devices receive the tier numbers of themselves and neighboring devices in the Ethernet network, determine the target port based on the tier number and set it to an unavailable state, while other ports are in an available state, thus avoiding loop connections without the need for anti-loop protocols.

Benefits of technology

It reduces the complexity of loop prevention in network devices, simplifies the configuration process, improves fault location efficiency, is suitable for zero-configuration scenarios, and can be flexibly applied to multi-layer networks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121462401A_ABST
    Figure CN121462401A_ABST
Patent Text Reader

Abstract

Provided are a port setting method, apparatus and device, the method being applied to a network device, the method comprising: receiving at least one existing hierarchy number, the at least one existing hierarchy number comprising a hierarchy number of the network device in the Ethernet, and / or a hierarchy number of the network device in the Ethernet; the hierarchy number of the neighbor device of the network device in the Ethernet; determining a target port from a plurality of ports of the network equipment according to the at least one existing hierarchy number; the target port is set to be in an unavailable state, and / or other ports are set to be in an available state, and the other ports are the ports except the target port in the multiple ports. According to the method, the anti-loop complexity of the network equipment can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present application relate to the technical field of communication, and in particular, to a port setting method, device and equipment. BACKGROUND

[0002] Network devices in an Ethernet cannot exist in a loop connection. For example, the network devices can be core devices, aggregation devices or access devices, etc.

[0003] At present, an anti-loop protocol can be configured in the network devices to avoid the network devices from appearing in a loop through the anti-loop protocol. For example, the anti-loop protocol can be a multi-service transport platform (MSTP) protocol. However, the principle of the anti-loop protocol is relatively complex, and especially in the case of a complex network topology, the administrator needs to perform a relatively complex configuration on the network devices, otherwise the network devices can block the non-expected ports through the anti-loop protocol. The above method leads to a high anti-loop complexity of the network devices. SUMMARY

[0004] Embodiments of the present application provide a port setting method, device and equipment, which can reduce the anti-loop complexity.

[0005] In a first aspect, the present application provides a port setting method, comprising: the method is applied to a network device, and the method comprises:

[0006] receiving at least one existing hierarchical number, the at least one existing hierarchical number comprising a hierarchical number of the network device in an Ethernet and / or a hierarchical number of a neighbor device of the network device in the Ethernet;

[0007] determining a target port in a plurality of ports of the network device according to the at least one existing hierarchical number;

[0008] setting the target port to an unavailable state and / or setting the remaining ports to an available state, wherein the remaining ports are ports other than the target port in the plurality of ports.

[0009] In a possible implementation manner, determining the target port in the plurality of ports of the network device according to the at least one existing hierarchical number comprises:

[0010] judging whether a first hierarchical number exists in the at least one existing hierarchical number, the first hierarchical number being the hierarchical number of the network device in the Ethernet;

[0011] if the first hierarchical number exists in the at least one existing hierarchical number, determining, as the target port, a port in the plurality of ports other than a port receiving the first hierarchical number;

[0012] if the first hierarchical number does not exist in the at least one existing hierarchical number, determining a first hierarchical number according to the at least one existing hierarchical number, and determining the target port in the plurality of ports according to the at least one existing hierarchical number and the first hierarchical number.

[0013] In a possible implementation, determining a second hierarchical number according to the at least one existing hierarchical number comprises:

[0014] determining a minimum value in the at least one existing hierarchical number;

[0015] determining, as the first hierarchical number, a sum of the minimum value and a preset value.

[0016] In a possible implementation, determining the target port in the plurality of ports according to the at least one existing hierarchical number and the first hierarchical number comprises:

[0017] determining a first port and a second port in the plurality of ports, the first port being a port receiving the at least one existing hierarchical number, and the second port being a port other than the first port in the plurality of ports;

[0018] determining, as a first target port, the second port;

[0019] determining, as a second target port, a port in the first port according to the at least one existing hierarchical number and the first hierarchical number;

[0020] wherein the target port comprises the first target port and the second target port.

[0021] In a possible implementation, determining the second target port in the first port according to the at least one existing hierarchical number and the first hierarchical number comprises:

[0022] determining a second hierarchical number and a third hierarchical number in the at least one existing hierarchical number, the second hierarchical number being equal to the first hierarchical number, a quantity of the second hierarchical number being greater than or equal to zero, the third hierarchical number being less than the first hierarchical number, and a quantity of the third hierarchical number being greater than or equal to 1;

[0023] determining, as a first candidate port, a port receiving the second hierarchical number in the first port;

[0024] determine a port receiving the third level number in the first port as a second candidate port, and determine a third candidate port from the second candidate port according to a preset rule, wherein a difference between a quantity of the second candidate port and a quantity of the third candidate port is 1;

[0025] determine the first candidate port and / or the third candidate port as the second target port.

[0026] In a possible implementation, the receiving the existing level number comprises:

[0027] receiving level configuration information, wherein the level configuration information comprises the existing level number and a target field, and the target field is used to indicate that the existing level number is a level number of the network device in the Ethernet, or is used to indicate that the existing level number is a level number of a neighbor device of the network device in the Ethernet.

[0028] In a possible implementation, the setting the target port to the unavailable state comprises:

[0029] determining whether a connection port exists in the target port, wherein the connection port is a port connected to a neighbor device of the network device;

[0030] if the connection port exists in the target port, setting a state of the connection port to an unavailable state in port configuration information, so as to achieve the purpose of setting the target port to the unavailable state.

[0031] In a possible implementation, the setting the remaining ports to the available state comprises:

[0032] setting states of the remaining ports to the available state in the port configuration information.

[0033] In a second aspect, the present application provides a port setting device, which is applied to a network device, and comprises a receiving module, a determining module and a setting module, wherein:

[0034] the receiving module is used to receive at least one existing level number, wherein the at least one existing level number comprises a level number of the network device in an Ethernet, and / or a level number of a neighbor device of the network device in the Ethernet;

[0035] the determining module is used to determine a target port from a plurality of ports of the network device according to the at least one existing level number;

[0036] The setting module is configured to set the target port as an unavailable state and / or set the remaining ports as available states, wherein the remaining ports are ports in the plurality of ports except the target port.

[0037] In a possible implementation, the determining module is specifically configured to,

[0038] determine whether a first hierarchical number exists in the at least one existing hierarchical number, the first hierarchical number being a hierarchical number of the network device in the Ethernet;

[0039] if the first hierarchical number exists in the at least one existing hierarchical number, determine a port in the plurality of ports as the target port, except a port receiving the first hierarchical number;

[0040] if the first hierarchical number does not exist in the at least one existing hierarchical number, determine a first hierarchical number according to the at least one existing hierarchical number, and determine the target port in the plurality of ports according to the at least one existing hierarchical number and the first hierarchical number.

[0041] In a possible implementation, the determining module is specifically configured to,

[0042] determine a minimum value in the at least one existing hierarchical number;

[0043] determine a sum of the minimum value and a preset value as the first hierarchical number.

[0044] In a possible implementation, the determining module is specifically configured to,

[0045] determine a first port and a second port in the plurality of ports, the first port being a port receiving the at least one existing hierarchical number, and the second port being a port in the plurality of ports except the first port;

[0046] determine the second port as a first target port;

[0047] determine a second target port in the first port according to the at least one existing hierarchical number and the first hierarchical number;

[0048] wherein the target port includes the first target port and the second target port.

[0049] In a possible implementation, the determining module is specifically configured to,

[0050] determining a second hierarchical number and a third hierarchical number in the at least one existing hierarchical number, the second hierarchical number being equal to the first hierarchical number, the number of the second hierarchical number being greater than or equal to zero, the third hierarchical number being less than the first hierarchical number, the number of the third hierarchical number being greater than or equal to 1;

[0051] determining a port receiving the second hierarchical number in the first port as a first candidate port;

[0052] determining a port receiving the third hierarchical number in the first port as a second candidate port, and determining a third candidate port in the second candidate port according to a preset rule, the difference between the number of the second candidate port and the number of the third candidate port being 1;

[0053] determining the first candidate port and / or the third candidate port as the second target port.

[0054] In a possible implementation, for any one existing hierarchical number, the receiving module is specifically configured to,

[0055] receive hierarchical configuration information, the hierarchical configuration information including the existing hierarchical number and a target field, the target field being used to indicate that the existing hierarchical number is a hierarchical number of the network device in the Ethernet, or being used to indicate that the existing hierarchical number is a hierarchical number of a neighbor device of the network device in the Ethernet.

[0056] In a possible implementation, the setting module is specifically configured to,

[0057] determine whether a connection port exists in the target port, the connection port being a port connected with a neighbor device of the network device;

[0058] if the connection port exists in the target port, setting a state of the connection port as an unusable state in port configuration information, so as to achieve the purpose of setting the target port as the unusable state.

[0059] In a possible implementation, the setting module is specifically configured to,

[0060] setting states of the remaining ports as the usable state in the port configuration information.

[0061] In a third aspect, the present application provides an electronic device, comprising: a processor, and a memory connected with the processor in communication;

[0062] the memory stores computer execution instructions;

[0063] The processor executes computer execution instructions stored in the memory to implement the method described in any of the first aspects.

[0064] Fourthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any of the first aspects.

[0065] Fifthly, this application provides a computer program product, including a computer program that, when executed by a computer, implements the method as described in any one of the first aspects.

[0066] The port setting method, apparatus, and device provided in this application embodiment allow a network device to receive at least one existing hierarchical number and determine a target port from among multiple ports of the network device based on the at least one existing hierarchical number. The target port can be set to an unavailable state, and / or the remaining ports can be set to an available state, wherein the remaining ports are those other than the target port among the multiple ports. This method avoids loop connections in Ethernet network devices and eliminates the need to break loop connections using anti-loop protocols, thus reducing the complexity of loop prevention in network devices. Attached Figure Description

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

[0068] Figure 1 This is a schematic diagram of an application scenario provided by an embodiment of this application;

[0069] Figure 2 A schematic diagram of a network device connection provided in an embodiment of this application;

[0070] Figure 3 A flowchart illustrating a port setting method provided in an embodiment of this application;

[0071] Figure 4 A flowchart illustrating another port setting method provided in an embodiment of this application;

[0072] Figure 5 This is a schematic diagram illustrating the connection of another network device provided in an embodiment of this application;

[0073] Figure 6 This is a connection diagram of another network device provided in an embodiment of this application;

[0074] Figure 7 This is a schematic diagram of a port setting device provided in an embodiment of this application;

[0075] Figure 8 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application.

[0076] These accompanying drawings and textual descriptions are not intended to limit the scope of the present application in any way, but rather to illustrate the concepts of the present application to those skilled in the art by referring to specific embodiments. Detailed Implementation

[0077] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0078] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus 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 apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0079] To facilitate understanding, let's first combine Figure 1 The application scenarios of the embodiments of this application will be described.

[0080] Figure 1 This is a schematic diagram illustrating an application scenario provided by an embodiment of this application. Please refer to [link / reference]. Figure 1 Ethernet can be a three-layer network. Layer 1 can include core device A, Layer 2 can include aggregation device A and aggregation device B, and Layer 3 can include access device A and access device B. Core device A can be connected to both aggregation device A and aggregation device B. Aggregation device A can also be connected to access device A, and aggregation device B can also be connected to access device B.

[0081] The core device can also connect to a control device (not shown in the figure) to obtain configuration information from the control device. For example, the control device can be a Software Defined Network (SDN) controller.

[0082] It should be noted that an Ethernet network may include fewer or more layers than shown in the diagram, and each layer may include one or more network devices (in this application, core devices, aggregation devices, and access devices are collectively referred to as network devices). Figure 1 Ethernet is described by way of example only and does not constitute a limitation on the technical solutions provided in the embodiments of this application.

[0083] In the network architecture described above, no network device can be connected in a loop. For example, a loop connection can be a dual uplink, dual homing, stacked interconnect, or Virtual Router Redundancy Protocol (VRRP) connection.

[0084] Below, in conjunction with Figure 2 This section explains the situation where loops exist in network devices.

[0085] Figure 2 This is a schematic diagram illustrating the connection of a network device according to an embodiment of this application. Please refer to... Figure 2 Core device A can be connected to aggregation device A and aggregation device B respectively. Core device B can be connected to aggregation device B and aggregation device C respectively. Access device A can be connected to aggregation device A. Access device B can be connected to aggregation device B and aggregation device C respectively.

[0086] Depend on Figure 2 It can be seen that aggregation device B is connected to both core device A and core device B, and access device B is connected to both aggregation device B and aggregation device C. Therefore, there is a loop connection between aggregation device B and access device B.

[0087] It should be noted that before powering on network equipment, technicians typically connect the network equipment to other network devices. However, the network topology in Ethernet is quite complex, and properly connected cables can often lead to loop connections within the network equipment.

[0088] Currently, loop prevention protocols can be used to disrupt loop connections in network devices, thus preventing loop connections from occurring. For example, the MSTP protocol can be used for loop prevention.

[0089] Specifically, loop prevention protocols can be pre-configured in network devices before they leave the factory. During power-up, the network device can use these protocols to break its own loop connections. However, loop prevention protocols are generally only applicable to Layer 2 networks. In complex network topologies, if a network device breaks its own loop connection using the loop prevention protocol, administrators need to perform complex configurations on the network device; otherwise, the network device may block unexpected ports using the loop prevention protocol. This method results in high complexity for loop prevention in network devices. Therefore, some network devices are not pre-configured with loop prevention protocols before leaving the factory.

[0090] In view of this, embodiments of this application provide a port setting method. In this method, a network device can receive its own tier number in the Ethernet network, and / or the tier numbers of its neighboring devices in the Ethernet network. Based on the received tier number, the network device can determine the target port causing the loop connection among its multiple ports and set the target port to an unavailable state. This avoids loop connections in the network device without requiring a loop prevention protocol to break the loop connection, thus reducing the complexity of loop prevention for the network device.

[0091] Furthermore, the method provided in this application does not limit the number of Ethernet network layers; the Ethernet network can have two or more layers. In other words, the above method can be applied to network devices in multi-layer networks, resulting in better loop prevention flexibility.

[0092] Furthermore, the port configuration method provided in this application embodiment eliminates the need for administrators to perform complex configurations of network devices, simplifying network device configuration. If a network device malfunctions, the simplified configuration allows administrators to quickly locate the fault, resulting in high fault handling efficiency.

[0093] Furthermore, when a network device breaks a loop using the method provided in this application embodiment, no configuration is required before the network device leaves the factory. For example, no anti-loop protocol needs to be configured for the network device before it leaves the factory. In other words, the port setting method provided in this application embodiment is applicable to network devices in zero-configuration scenarios.

[0094] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will be described below with reference to the accompanying drawings.

[0095] Figure 3This is a flowchart illustrating a port setting method provided in an embodiment of this application. The executing entity of this method can be a network device or a port setting device installed in the network device. The port setting device can be implemented by software or by a combination of software and hardware. For ease of understanding, the following explanation uses a network device as the executing entity. Please refer to... Figure 3 The method may include:

[0096] S301, Receive at least one existing level number.

[0097] At least one existing tier number includes the tier number of the network device in the Ethernet, and / or the tier number of the network device's neighboring devices in the Ethernet.

[0098] For any existing tier number, when a network device receives an existing tier number, it can receive tier configuration information. The tier configuration information includes the existing tier number and a target field. The target field is used to indicate that the existing tier number is the tier number of the network device in the Ethernet, or to indicate that the existing tier number is the tier number of the network device's neighboring device in the Ethernet.

[0099] In this embodiment, the network device can receive hierarchical configuration information through the port based on the communication protocol.

[0100] The port can be a port configured on the network device to connect to neighboring devices or to control devices. For example, neighboring devices can be core devices, aggregation devices, or access devices, while the control device can be an SDN controller.

[0101] The communication protocol can be the Link Layer Discovery Protocol (LLDP), or it can be the Network Configuration (NETCONF) protocol based on the Extensible Markup Language (XML) protocol.

[0102] Network devices can communicate with their neighbors via the LLDP protocol. The existing tier number sent by a neighbor to the network device can be its tier number within the Ethernet network. In other words, the existing tier number included in the tier configuration information received by the network device via the LLDP protocol can be the tier number of its neighbor within the Ethernet network.

[0103] Network devices can communicate with control devices via the NETCONF protocol. The existing layer number sent by the control device to the network device can be the network device's layer number within the Ethernet network. In other words, the existing layer number included in the layer configuration information received by the network device via the NETCONF protocol can be the network device's layer number within the Ethernet network.

[0104] For any given hierarchical configuration information, the target field included in the hierarchical configuration information can be used to indicate the communication protocol receiving the hierarchical configuration information. For example, the target field can be an identifier of the communication protocol. In other words, the target field can be used to indicate that the existing hierarchical number included in the hierarchical configuration information is the hierarchical number of the network device in the Ethernet, or to indicate that the existing hierarchical number is the hierarchical number of the network device's neighboring device in the Ethernet.

[0105] In this embodiment, at least one existing hierarchical number includes at least the following three cases:

[0106] Case 1: At least one existing tier number is the tier number of the network device in the Ethernet.

[0107] In this scenario, the network device is not connected to other network devices, but only to the control device. The network device can be a core device.

[0108] Case 2: At least one existing tier number is the tier number of the network device's neighboring device in the Ethernet.

[0109] In this scenario, the network device does not communicate with the control device but only connects to other network devices. These network devices can be aggregation devices or access devices, etc.

[0110] Case 3: At least one existing tier number includes the tier number of the network device in the Ethernet and the tier number of the network device's neighboring devices in the Ethernet.

[0111] In this scenario, the network device connects to both other network devices and control equipment. The network device can be a core device.

[0112] S302. Determine the target port from among multiple ports of the network device based on at least one existing hierarchical number.

[0113] The target port can be one of the multiple ports on the network device that needs to be set to an unavailable state.

[0114] In this embodiment, if at least one existing hierarchical number is the hierarchical number of the network device in the Ethernet, or if at least one existing hierarchical number includes the hierarchical number of the network device in the Ethernet and the hierarchical numbers of the network device's neighboring devices in the Ethernet, then the network device can be a core device. The network device can identify the target port from among its multiple ports, excluding the port communicating with the control device.

[0115] If at least one existing tier number is the tier number of a neighboring device in the Ethernet network, then the network device can be an aggregation device or an access device. The network device can determine any one of its multiple ports to connect to a higher-level device, and can designate any port other than the one connected to the higher-level device as the target port. The higher-level device can be a neighboring device with a tier number lower than that of the network device.

[0116] S303, Set the target port to an unavailable state, and / or set the remaining ports to an available state.

[0117] The remaining ports are those other than the target port among multiple ports.

[0118] When the target port is set to unavailable, the network device can determine whether there is a connection port in the target port. The connection port is the port connected to the network device's neighboring device. If there is a connection port in the target port, the status of the connection port is set to unavailable in the port configuration information to achieve the purpose of setting the target port to unavailable.

[0119] Port configuration information can be used to set the port status. It's important to note that if the port status is set to unavailable in the port configuration information for any given port, the network device will be unable to communicate with neighboring devices through that port.

[0120] Specifically, when setting the target port to an unavailable state, you can set the status of the connection ports within the target port to an unavailable state. It should be noted that the ports in the target port other than the connection ports can be ports that are not connected to other network devices; therefore, it is not necessary to set the status of the ports in the target port other than the connection ports.

[0121] When setting other ports to an available state, you can do so in the port configuration information. It's important to note that for any given port, if its status is set to available in the port configuration information, the network device can communicate with neighboring devices through that port.

[0122] In the port setting method provided in this embodiment, the network device can receive at least one existing hierarchical number and determine the target port from among multiple ports of the network device based on the at least one existing hierarchical number; the target port can be set to an unavailable state, and / or the remaining ports can be set to an available state, wherein the remaining ports are the ports other than the target port among the multiple ports. Through the above method, loop connections in Ethernet network devices can be avoided, and loop prevention protocols are not required to break loop connections, thus reducing the complexity of loop prevention for network devices.

[0123] Based on any of the above embodiments, the following is combined with Figure 4 The port setting method provided in the embodiments of this application will be further explained.

[0124] Figure 4 This is a flowchart illustrating another port setting method provided in an embodiment of this application. The executing entity of this method can be a network device or a port setting device installed in the network device. The port setting device can be implemented by software or by a combination of software and hardware. For ease of understanding, the following explanation uses a network device as the executing entity. Please refer to... Figure 4 The method may include:

[0125] S401, Receive at least one existing level number.

[0126] It should be noted that the specific implementation of S401 can be found in S301, and will not be repeated here.

[0127] S402. Determine whether a first-level number exists in at least one existing level number.

[0128] If at least one of the existing level numbers contains a first level number, execute S403;

[0129] If at least one of the existing level numbers does not contain a first level number, execute S404.

[0130] The first-level number is the tier number of the network device in the Ethernet. In other words, the first-level number can be an existing tier number that the network device obtains from the control device.

[0131] The first-level number can be the layer number set by the control device for the network device, or the layer number of the network device in the Ethernet.

[0132] S403. Determine the target port from among the multiple ports, excluding the port that receives the first-level number.

[0133] In this embodiment, if at least one existing hierarchical number contains a first-level number, the network device can be a core device. The network device can designate all ports except those receiving the first-level number as target ports. In other words, the network device can designate all ports except those connected to the control device as target ports.

[0134] S404. Determine the first level number based on at least one existing level number.

[0135] In this embodiment, if at least one existing tier number does not contain a first-tier number, the network device is either an aggregation device or an access device. At least one existing tier number can be the tier number of the network device's neighboring devices within the Ethernet network. The neighboring devices of the network device can be either its parent device or its sibling device. For example, if the network device is a Layer 2 network, its parent device can be a Layer 1 network device, and its sibling device can be a Layer 2 network device.

[0136] It should be noted that the hierarchical number of the superior device of a network device is smaller than the hierarchical number of the network device itself, while the hierarchical number of the peer device of a network device is the same as the hierarchical number of the network device.

[0137] In this embodiment, if the first level number is not present in at least one existing level number, the network device can determine the first level number based on at least one existing level number. In other words, the network device can determine its own level number based on at least one existing level number.

[0138] On the one hand, once a network device determines its first-level identifier, it can send that identifier to its neighboring devices. On the other hand, determining the first-level identifier makes it easier to identify the target port.

[0139] In this embodiment, when determining the first level number, the network device can determine the minimum value among at least one existing level number; the sum of the minimum value and a preset value is determined as the first level number.

[0140] It should be understood that the minimum value among at least one existing hierarchical number can be the hierarchical number of the network device's parent device. It should be noted that if at least one existing hierarchical number is the same, the network device can determine any one of the existing hierarchical numbers as the minimum value among at least one existing hierarchical number.

[0141] In this embodiment, the hierarchical number of the network device (i.e., the first hierarchical number) is 1 greater than the hierarchical number of the network device's parent device, so the preset value can be 1.

[0142] The hierarchical number of the network device's parent device is the minimum value among at least one existing hierarchical number. In practice, the first hierarchical number can be determined by adding the minimum value among at least one existing hierarchical number to 1.

[0143] For example, assuming that at least one existing level number includes 1, 1, 2, 2 and 2, then the minimum value among the at least one existing level number can be 1, and the first level number can be 2.

[0144] It should be noted that in other embodiments, if the difference between the hierarchical number of the network device and the hierarchical number of the network device's parent device is a different value, the preset value can also be a different value.

[0145] S405. Determine the target port from among multiple ports based on at least one existing level number and the first level number.

[0146] In this embodiment, the network device can determine a first port and a second port among multiple ports. The first port is a port that receives at least one existing hierarchical number, and the second port is a port other than the first port among the multiple ports. The second port is determined as the first target port. Based on at least one existing hierarchical number and the first hierarchical number, the second target port is determined among the first ports. The target port includes the first target port and the second target port.

[0147] When determining the second target port from the first port based on at least one existing hierarchical number and the first hierarchical number, the network device can determine a second hierarchical number and a third hierarchical number from at least one existing hierarchical number, wherein the second hierarchical number is equal to the first hierarchical number, the number of second hierarchical numbers is greater than or equal to zero, the third hierarchical number is less than the first hierarchical number, and the number of third hierarchical numbers is greater than or equal to 1; the port in the first port that receives the second hierarchical number is determined as the first candidate port; the port in the first port that receives the third hierarchical number is determined as the second candidate port, and a third candidate port is determined from the second candidate ports according to a preset rule; the first candidate port and / or the third candidate port are determined as the second target port.

[0148] The second-level number is equal to the first-level number. In other words, the second-level number can be an existing level number sent by a peer device to the network device.

[0149] The third-level number is less than the first-level number. In other words, the third-level number can be an existing level number sent from the network device's parent device to the network device.

[0150] The preset rules can be set according to the actual rules, but this embodiment does not limit this.

[0151] In one possible implementation, the preset rule can be: sort the second candidate ports in descending order of port number, and determine the other ports in the second candidate ports, except for the port with the smallest port number, as the third candidate ports.

[0152] In another possible implementation, the preset rule can be: sort the second candidate ports in descending order of port number, and determine the other ports in the second candidate ports, except for the port with the largest port number, as the third candidate ports.

[0153] S406. Set the target port to an unavailable state, and / or set the remaining ports to an available state.

[0154] It should be noted that the specific implementation of S406 can be found in S303, and will not be repeated here.

[0155] S407. Power off the connection port first, then power it on.

[0156] The connection port can be one of the ports that is connected to a neighboring device.

[0157] In this embodiment, after setting the target port to an unavailable state and setting the remaining ports to an available state, the connection ports can be powered down and then powered on. It should be understood that the connection ports include the target port and / or the remaining ports.

[0158] It should be noted that powering down and then powering on the connection port can clear any incorrect Media Access Control Addresses (MACs) that the network device has learned.

[0159] Below, in conjunction with Figure 5 This explains the incorrect MAC addresses learned by the network device.

[0160] Figure 5 This is a connection diagram of another network device provided in an embodiment of this application. Please refer to... Figure 5 The core equipment is connected to the aggregation equipment, and the aggregation equipment is connected to the access equipment through port A and port B.

[0161] Suppose that after the aggregation device receives a message from the core device, it sends a message to the access device through port A, and then retrieves a message from the access device through port B. This message propagation process results in the aggregation device learning the MAC address of the core device on port B. In other words, the aggregation device has learned an incorrect MAC address. Waiting for the aggregation device to automatically clear this incorrect MAC address would take a considerable amount of time.

[0162] In this embodiment, by powering down first and then powering on, incorrect MAC addresses learned by the network device can be quickly cleared.

[0163] The port setting method provided in this embodiment allows the network device to receive at least one existing hierarchical number and determine whether a first hierarchical number exists among the at least one existing hierarchical number. If a first hierarchical number exists among the at least one existing hierarchical number, the port other than the port receiving the first hierarchical number can be designated as the target port. If a first hierarchical number does not exist among the at least one existing hierarchical number, a first hierarchical number can be determined based on the at least one existing hierarchical number, and the target port can be determined among the multiple ports based on the at least one existing hierarchical number and the first hierarchical number. After determining the target port, the network device can set the target port to an unavailable state and / or set the remaining ports to an available state. This method avoids loop connections in Ethernet networks without requiring loop prevention protocols to break loop connections, thus reducing the complexity of loop prevention for network devices.

[0164] Below, in conjunction with Figure 6 The port setting method provided in the embodiments of this application will be explained through specific examples.

[0165] Figure 6 This is a connection diagram of another network device provided in an embodiment of this application. Please refer to... Figure 6 Core device 1 can connect to port 31 of aggregation device 3 via port 11, to port 41 of aggregation device 4 via port 12, and to port 51 of aggregation device 5 via port 13. Core device 2 can connect to port 32 of aggregation device 3 via port 21, to port 42 of aggregation device 4 via port 22, and to port 52 of aggregation device 5 via port 23. Aggregation device 3 can also connect to port 43 of aggregation device 4 via port 33, and to port 44 of aggregation device 4 via port 34. Access device 6 can connect to port 35 of aggregation device 3 via port 61, and to port 45 of aggregation device 4 via port 62. Access device 7 can connect to port 36 of aggregation device 3 via port 71, and to port 46 of aggregation device 4 via port 72. Access device 8 can connect to port 53 of aggregation device 5 via port 81, and to port 54 of aggregation device 5 via port 82.

[0166] In this embodiment, it is assumed that the preset rule is: sort the second candidate ports (i.e., the ports connected to the upper-level device) in descending order of port number, and determine the other ports in the second candidate ports, except for the port with the smallest port number, as the third candidate ports.

[0167] Taking aggregation device 3 as an example Figure 4 Taking the network device shown in the embodiment as an example, aggregation device 3 has ports 31, 32, 33, 34, 35, and 36. When aggregation device 3 is powered on, access devices (e.g., access device 6 or access device 7) are not powered on, while core devices (e.g., core device 1 and core device 2) and aggregation devices (e.g., aggregation device 4) can be in a powered-on state. Therefore, aggregation device 3 can receive at least one existing tier number sent by core device 1, core device 2, and aggregation device 4 through ports 31, 32, 33, and 34. Aggregation device 3 can designate ports 31, 32, 33, and 34 as first ports, and ports 35 and 36 as second ports. The existing tier number received by aggregation device 3 through ports 33 and 34 can be a second tier number, and the existing tier number received through ports 31 and 32 can be a third tier number. Aggregation device 3 can designate ports 33 and 34 as first candidate ports, and ports 31 and 32 as second candidate ports. Aggregator 3 can determine port 32 as the third candidate port according to preset rules. In summary, aggregation device 3 can determine the second port (ports 35 and 36), the first candidate port (ports 33 and 34), and the third candidate port (port 32) as the target port. Figure 6 (In the diagram, B can represent the target port). It should be noted that when aggregation device 3 is powered on, the access devices (such as access device 6 or access device 7) are not powered on. Aggregation device 3 can identify the port on aggregation device 3 connected to the access device as the target port. If the access device powers on and sets the port on the access device connected to aggregation device 3 to an available state, the corresponding port on aggregation device 3 can automatically become available.

[0168] Using aggregation device 4 as Figure 4Taking the network device shown in the embodiment as an example, aggregation device 4 has ports 41, 42, 43, 44, 45, and 46. When aggregation device 4 is powered on, access devices (e.g., access device 6 or access device 7) are not powered on, while core devices (e.g., core device 1 and core device 2) and aggregation devices (e.g., aggregation device 3) can be in a powered-on state. Therefore, aggregation device 4 can receive at least one existing tier number sent by core device 1, core device 2, and aggregation device 3 through ports 41, 42, 43, and 44. Aggregation device 4 can designate ports 41, 42, 43, and 44 as first ports and ports 45 and 46 as second ports. The existing tier number received by aggregation device 4 through ports 43 and 44 can be a second tier number, and the existing tier number received through ports 41 and 42 can be a third tier number. Aggregation device 4 can designate ports 43 and 44 as first candidate ports and ports 41 and 42 as second candidate ports. Aggregator 4 can determine port 42 as the third candidate port according to preset rules. In summary, aggregation device 4 can determine the second port (ports 45 and 46), the first candidate port (ports 43 and 44), and the third candidate port (port 42) as the target port. Figure 6 (In the diagram, B can represent the target port). It should be noted that when aggregation device 4 is powered on, the access devices (such as access device 6 or access device 7) are not powered on. Aggregation device 4 can identify the port on aggregation device 4 connected to the access device as the target port. If the access device powers on and sets the port on the access device connected to aggregation device 4 to an available state, the corresponding port on aggregation device 4 can automatically become available.

[0169] Using aggregation device 5 as Figure 4 Taking the network device shown in the embodiment as an example, the aggregation device 5 has ports 51, 52, 53, and 54. When the aggregation device 5 is powered on, the access devices (e.g., access device 8) are not powered on, while the core devices (e.g., core device 1 and core device 2) are powered on. Therefore, the aggregation device 5 can receive at least one existing tier number sent by core device 1 and core device 2 through ports 51 and 52. The aggregation device 5 can determine ports 51 and 52 as the first port and ports 53 and 54 as the second port. The existing tier number received by the aggregation device 5 through ports 51 and 52 can be a third tier number. The aggregation device 5 can determine ports 51 and 52 as the second candidate port. The aggregation device 5 can determine port 52 as the third candidate port according to preset rules. In summary, the aggregation device 5 can determine the second port (ports 53 and 54) and the third candidate port (port 52) ​​as the target port. Figure 6(In the diagram, B can represent the target port). It should be noted that when aggregation device 5 is powered on, access device 8 is not powered on. Aggregation device 5 can identify the port on aggregation device 5 connected to access device 8 as the target port. If access device 8 is powered on and sets the port on access device 8 connected to aggregation device 5 to an available state, then the corresponding port on aggregation device 5 can automatically become available.

[0170] Taking access device 6 as an example Figure 4 Taking the network device shown in the embodiment as an example, access device 6 has ports 61 and 62. When access device 6 is powered on, the aggregation devices (e.g., aggregation devices 3 and 4) are also powered on. Therefore, access device 6 can receive at least one existing tier number sent by aggregation devices 3 and 4 through ports 61 and 62. Access device 6 can determine ports 61 and 62 as the first port. The existing tier number received by access device 6 through ports 61 and 62 can be the third tier number. Access device 6 can determine ports 61 and 62 as the second candidate port. Access device 6 can determine port 62 as the third candidate port according to preset rules. In summary, access device 6 can determine the third candidate port (port 62) as the target port. Figure 6 (B in the diagram can represent the target port). After access device 6 sets port 61 to an available state, port 35 on aggregation device 3 can automatically be switched to an available state.

[0171] Taking access device 7 as an example Figure 4 Taking the network device shown in the embodiment as an example, access device 7 has ports 71 and 72. When access device 7 is powered on, the aggregation devices (e.g., aggregation devices 3 and 4) are also powered on. Therefore, access device 7 can receive at least one existing tier number sent by aggregation devices 3 and 4 through ports 71 and 72. Access device 7 can determine ports 71 and 72 as the first port. The existing tier number received by access device 7 through ports 71 and 72 can be the third tier number. Access device 7 can determine ports 71 and 72 as the second candidate port. Access device 7 can determine port 72 as the third candidate port according to preset rules. In summary, access device 7 can determine the third candidate port (port 72) as the target port. Figure 6 (B in the diagram can represent the target port). After access device 7 sets port 71 to an available state, port 36 on aggregation device 3 can automatically be switched to an available state.

[0172] Taking access device 8 as an example Figure 4Taking the network device shown in the embodiment as an example, access device 8 has ports 81 and 82. When access device 8 is powered on, the aggregation device (e.g., aggregation device 5) is also powered on. Therefore, access device 8 can receive at least one existing tier number sent by aggregation device 5 through ports 81 and 82. Access device 8 can determine ports 81 and 82 as the first port. The existing tier number received by access device 8 through ports 81 and 82 can be the third tier number. Access device 8 can determine ports 81 and 82 as the second candidate port. Access device 8 can determine port 82 as the third candidate port according to preset rules. In summary, access device 8 can determine the third candidate port (port 82) as the target port. Figure 6 (B in the diagram can represent the target port). After access device 8 sets port 81 to an available state, port 53 on aggregation device 5 can automatically be switched to an available state.

[0173] Figure 6 After the network device in the application configures multiple ports using the method provided in the embodiments of this application, it is then... Figure 6 In any given aggregation device, there is only one link between the aggregation device and the core device; there will be no loop connections. (Regarding...) Figure 6 There is only one link between any access device and the core device, and there will be no loop connection.

[0174] Figure 7 This is a schematic diagram of a port setting device provided in an embodiment of this application. The port setting device 10 is applied to a network device and includes a receiving module 11, a determining module 12, and a setting module 13.

[0175] The receiving module 11 is configured to receive at least one existing tier number, the at least one existing tier number including the tier number of the network device in the Ethernet, and / or the tier number of the neighboring device of the network device in the Ethernet;

[0176] The determining module 12 is used to determine a target port among multiple ports of the network device based on the at least one existing hierarchical number.

[0177] The setting module 13 is used to set the target port to an unavailable state and / or set the remaining ports to an available state, wherein the remaining ports are the ports other than the target port among the plurality of ports.

[0178] The port setting device provided in this embodiment can be used to execute the method described in any of the above method embodiments. Its implementation principle and technical effect are similar, and will not be described in detail here.

[0179] In one possible implementation, the determining module 12 is specifically used for,

[0180] Determine whether a first level number exists among the at least one existing level number, wherein the first level number is the level number of the network device in the Ethernet;

[0181] If the first level number exists in at least one of the existing level numbers, then the port other than the port that receives the first level number is determined as the target port among the plurality of ports;

[0182] If the first level number is not present in the at least one existing level number, then the first level number is determined based on the at least one existing level number, and the target port is determined among the plurality of ports based on the at least one existing level number and the first level number.

[0183] In one possible implementation, the determining module 12 is specifically used for,

[0184] Determine the minimum value among the at least one existing hierarchical number;

[0185] The sum of the minimum value and the preset value is determined as the first level number.

[0186] In one possible implementation, the determining module 12 is specifically used for,

[0187] Among the plurality of ports, a first port and a second port are determined, wherein the first port is the port that receives the at least one existing hierarchical number, and the second port is the port other than the first port among the plurality of ports;

[0188] The second port is designated as the first target port;

[0189] Based on the at least one existing hierarchical number and the first hierarchical number, determine the second target port in the first port;

[0190] The target port includes the first target port and the second target port.

[0191] In one possible implementation, the determining module 12 is specifically used for,

[0192] A second level number and a third level number are determined from the at least one existing level number, wherein the second level number is equal to the first level number, the number of the second level number is greater than or equal to zero, the third level number is less than the first level number, and the number of the third level number is greater than or equal to 1.

[0193] The port in the first port that receives the second level number is determined as the first candidate port;

[0194] The port that receives the third-level number in the first port is determined as the second candidate port, and a third candidate port is determined in the second candidate port according to a preset rule. The difference between the number of the second candidate ports and the number of the third candidate ports is 1.

[0195] The first candidate port and / or the third candidate port are determined as the second target port.

[0196] In one possible implementation, for any existing hierarchical number; the receiving module 11 is specifically used for,

[0197] Receive hierarchical configuration information, which includes the existing hierarchical number and a target field. The target field is used to indicate that the existing hierarchical number is the hierarchical number of the network device in the Ethernet, or to indicate that the existing hierarchical number is the hierarchical number of the neighboring device of the network device in the Ethernet.

[0198] In one possible implementation, the setting module 13 is specifically used for,

[0199] Determine whether there is a connection port among the target ports, where the connection port is a port connected to a neighboring device of the network device;

[0200] If a connection port exists in the target port, the status of the connection port is set to unavailable in the port configuration information to achieve the purpose of making the target port unavailable.

[0201] In one possible implementation, the setting module 13 is specifically used for,

[0202] In the port configuration information, the status of the remaining ports is set to the available status.

[0203] The port setting device provided in this embodiment can be used to execute the method described in any of the above method embodiments. Its implementation principle and technical effect are similar, and will not be described in detail here.

[0204] Figure 8 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application. Please refer to... Figure 8The electronic device 20 may include a processor 21 and a memory 22, wherein the processor 21 and the memory 22 can communicate; for example, the processor 21 and the memory 22 communicate via a communication bus 23, wherein the memory 22 is used to store computer execution instructions, and the processor 21 is used to invoke the computer execution instructions in the memory to execute the method shown in any of the above method embodiments.

[0205] Optionally, the electronic device 20 may also include a communication interface, which may include a transmitter and / or a receiver.

[0206] Electronic device 20 can be a network device as described in any of the above embodiments.

[0207] Optionally, the aforementioned processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this application can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.

[0208] This application provides a computer-readable storage medium storing computer-executable instructions; the computer-executable instructions are used to implement the methods shown in any of the above method embodiments.

[0209] This application provides a computer program product, which includes a computer program that, when executed, causes a computer to perform the method described in the above-described method embodiments.

[0210] All or part of the steps in the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a readable memory. When the program is executed, it performs the steps of the above method embodiments; and the aforementioned memory (storage medium) includes: read-only memory (ROM), RAM, flash memory, hard disk, solid-state drive, magnetic tape, floppy disk, optical disk, and any combination thereof.

[0211] This application describes embodiments with reference to flowchart illustrations and / or block diagrams of methods, apparatus (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 processing unit of a general-purpose computer, special-purpose computer, embedded processor, or other programmable terminal device to produce a machine, such that the instructions, which execute via the processing unit of the computer or other programmable terminal device, generate instructions for implementing the flowchart. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0212] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable terminal device to function 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 1 The function specified in one or more boxes.

[0213] These computer program instructions can also be loaded onto a computer or other programmable terminal device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable device for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 Figure 1 Figure 1 The steps of the function specified in one or more boxes.

[0214] Obviously, those skilled in the art can make various modifications and variations to the embodiments of this application without departing from the spirit and scope of this application. Therefore, if these modifications and variations to the embodiments of this application fall within the scope of the claims of this application and their equivalents, this application also intends to include these modifications and variations.

[0215] In this application, the term "comprising" and its variations can refer to non-limiting inclusion; the term "or" and its variations can refer to "and / or". The terms "first", "second", etc., in this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. In this application, "multiple" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.

[0216] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the invention disclosed in the specification and in practice. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed in this application.

Claims

1. A port setting method, characterized in that, The method is applied to a network device, and the method includes: Receive at least one existing tier number, the at least one existing tier number including the tier number of the network device in the Ethernet, and / or the tier number of the neighboring device of the network device in the Ethernet; Based on the at least one existing hierarchical number, determine the target port among the multiple ports of the network device; Set the target port to an unavailable state, and / or set the remaining ports to an available state, wherein the remaining ports are the ports other than the target port among the plurality of ports.

2. The method according to claim 1, characterized in that, Based on the at least one existing hierarchical number, determining the target port among multiple ports of the network device includes: Determine whether a first level number exists among the at least one existing level number, wherein the first level number is the level number of the network device in the Ethernet; If the first level number exists in at least one of the existing level numbers, then the port other than the port that receives the first level number is determined as the target port among the plurality of ports; If the first level number is not present in the at least one existing level number, then the first level number is determined based on the at least one existing level number, and the target port is determined among the plurality of ports based on the at least one existing level number and the first level number.

3. The method according to claim 2, characterized in that, Determining the first level number based on at least one existing level number includes: Determine the minimum value among the at least one existing hierarchical number; The sum of the minimum value and the preset value is determined as the first level number.

4. The method according to claim 2 or 3, characterized in that, Based on the at least one existing hierarchical number and the first hierarchical number, the target port is determined from the plurality of ports, including: Among the plurality of ports, a first port and a second port are determined, wherein the first port is the port that receives the at least one existing hierarchical number, and the second port is the port other than the first port among the plurality of ports; The second port is designated as the first target port; Based on the at least one existing hierarchical number and the first hierarchical number, determine the second target port in the first port; The target port includes the first target port and the second target port.

5. The method according to claim 4, characterized in that, Determining a second target port in the first port based on the at least one existing hierarchical number and the first hierarchical number includes: A second level number and a third level number are determined from the at least one existing level number, wherein the second level number is equal to the first level number, the number of the second level number is greater than or equal to zero, the third level number is less than the first level number, and the number of the third level number is greater than or equal to 1. The port in the first port that receives the second level number is determined as the first candidate port; The port that receives the third-level number in the first port is determined as the second candidate port, and a third candidate port is determined in the second candidate port according to a preset rule. The difference between the number of the second candidate ports and the number of the third candidate ports is 1. The first candidate port and / or the third candidate port are determined as the second target port.

6. The method according to any one of claims 1-5, characterized in that, For any existing hierarchical number; receiving the existing hierarchical number includes: Receive hierarchical configuration information, which includes the existing hierarchical number and a target field. The target field is used to indicate that the existing hierarchical number is the hierarchical number of the network device in the Ethernet, or to indicate that the existing hierarchical number is the hierarchical number of the neighboring device of the network device in the Ethernet.

7. The method according to any one of claims 1-6, characterized in that, Setting the target port to an unavailable state includes: Determine whether there is a connection port among the target ports, where the connection port is a port connected to a neighboring device of the network device; If a connection port exists in the target port, the status of the connection port is set to unavailable in the port configuration information to achieve the purpose of making the target port unavailable.

8. The method according to any one of claims 1-7, characterized in that, Configure the remaining ports to be available, including: In the port configuration information, the status of the remaining ports is set to the available status.

9. A port setting device, characterized in that, The port setting device is applied to network devices. The port setting device includes a receiving module, a determining module, and a setting module. The receiving module is configured to receive at least one existing tier number, the at least one existing tier number including the tier number of the network device in the Ethernet, and / or the tier number of the neighboring device of the network device in the Ethernet; The determining module is used to determine a target port among multiple ports of the network device based on the at least one existing hierarchical number. The setting module is used to set the target port to an unavailable state and / or set the remaining ports to an available state, wherein the remaining ports are the ports other than the target port among the plurality of ports.

10. An electronic device, comprising: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1-8.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-8.

12. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-8.