A routing configuration method, apparatus, and electronic device for a switch.
By setting up next-hop proxy entries on the interface board and utilizing proxy ports and cascade ports to forward data packets, the problem of interface board routing configuration failure caused by insufficient next-hop table resources of the switching chip was solved, thus improving the stability and scalability of network communication.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-07
- Publication Date
- 2026-03-06
AI Technical Summary
Insufficient next-hop table resources in the switching chip caused the interface board routing configuration to fail, resulting in network communication failure.
By setting up next-hop proxy entries on the interface board, the number of next-hop entries is reduced. Data packets are forwarded using the proxy port and cascade port of the interface board. The routing table of the interface board is configured in conjunction with the routing configuration table of the main control board.
It solves the problem of insufficient next-hop table resources, improves the data packet forwarding capability of the switching system, avoids network communication failures, and provides greater expansion space.
Smart Images

Figure CN116346618B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of network communication technology, and specifically relates to a routing configuration method, device and electronic equipment for a switch. Background Technology
[0002] The routing capacity of a switch system is limited by both the routing table and the next-hop table of the switching chip. Considering that multiple routes share the next-hop table, the routing table of a switching chip is usually designed to have a larger capacity than the next-hop table. In large Layer 2 networks, there are a large number of host routes, and each host route requires an independent next-hop table entry. When the resources of the next-hop table of the switching chip are insufficient, it will cause the interface board to fail to configure the route. As a result, when the interface board receives a data packet whose destination is that route, it will fail to find the route and will either perform software forwarding on the CPU or drop the packet, leading to network communication failure. Summary of the Invention
[0003] In view of the above problems, embodiments of the present invention provide a routing configuration method, apparatus and electronic device for a switch, so as to overcome the above problems or at least partially solve the above problems.
[0004] In a first aspect, this invention provides a routing configuration method for a switch, applied to an interface board, the method comprising:
[0005] Obtain the proxy ports for the interface board and other interface boards from the main control board;
[0006] Obtain the other interface board numbers corresponding to the proxy ports of the other interface boards;
[0007] Based on the other interface board numbers, a next-hop table entry is set for each interface board whose outgoing interface is the proxy port of the other interface board, thus obtaining the next-hop proxy table of the interface board;
[0008] Configure the next-hop table of the interface board according to the next-hop proxy table of the interface board and the routing configuration table obtained from the main control board; wherein, the next-hop table of the interface board includes: routing table entries with next-hop index pointing to the local interface, and routing table entries with next-hop index pointing to the proxy ports of other interface boards.
[0009] Configure the routing table of the interface board according to the next-hop index in the next-hop table of the interface board and the routing configuration table.
[0010] Preferably, before obtaining the proxy ports of the interface board and other interface boards from the main control board, the procedure includes:
[0011] Obtain the cascade port of the interface board, select any one of the cascade ports as the proxy port, and send it to the main control board.
[0012] Preferably, configuring the next-hop table of the interface board according to the next-hop proxy table of the interface board and the routing configuration table obtained from the main control board includes:
[0013] Obtain the routing configuration table;
[0014] Based on the routing configuration table, determine the local next-hop table of the interface board;
[0015] Configure the next-hop table of the interface board based on the local next-hop table and the next-hop proxy table.
[0016] Preferably, determining the local next-hop table of the interface board based on the routing configuration table of the main control board includes:
[0017] Obtain the outgoing interface information from the routing configuration table;
[0018] Based on the outgoing interface information, determine the next-hop entry of the local interface of the interface board;
[0019] The local next-hop table of the interface board is determined based on the next-hop table entries of the local interface.
[0020] Preferably, configuring the routing table of the interface board according to the next-hop index in the next-hop table of the interface board and the routing configuration table includes:
[0021] Determine the next-hop entry in the next-hop table of the interface board; wherein, the next-hop entry includes: the routing table entry of the local interface and the routing table entry of the proxy port of the other interface board;
[0022] Based on the next-hop table entry, generate the next-hop index corresponding to the next-hop table entry respectively;
[0023] Write the next-hop index into the routing configuration table to configure the routing table of the interface board.
[0024] Preferably, it further includes:
[0025] When the first data packet is received through the service port, the routing table of the interface board is queried according to the first destination IP address in the first data packet to determine the next hop index corresponding to the first destination IP address;
[0026] Based on the next-hop index corresponding to the first destination IP address, the next-hop table of the interface board is queried to determine the first outgoing interface used to forward the first data packet;
[0027] If the first outgoing interface is a local interface, the first data packet is forwarded using the local interface;
[0028] When the first outgoing interface is a proxy port of another interface board, the information of the first outgoing interface is encapsulated into the header information of the first data packet, and the encapsulated first data packet is forwarded using the cascade port of the interface board.
[0029] Preferably, it further includes:
[0030] Upon receiving a second data packet forwarded by the other interface boards via the cascade port, the header information of the second data packet is parsed.
[0031] Determine the second outgoing interface for forwarding the second data packet;
[0032] When the second outgoing interface is the proxy port of the interface board, the routing table of the interface board is queried according to the second destination IP address in the second data packet to determine the next hop index corresponding to the second destination IP address;
[0033] Based on the next-hop index corresponding to the second destination IP address, the next-hop table of the interface board is queried to determine the first outgoing interface used to forward the second data packet; if the second outgoing interface is a local interface, the second data packet is forwarded using the local interface.
[0034] Preferably, it further includes:
[0035] When the second output interface is not the proxy port of the interface board, the second data packet is forwarded using the cascade port of the interface board.
[0036] A second aspect of the present invention provides a routing configuration device for a switch, applied to an interface board, the device comprising:
[0037] The first acquisition module is used to acquire the proxy ports of the interface board and other interface boards from the main control board;
[0038] The second acquisition module is used to acquire the other interface board number corresponding to the proxy port of the other interface board;
[0039] The third acquisition module is used to set a next-hop table entry for each of the other interface boards based on the other interface board numbers, with the outgoing interface being the proxy port of the interface board, so as to obtain the next-hop proxy table of the interface board.
[0040] The first configuration module is used to configure the next-hop table of the interface board according to the next-hop proxy table of the interface board and the routing configuration table obtained from the main control board; wherein, the next-hop table of the interface board includes: routing table entries with next-hop index pointing to the local interface, and routing table entries with next-hop index pointing to the proxy ports of other interface boards.
[0041] The second configuration module is used to configure the routing table of the interface board according to the next-hop index in the next-hop table of the interface board and the routing configuration table.
[0042] In a third aspect of the present invention, an electronic device is provided, the electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program as the routing configuration method of the switch described in the first aspect of the present invention.
[0043] The routing configuration method for a switch provided by this invention, applied to interface boards, firstly obtains the proxy ports of the interface board and other interface boards from the main control board; then obtains the other interface board numbers corresponding to the proxy ports of the other interface boards; based on the other interface board numbers, sets a next-hop table entry for each of the other interface boards with the outgoing interface being the proxy port of the interface board, thus obtaining the next-hop proxy table of the interface board. With this method, when the next-hop outgoing interface is not a local interface route, only one next-hop proxy table entry needs to be set for each of the other interface boards, allowing the switch system to support more host devices.
[0044] Then, based on the next-hop proxy table of the interface board and the routing configuration table obtained from the main control board, the next-hop table of the interface board is configured. The next-hop table of the interface board includes routing table entries whose next-hop index points to the local interface, and routing table entries whose next-hop index points to the proxy ports of other interface boards. Finally, based on the next-hop index in the next-hop table of the interface board and the routing configuration table, the routing table of the interface board is configured. The method provided by this invention can significantly reduce the number of next-hop table entries occupied by the switching chip, avoiding the situation where each route requires a separate next-hop table entry, thus saving next-hop table entry resources. This not only solves the problem of insufficient next-hop table resources causing interface board routing configuration failures, leading to network communication failures when the interface board receives data packets destined for that route, but also provides greater expansion space for the switching system in the future, greatly improving the data packet forwarding capabilities of the switching system. Attached Figure Description
[0045] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0046] Figure 1 This is a schematic diagram of a chassis switch provided in an embodiment of the present invention;
[0047] Figure 2This is a schematic diagram of a routing table for a switching chip provided in an embodiment of the present invention;
[0048] Figure 3 This is a schematic diagram of a next-hop table for a switching chip provided in an embodiment of the present invention;
[0049] Figure 4 This is a flowchart of the steps of a routing configuration method for a switch provided in an embodiment of the present invention;
[0050] Figure 5 This is a schematic diagram of a next-hop proxy table for a switching chip provided in an embodiment of the present invention;
[0051] Figure 6 This is a schematic diagram of the routing table and next-hop table configuration on an interface board 1 provided in an embodiment of the present invention;
[0052] Figure 7 This is a schematic diagram of a process for routing and forwarding a first data packet on interface board 1 according to an embodiment of the present invention;
[0053] Figure 8 This is a schematic diagram of a process for routing and forwarding a second data packet on interface board 1 according to an embodiment of the present invention;
[0054] Figure 9 This is a schematic diagram of a routing configuration device for a switch provided in an embodiment of the present invention.
[0055] Figure 10 This is a schematic diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0056] Exemplary embodiments of the present invention will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this invention will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
[0057] Reference Figure 1 , Figure 1 This is a schematic diagram of a chassis switch provided in an embodiment of the present invention. It uses a single main control board, a single switching network board, interface board 1, and interface board 2 as examples. A chassis switch typically includes a main control board, a switching network board, and interface boards. The main control board controls the flow of data within the switch, the switching network board is used for data switching within the switch, and the interface boards are responsible for receiving and sending user data packets. To achieve... Figure 1The chassis switch provided in the system routes and forwards the received data packets on the switch system. The main control board sends the routing table entries to each interface board through the control channel. After receiving the routing configuration information from the main control board, the control channel processing unit of each interface board sends it to the switching chip, and forwards the data packets through the routing information in the switching chip.
[0058] The switching chip configures routing information into a routing table and a next-hop table, as shown in the reference. Figure 2 , Figure 2 This is a schematic diagram of a routing table for a switching chip provided in an embodiment of the present invention. Figure 2 The routing table contains IP addresses and subnet masks, as well as indexes to the next-hop table; see reference. Figure 3 , Figure 3 This is a schematic diagram of a next-hop table for a switching chip provided in an embodiment of the present invention. Figure 3 The next-hop table contains the MAC address and outgoing interface of the next-hop device. When interface board 1 receives a user data packet, it looks up the routing table of the switching chip based on the first destination IP address to obtain the index of the next-hop table. Based on the index, it looks up the next-hop table to obtain the destination MAC address of the next-hop device and the next-hop outgoing interface for forwarding, and then forwards the packet from the corresponding outgoing interface.
[0059] Example 1
[0060] Reference Figure 4 , Figure 4 This is a flowchart illustrating the steps of a routing configuration method for a switch according to an embodiment of the present invention; as shown in the figure, a routing configuration method for a switch, applied to an interface board, is provided, and the steps include:
[0061] Step S401: Obtain the proxy ports of the interface board and other interface boards from the main control board.
[0062] In this embodiment, the interface board obtains proxy ports of the interface board and other interface boards from the main control board. Each other interface board has a proxy port, and the interface board obtains the proxy port of each other interface board.
[0063] Step S402: Obtain the other interface board number corresponding to the proxy port of the other interface board.
[0064] In this embodiment, the interface board obtains the other interface board number corresponding to the proxy port of other interface boards. In this way, the interface board number of the proxy port of other interface boards can be determined, the next outgoing interface on other different interface boards can be distinguished, and the proxy port of other interface boards can be matched one by one with the interface board where it is located.
[0065] Step S403: Based on the other interface board numbers, set a next-hop table entry for each interface board whose outgoing interface is the proxy port of the other interface board, and obtain the next-hop proxy table of the interface board.
[0066] In this embodiment, the interface board can know the number of other interface boards by using their numbers. The interface board can then set a next-hop proxy entry for each of the other interface boards' proxy ports. By collecting these next-hop proxy entries, the interface board can obtain the next-hop proxy entry for the interface board.
[0067] For example, refer to Figure 5 , Figure 5 This is a schematic diagram of a next-hop proxy table for a switching chip according to an embodiment of the present invention. As can be seen from the diagram, through the method provided in this embodiment, the next-hop table entries are combined with... Figure 3 Assuming the interface board is interface board 1 and the other interface boards are interface board 2, from Figure 5 It can be seen that using one next-hop proxy table corresponding to interface board 2 can replace the previous one. Figure 3 The three next-hop proxy tables corresponding to interface board 2 allow for the reduction of the number of next-hop outgoing interface entries in the next-hop tables of other interface boards. This embodiment does not limit the number of other interface boards. Figure 5 As can be seen from this, only for other interface boards 2 that are not interface board 1, a next-hop proxy table entry is set. The next-hop destination MAC in the next-hop proxy table entry is the MAC of the Layer 3 interface of this switch. If there are 8 other interface boards, then there are 8 next-hop proxy table entries in the next-hop proxy table of interface board 1.
[0068] Step S404: Configure the next-hop table of the interface board according to the next-hop proxy table of the interface board and the routing configuration table obtained from the main control board; wherein, the next-hop table of the interface board includes: routing table entries with next-hop index pointing to the local interface, and routing table entries with next-hop index pointing to the proxy ports of other interface boards.
[0069] In this embodiment, interface board 1 obtains the routing configuration table from the main control board, referring to... Figure 2 Based on the routing configuration table, retrieve the next-hop table corresponding to the routing configuration table in the main control board, and download the next-hop table entry for the outgoing interface on interface board 1. Figure 3 Then, the next-hop proxy table obtained in step S104 is integrated together to configure the next-hop proxy table of interface board 1. Figure 6 This is a schematic diagram illustrating the configuration of the routing table and next-hop table on an interface board 1 according to an embodiment of the present invention; see reference. Figure 6The table on the right is the next-hop table of interface board 1, and the next-hop index is regenerated. Of course, if there is already an index on the original main control board, then only the next-hop index corresponding to the next-hop proxy table in the next-hop table needs to be regenerated. From the table, it can be seen that the next-hop index points to the routing table entry of the local interface, and the next-hop index points to the routing table entry of the proxy port of other interface boards. The local interface indicates that the interface is the outgoing interface on interface board 1.
[0070] Step S405: Configure the routing table of the interface board according to the next-hop index in the next-hop table of the interface board and the routing configuration table.
[0071] In this embodiment, the next-hop index in the next-hop table of interface board 1 is obtained, and the next-hop index is written into the next-hop table index entry next to the corresponding route key value in the routing table, thus completing the routing table configuration of interface board 1. (Refer to...) Figure 6 The table on the left side of the interface board is used to complete the routing table configuration for interface board 1, combined with... Figure 6 As shown in the diagram, each local interface on interface board 1 in the routing table has one corresponding next-hop table entry, while the next-hop tables for other interface boards only have one entry.
[0072] The routing configuration method for a switch provided by this invention, applied to an interface board, firstly obtains the proxy ports of the interface board and other interface boards from the main control board; then obtains the other interface board numbers corresponding to the proxy ports of the other interface boards; based on the other interface board numbers, sets a next-hop table entry for each of the other interface boards, with the outgoing interface being the proxy port of the interface board, thus obtaining the next-hop proxy table of the interface board. This method, when the next-hop outgoing interface is not the local interface, only one next-hop proxy table entry needs to be set for each of the other interface boards, which can greatly reduce the number of next-hop table entries occupied by the switching chip, saving next-hop table resources, and allowing the switch system to support more host devices. Then, based on the next-hop proxy table of the interface board and the routing configuration table obtained from the main control board, the next-hop table of the interface board is configured; wherein, the next-hop table of the interface board includes: routing table entries with next-hop indexes pointing to the local interface, and routing table entries with next-hop indexes pointing to the proxy ports of other interface boards; finally, based on the next-hop indexes in the next-hop table of the interface board and the routing configuration table, the routing table of the interface board is configured. This method of routing configuration can address the issue of numerous host routes in a large Layer 2 network, each requiring an independent next-hop table entry. When the resources of the next-hop table in the switching chip are insufficient, it can resolve the problem of interface board routing configuration failure. When the interface board receives a data packet destined for that route, it will fail to find the route and will either perform software forwarding on the CPU or drop the packet, leading to network communication failure.
[0073] In one embodiment, before obtaining the proxy ports of the interface board and other interface boards from the main control board, the method includes: obtaining the cascade ports of the interface board, selecting any one of the cascade ports as a proxy port, and sending it to the main control board.
[0074] In this embodiment, before obtaining the proxy ports of the interface board and other interface boards from the main control board, all cascade ports of interface board 1 are obtained, and the cascade ports on the interface board are set to a mixed search mode. Any one of the cascade ports is selected as a proxy port, and the proxy port information is sent to the main control board. According to the method of interface board 1, other interface boards will also send their respective proxy ports to the main control board. The main control board will then have the proxy port information of each interface board. The cascade port can be used for forwarding data packets between different interface boards. Data can be forwarded through the switching network board via the cascade port.
[0075] In one embodiment, configuring the next-hop table of the interface board according to the next-hop proxy table of the interface board and the routing configuration table obtained from the main control board includes: obtaining the routing configuration table; determining the local next-hop table of the interface board based on the routing configuration table; and configuring the next-hop table of the interface board based on the local next-hop table and the next-hop proxy table.
[0076] In this embodiment, a switching chip is provided in the interface board 1. The switching chip obtains the routing configuration table from the main control board and combines it with... Figure 2 and Figure 3 ,from Figure 2 In the routing table, the local next-hop table of interface board 1 can be found by using the next-hop table index, and then the local next-hop table can be obtained. Combined with the previously obtained next-hop proxy table of interface board 1, the next-hop table of interface board 1 can be configured together through the local next-hop table and the next proxy table.
[0077] In one embodiment, determining the local next-hop table of the interface board based on the routing configuration table of the main control board includes: obtaining outgoing interface information from the routing configuration table; determining the next-hop table entries of the local interfaces of the interface board based on the outgoing interface information; and determining the local next-hop table of the interface board based on the next-hop table entries of the local interfaces.
[0078] In this embodiment, interface board 1 obtains the outgoing interface information from the routing configuration table. The outgoing interface information includes the interface board number, combined with... Figure 3 It can be seen that each next-hop output interface has a corresponding interface board number. By using the interface board number, we can know whether the corresponding next-hop output interface is a local interface of interface board 1, and then determine the next-hop table entry of the local interface in interface board 1. The switching chip in interface board 1 downloads the next-hop table entry of the local interface, and thus obtains the local next-hop table of interface board 1.
[0079] In one embodiment, configuring the routing table of the interface board according to the next-hop index in the next-hop table of the interface board and the routing configuration table includes: determining the next-hop entries in the next-hop table of the interface board; wherein, the next-hop entries include: the routing table entries of the local interface and the routing table entries of the proxy ports of other interface boards; generating the next-hop indexes corresponding to the next-hop entries based on the next-hop entries; and writing the next-hop indexes into the routing configuration table to configure the routing table of the interface board.
[0080] In this embodiment, configuring the routing table of the interface board first requires determining the next-hop entry in the next-hop table of the interface board. The next-hop entry includes the routing table entry of the local interface and the routing table entry of the proxy port of other interface boards. Based on the next-hop entry, the next index corresponding to the next-hop entry is generated. The next-hop index is written into the routing table according to the corresponding IP address and mask in the routing table to complete the routing table configuration of interface board 1.
[0081] In one embodiment, reference is made to... Figure 7 , Figure 7 This is a schematic diagram illustrating the routing and forwarding process of data packets on interface board 1 according to an embodiment of the present invention. When using the routing configuration method for a switch provided by the present invention to forward data packets on interface board 1, the specific routing and forwarding is as follows:
[0082] Step S701: When the first data packet is received through the service port, the routing table of the interface board is queried according to the first destination IP address in the first data packet to determine the next hop index corresponding to the first destination IP address.
[0083] In this embodiment, the service port of interface board 1 receives a user data packet from the network, namely the first data packet. Based on the first destination IP address corresponding to the first data packet, it queries the main control board for the routing table that needs to be downloaded to the switching chip of interface board 1. Through the routing table, the next hop index corresponding to the first destination IP address can be obtained.
[0084] Step S702: Based on the next-hop index corresponding to the first destination IP address, query the next-hop table of the interface board to determine the first outgoing interface used to forward the first data packet.
[0085] In this embodiment, the next-hop index corresponding to the first destination IP address can be used to query the next-hop table in interface board 1. By querying the contents of the next-hop table, the first outgoing interface used to forward the first data packet can be determined. The first outgoing interface includes a device number and a port number. The device number can be understood as the corresponding interface board number, and the port number is the outgoing interface number on the interface board.
[0086] Step S703: If the first outgoing interface is a local interface, the first data packet is forwarded using the local interface.
[0087] In this embodiment, after determining the first outgoing interface information, it is possible to determine whether the outgoing interface is a local interface by using the interface board number, obtain the port number corresponding to the local interface, and then process the first data packet through the switching chip in the switch before forwarding the first data packet using the local interface corresponding to the port number. The switching chip processes the first data packet by setting the source MAC and destination MAC of the first data packet to the MAC of the Layer 3 interface of this switch.
[0088] Step S704: If the first outgoing interface is a proxy port of another interface board, encapsulate the information of the first outgoing interface into the header information of the first data packet, and forward the encapsulated first data packet using the cascade port of the interface board.
[0089] In this embodiment, when the first output interface is a proxy port (interface board 2) of other interface boards, the information of the first output interface is encapsulated into the header information of the first data packet, and the encapsulated first data packet is forwarded to the cascade port of other interface boards (interface board 2) using the cascade port of interface board 1, and then the other interface boards perform subsequent forwarding operations.
[0090] In one embodiment, the method further includes: when a second data packet forwarded by another interface board is received through a cascade port, parsing the header information of the second data packet to determine a second outgoing interface for forwarding the second data packet; when the second outgoing interface is a proxy port of the interface board, querying the routing table of the interface board according to the second destination IP address in the second data packet to determine the next-hop index corresponding to the second destination IP address; querying the next-hop table of the interface board based on the next-hop index corresponding to the second destination IP address to determine a first outgoing interface for forwarding the second data packet; and when the second outgoing interface is a local interface, forwarding the second data packet using the local interface.
[0091] In this embodiment, refer to Figure 8 , Figure 8 This is a schematic diagram illustrating the routing and forwarding process of a second data packet on interface board 1 according to an embodiment of the present invention. When using the routing configuration method for a switch provided by the present invention to forward data packets on interface board 1, the specific routing and forwarding is as follows:
[0092] Step S801: When a second data packet forwarded by the other interface board is received through the cascade port, the header information of the second data packet is parsed to determine the second output interface used to forward the second data packet.
[0093] In this embodiment, when the cascade port of interface board 1 receives a second data packet forwarded by another interface board, the cascade port first parses the header information of the second data packet. Based on the header information, the second output interface used to forward the second data packet can be determined. The second output interface includes the interface board number and the output interface type.
[0094] Step S802: When the second outgoing interface is the proxy port of the interface board, query the routing table of the interface board according to the second destination IP address in the second data packet to determine the next hop index corresponding to the second destination IP address.
[0095] In this embodiment, when it is determined that the second outgoing interface is the proxy port of interface board 1, the second destination IP address in the second data packet is obtained, the routing table of the interface board is queried, and the next-hop index corresponding to the second destination IP address is determined.
[0096] Step S803: Based on the next-hop index corresponding to the second destination IP address, query the next-hop table of the interface board to determine the first outgoing interface used to forward the second data packet.
[0097] In this embodiment, the next-hop index corresponding to the second destination IP address can be used to query the next-hop table in interface board 1. By querying the contents of the next-hop table, the first outgoing interface used to forward the first data packet can be determined. The first outgoing interface includes a device number and a port number. The device number can be understood as the corresponding interface board number, and the port number is the outgoing interface number on the interface board.
[0098] Step S804: If the second outgoing interface is a local interface, the second data packet is forwarded using the local interface.
[0099] In this embodiment, after determining the first outgoing interface information, it is possible to determine whether the outgoing interface is a local interface by the interface board number, obtain the port number corresponding to the local interface, process the second data packet through the switching chip in the switch, and then forward the second data packet using the local interface corresponding to the port number.
[0100] In one embodiment, reference is made to... Figure 8 It also includes:
[0101] Step S805: When the second output interface is not the proxy port of the interface board, the second data packet is forwarded using the cascade port of the interface board.
[0102] In this embodiment, when the second output interface is not the proxy port of interface board 1, the interface board number (assuming interface board 2) used to forward the second data packet is obtained according to the header information of the second data packet. After the second data packet is processed by the switching chip in the switch through the cascading port of interface board 1, it is forwarded to interface board 2 through the data channel via the cascading port of interface board 1, and then the interface board 2 performs the subsequent forwarding operation.
[0103] Example 2
[0104] In a second aspect, the present invention provides a routing configuration apparatus for a switch, referring to... Figure 9 , Figure 9 This is a schematic diagram of a routing configuration device for a switch provided in an embodiment of the present invention; applied to an interface board, the device includes: a first acquisition module 901, a second acquisition module 902, a third acquisition module 903, a first configuration module 904, and a second configuration module 905.
[0105] The first acquisition module 901 is used to acquire the proxy ports of the interface board and other interface boards from the main control board;
[0106] The second acquisition module 902 is used to acquire the other interface board number corresponding to the proxy port of the other interface board;
[0107] The third acquisition module 903 is used to set a next-hop table entry for each of the other interface boards based on the other interface board numbers, with the outgoing interface being the proxy port of the interface board, so as to obtain the next-hop proxy table of the interface board.
[0108] The first configuration module 904 is used to configure the next-hop table of the interface board according to the next-hop proxy table of the interface board and the routing configuration table obtained from the main control board; wherein, the next-hop table of the interface board includes: routing table entries with next-hop index pointing to the local interface, and routing table entries with next-hop index pointing to the proxy ports of other interface boards.
[0109] The second configuration module 905 is used to configure the routing table of the interface board according to the next-hop index in the next-hop table of the interface board and the routing configuration table.
[0110] In one embodiment, the first configuration module further includes a first configuration submodule.
[0111] The first configuration submodule is used to obtain the routing configuration table;
[0112] Based on the routing configuration table, determine the local next-hop table of the interface board;
[0113] Configure the next-hop table of the interface board based on the local next-hop table and the next-hop proxy table.
[0114] In one embodiment, the first configuration submodule includes a first determination submodule.
[0115] The first determining submodule is used to obtain the outgoing interface information in the routing configuration table;
[0116] Based on the outgoing interface information, determine the next-hop entry of the local interface of the interface board;
[0117] The local next-hop table of the interface board is determined based on the next-hop table entries of the local interface.
[0118] In one embodiment, the above-described apparatus further includes a first forwarding module.
[0119] The first forwarding module is used to, when receiving the first data packet through the service port, query the routing table of the interface board according to the first destination IP address in the first data packet to determine the next hop index corresponding to the first destination IP address;
[0120] Based on the next-hop index corresponding to the first destination IP address, the next-hop table of the interface board is queried to determine the first outgoing interface used to forward the first data packet;
[0121] If the first outgoing interface is a local interface, the first data packet is forwarded using the local interface;
[0122] When the first outgoing interface is a proxy port of another interface board, the information of the first outgoing interface is encapsulated into the header information of the first data packet, and the encapsulated first data packet is forwarded using the cascade port of the interface board.
[0123] In one embodiment, the above-described apparatus further includes a second forwarding module.
[0124] The second forwarding module is used to parse the header information of the second data packet when it receives the second data packet forwarded by the other interface board through the cascade port.
[0125] Determine the second outgoing interface for forwarding the second data packet;
[0126] When the second outgoing interface is the proxy port of the interface board, the routing table of the interface board is queried according to the second destination IP address in the second data packet to determine the next hop index corresponding to the second destination IP address;
[0127] Based on the next-hop index corresponding to the second destination IP address, the next-hop table of the interface board is queried to determine the second outgoing interface used to forward the second data packet; if the second outgoing interface is a local interface, the second data packet is forwarded using the local interface.
[0128] In addition, the second forwarding module also includes forwarding the second data packet using the cascade port of the interface board when the second output interface is not the proxy port of the interface board.
[0129] Example 3
[0130] In a third aspect of the present invention, an electronic device is provided, the electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program as the routing configuration method of the switch described in the first aspect of the present invention.
[0131] In this embodiment, reference is made to... Figure 10 , Figure 10 This is a schematic diagram of an electronic device provided in an embodiment of the present invention; as shown. Figure 4 As shown, the electronic device 100 includes a memory 110 and a processor 120. The memory 110 and the processor 120 are connected via a bus communication connection. The memory 110 stores a computer program that can run on the processor 120 to implement the routing configuration method of the switch described in the first aspect of the present application.
[0132] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0133] Embodiments of the present invention are described with reference to flowchart illustrations and / or block diagrams of methods and apparatus according to embodiments of the present invention. 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 A device that provides the functions specified in one or more boxes.
[0134] These 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 1 The function specified in one or more boxes.
[0135] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing 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.
[0136] Although preferred embodiments of the present invention 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 present invention.
[0137] 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 terms "comprising," "including," or any other variations thereof are 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 one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.
[0138] The routing configuration method, apparatus, and electronic device for a switch provided by the present invention have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method of routing configuration of a switch, characterized by, The method is applied to an interface board, and the method comprises the following steps: Obtaining a cascade port of the interface board, setting the cascade port of the interface board as a mixed search mode, selecting any cascade port as a proxy port, and sending to a master control board; Obtaining a proxy port of the interface board and other interface boards from the master control board; Obtaining other interface board numbers corresponding to the proxy ports of the other interface boards; Based on the other interface board numbers, setting one out interface of the interface board as a next hop table item of the proxy port of the other interface board, obtaining a next hop proxy table of the interface board, and setting a next hop destination MAC of the next hop table item as a three-layer interface MAC of the local switch; According to the next hop proxy table of the interface board and a routing configuration table obtained from the master control board, configuring a next hop table of the interface board; wherein the next hop table of the interface board comprises: a routing table item of a next hop index pointing to a local interface, and a routing table item of the next hop index pointing to a proxy port of the other interface board; According to the next hop index in the next hop table of the interface board and the routing configuration table, configuring a routing table of the interface board; When a first data packet is received through a service port, according to a first destination IP address in the first data packet, querying the routing table of the interface board to determine a next hop index corresponding to the first destination IP address; Based on the next hop index corresponding to the first destination IP address, querying the next hop table of the interface board to determine a first out interface for forwarding the first data packet; In the case that the first out interface is a local interface, the first data packet is forwarded by using the local interface; In the case that the first out interface is a proxy port of the other interface board, the information of the first out interface is encapsulated into the header information of the first data packet, and the encapsulated first data packet is forwarded by using the cascade port of the interface board.
2. The method of claim 1, wherein, According to the next hop proxy table of the interface board and a routing configuration table obtained from the master control board, configuring a next hop table of the interface board, comprising: Obtaining the routing configuration table; Based on the routing configuration table, determining a local next hop table of the interface board; Based on the local next hop table and the next hop proxy table, configuring the next hop table of the interface board.
3. The method of claim 2, wherein, Based on the routing configuration table of the master control board, determining a local next hop table of the interface board, comprising: Obtaining out interface information in the routing configuration table; Based on the out interface information, determining a next hop table item of a local interface of the interface board; Based on the next hop table item of the local interface, determining the local next hop table of the interface board.
4. The method of claim 1, wherein, According to the next hop index in the next hop table of the interface board and the routing configuration table, configuring a routing table of the interface board, comprising: Determining a next hop table item in the next hop table of the interface board; wherein the next hop table item comprises: a routing table item of the local interface and a routing table item of the proxy port of the other interface board; Based on the next hop table item, generating a next hop index corresponding to the next hop table item respectively; Writing the next hop index into the routing configuration table to configure the routing table of the interface board.
5. The method of claim 1, wherein, Further comprising: In the case that the second data packet forwarded by the other interface board is received through the cascade port, packet header information of the second data packet is parsed, a second out interface for forwarding the second data packet is determined; when the second out interface is the proxy port of the interface board, a routing table of the interface board is queried according to a second destination IP address in the second data packet to determine a next hop index corresponding to the second destination IP address; based on the next hop index corresponding to the second destination IP address, a next hop table of the interface board is queried to determine a second out interface for forwarding the second data packet; in the case that the second out interface is a local interface, the second data packet is forwarded by using the local interface.
6. The method of claim 5, wherein, Further comprising: when the second out interface is not the proxy port of the interface board, the second data packet is forwarded by using the cascade port of the interface board.
7. A routing configuration apparatus of a switch, characterized by comprising: The device is applied to an interface board and comprises: a first obtaining module configured to obtain a cascade port of the interface board, set the cascade port of the interface board to a hybrid lookup mode, select any cascade port as a proxy port, and send the selected cascade port to a master control board; and obtain proxy ports of other interface boards from the master control board; a second obtaining module configured to obtain other interface board numbers corresponding to the proxy ports of the other interface boards; a third obtaining module configured to set a next hop table item of an out interface of the interface board as the proxy port of the other interface board based on the other interface board numbers, and obtain a next hop proxy table of the interface board, wherein a next hop destination MAC of the next hop table item is a three-layer interface MAC of the local switch; a first configuring module configured to configure a next hop table of the interface board according to the next hop proxy table of the interface board and a routing configuration table obtained from the master control board, wherein the next hop table of the interface board comprises a routing table item in which a next hop index points to a local interface, and a routing table item in which a next hop index points to a proxy port of an other interface board; a second configuring module configured to configure a routing table of the interface board according to the next hop index in the next hop table of the interface board and the routing configuration table; a first forwarding module configured to, when a first data packet is received through a service port, query a routing table of the interface board according to a first destination IP address in the first data packet to determine a next hop index corresponding to the first destination IP address; query a next hop table of the interface board based on the next hop index corresponding to the first destination IP address to determine a first out interface for forwarding the first data packet; in the case that the first out interface is a local interface, forward the first data packet by using the local interface; and in the case that the first out interface is a proxy port of an other interface board, encapsulate information of the first out interface into header information of the first data packet, and forward the encapsulated first data packet by using the cascade port of the interface board.
8. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein The processor implements the routing configuration method of the switch according to any one of claims 1 to 6 when executing the computer program.
Citation Information
Patent Citations
Message forwarding method and device
CN106330553A
Network equipment, main control board, message transmission method and machine readable storage medium
CN110768908A