A method, apparatus, and computer device for sending messages based on Layer 3 routing.

By separating host routing and network segment routing in the access layer device and using different lookup methods, the problem of host routing occupying a large amount of logic circuit resources is solved, resulting in access layer devices with smaller chip area and lower cost.

CN116436873BActive Publication Date: 2026-06-30WXILICON TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
WXILICON TECH CO LTD
Filing Date
2022-11-21
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

In existing Layer 3 IP routing technologies, host routing consumes a large amount of TCAM or longest prefix match lookup logic circuit resources, resulting in excessively large chip area and high cost.

Method used

Separate the host routing and network segment routing settings of the access layer devices and use different routing table lookup methods. The host routing uses exact matching lookup, while the network segment routing uses fuzzy matching lookup, which reduces the occupation of TCAM or longest prefix matching lookup logic circuits.

Benefits of technology

By separating the settings and using different lookup methods, the chip area is reduced, the chip cost is lowered, and a smaller access layer device is achieved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116436873B_ABST
    Figure CN116436873B_ABST
Patent Text Reader

Abstract

This application relates to a method, apparatus, computer device, and storage medium for sending packets based on Layer 3 routing. The method includes: acquiring a packet to be sent, the packet including a destination address; obtaining corresponding routing table entries using different routing table lookup methods based on the routing type of the packet in the access layer device; and sending the packet to be sent to the destination address based on the routing table entries. This method reduces the chip area used by the logic circuitry corresponding to Layer 3 routing lookup in the access layer device, thereby allowing the use of a smaller access layer device for sending packets, reducing chip area and chip cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of Internet technology, and in particular to a method, apparatus, computer device, and storage medium for sending messages based on Layer 3 routing. Background Technology

[0002] With the development of internet technology, Layer 3 Ethernet switch chips have emerged. These chips support Layer 2 Ethernet switching and Layer 3 routing, including Layer 3 IP routing. IP (Internet Protocol) routing technology refers to the routing protocol technology between networks based on the IP protocol architecture. It standardizes the technical details related to selecting routing paths when data is transmitted and forwarded between network devices.

[0003] According to the routing protocol requirements in Layer 3 IP routing technology, when a chip performs a Layer 3 IP route lookup, it needs to use the TACM or Longest Prefix Matching (LPM) method to search for routing table entries. Typically, multiple routing table entries matching the destination IP address are pre-configured in the router. However, in access layer devices, there are often a large number of host routes, and these host routes also require the lookup resources of the corresponding logic circuits for TCAM or LPM lookup.

[0004] Because looking up routing table entries requires matching IP and mask information, the chip area used by the logic circuit for TCAM or longest prefix matching to find the corresponding entry is usually much larger than the chip area used by the logic circuit for exact matching that only requires matching IP information. Summary of the Invention

[0005] Therefore, it is necessary to provide a method, apparatus, computer device, and storage medium for sending messages based on Layer 3 routing that can reduce chip area resources, in order to address the above-mentioned technical problems.

[0006] A message sending method based on Layer 3 routing, the method comprising:

[0007] Obtain the message to be sent, wherein the message to be sent includes the destination address;

[0008] Based on the routing type of the message to be sent in the access layer device, different routing table lookup methods are used to obtain the corresponding routing table entries; the different routing tables are the various routing tables obtained by the access layer device in advance by splitting the routing table according to the routing type;

[0009] The packet to be sent is sent to the destination address based on the routing table entry.

[0010] In one embodiment, obtaining the corresponding routing table entry using different routing table lookup methods based on the routing type of the message to be sent in the access layer device includes:

[0011] Based on the destination address of the message to be sent, a longest match search is performed in the Layer 3 routing table to obtain the corresponding network segment routing table entry;

[0012] The routing type of the message to be sent in the access layer device is determined based on whether the network segment routing table entry includes a directly connected network segment routing identifier.

[0013] The routing table entry corresponding to the message to be sent is obtained by using different routing table lookup methods according to the routing type.

[0014] In one embodiment, the Layer 3 routing table includes network segment routes corresponding to each network segment, and one or more host routes; the method further includes:

[0015] Configure a directly connected network segment route for one or more host routes corresponding to each network segment;

[0016] Set the direct-connection segment route identifier in the segment routing table entry corresponding to the directly connected segment route.

[0017] In one embodiment, determining the routing type of the packet to be sent in the access layer device based on whether the network segment routing table entry includes a directly connected network segment routing identifier includes:

[0018] When the routing table entry includes a route identifier for a directly connected network segment, the routing type of the message to be sent in the access layer device is determined to be a host route;

[0019] When the routing table entry does not include a directly connected network segment routing identifier, the routing type of the message to be sent in the access layer device is determined to be a network segment route.

[0020] In one embodiment, obtaining the routing table entry corresponding to the message to be sent by using different routing table lookup methods according to the routing type includes:

[0021] When the routing type of the message to be sent in the access layer device is host routing, the corresponding host routing table entry is obtained based on the destination address using an exact match lookup method.

[0022] The exact match lookup method includes the hash lookup method.

[0023] In one embodiment, obtaining the routing table entry corresponding to the message to be sent by using different routing table lookup methods according to the routing type includes:

[0024] When the routing type of the message to be sent in the access layer device is a network segment route, the corresponding routing table entry is obtained based on the target address using a fuzzy matching search method.

[0025] The fuzzy matching search methods include TCAM and LPM search methods.

[0026] In one embodiment, the host routing table entry includes the outgoing port of the message to be sent and the destination media access control address of the host corresponding to the destination address.

[0027] A message sending device based on Layer 3 routing, the device comprising:

[0028] The message acquisition module is used to acquire a message to be sent, wherein the message to be sent includes a destination address;

[0029] The routing table lookup module is used to obtain the corresponding routing table entries by using different routing table lookup methods according to the routing type of the message to be sent in the access layer device; the different routing tables are the various routing tables obtained by the access layer device in advance by splitting the routing table according to the routing type.

[0030] The message sending module is used to send the message to be sent to the destination address based on the routing table entry.

[0031] A computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the message sending method based on three-layer routing in the above embodiments.

[0032] A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the message sending method based on three-layer routing in the above embodiments.

[0033] The aforementioned packet transmission method, apparatus, computer device, and storage medium based on Layer 3 routing separate the host routing and network segment routing of the access layer device. Different routing table lookup methods are used for different routing types of the packet to be transmitted within the access layer device, thereby quickly obtaining the corresponding routing table entry. This reduces the resource consumption of the logic circuits in the access layer device that would otherwise be used for extensive lookup of TCAM or longest prefix matching for host routing. By performing routing table lookups separately for host routing and network segment routing—using exact matching for host routing and TCAM or longest prefix matching for network segment routing—the chip area used for Layer 3 routing lookup logic circuits in the access layer device is reduced. This allows for packet transmission using access layer devices with smaller footprints, reducing chip area and cost. Attached Figure Description

[0034] Figure 1 This is an application scenario diagram of a packet sending method based on Layer 3 routing in one embodiment;

[0035] Figure 2 This is a schematic diagram illustrating the use of fuzzy matching to search for routing table entries in a message sending method based on Layer 3 routing in one embodiment.

[0036] Figure 3 This is a flowchart illustrating a message sending method based on Layer 3 routing in one embodiment;

[0037] Figure 4 This is a schematic diagram illustrating the lookup of the host route entry in the access layer device for a packet to be sent in a packet sending method based on Layer 3 routing in one embodiment.

[0038] Figure 5 This is a schematic diagram illustrating the lookup of a host routing table entry in a message sending method based on Layer 3 routing in one embodiment, where the chip simultaneously supports Layer 3 routing and Layer 2 Ethernet switching functions.

[0039] Figure 6 This is a structural block diagram of a packet sending device based on Layer 3 routing in one embodiment;

[0040] Figure 7 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0041] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0042] The message sending method based on Layer 3 routing provided in this application can be applied to, for example... Figure 1 The application environment shown is illustrated. This Layer 3 routing-based packet sending method is applied to a Layer 3 routing-based packet sending system, which includes an access layer device 102, in which a chip 104 is installed. The access layer device is a device that receives and forwards data information, which can be packet data, such as IP packets; the access layer device can be a switch, router, or other terminal device, or a server device.

[0043] Access layer devices include a chip 104, and one or more chips 104 can be configured. Chip 104 can be a chip with Layer 3 Ethernet functionality, supporting Layer 2 Ethernet switching and Layer 3 routing. Alternatively, chip 104 can only support Layer 3 routing. This Layer 3 routing can be Layer 3 IP routing. According to the routing protocol requirements in Layer 3 IP routing technology, when the chip performs a Layer 3 IP route lookup, it needs to use fuzzy matching to search for routing table entries. Generally, multiple routing table entries matching the target IP address are pre-configured in the router. However, access layer devices often contain a large number of host routes, which also require the lookup resources of the logic circuitry for TCAM or longest prefix matching. Because fuzzy matching requires matching IP and mask information, the chip area used for the logic circuitry corresponding to fuzzy matching is relatively large. In contrast, exact matching only requires matching routing information, i.e., only matching IP routing information, and the chip area used for the logic circuitry corresponding to exact matching is much smaller than that of the fuzzy matching method. Therefore, the main direction for improvement in this solution is to use a chip with a smaller area to receive and forward message information when receiving and forwarding messages through access layer devices.

[0044] Fuzzy matching lookup includes TACM (Ternary Content Addressable Memory) and the Longest Prefix Match (LPM) method. Each bit in a TCAM has three states: "0", "1", and "don't care", hence the name "three-state". These states are implemented using a mask, and it is this third state characteristic of the TCAM that allows for both exact and fuzzy matching lookup. The Longest Prefix Match (LPM) method matches the route address with multiple route prefixes in the routing table, and then selects the prefix with the longest mask length from the matched routes as the final match result. Exact matching lookup includes hash matching, which only requires matching IP routing information to look up routing table entries.

[0045] like Figure 2 The diagram illustrates a fuzzy matching search for a routing table entry. The access layer device searches the Layer 3 routing table for the destination address of the packet to be sent, using an exact matching search method, such as TCAM or LPM matching. This logical table contains multiple [IP, mask] routing entries. The search is performed by matching both the IP and mask information to obtain the routing table entry corresponding to the packet to be sent. This routing table entry includes the outgoing port of the packet and the destination Media Access Control (MAC) address.

[0046] The terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets and portable wearable devices, and the server 104 can be implemented by a standalone server or a server cluster consisting of multiple servers.

[0047] In one embodiment, such as Figure 3 As shown, a message sending method based on Layer 3 routing is provided, which can be applied to... Figure 1 Taking access layer device 102 as an example, the following steps are included:

[0048] Step S302: Obtain the message to be sent, wherein the message to be sent includes the destination address.

[0049] The address information of a message includes the source address and the destination address. The source address is the routing address of the device that sends the message data, and the destination address is the routing address to which the message will be sent. If the message is an IP message, then the address information of the IP message includes the source IP address and the destination IP address.

[0050] Step S304: Based on the routing type of the message to be sent in the access layer device, different routing table lookup methods are used to obtain the corresponding routing table entries. The different routing tables are obtained by the access layer device by pre-splitting the routing table according to the routing type.

[0051] The routing types include host routing and network segment routing. Routing table lookup methods include exact match lookup and fuzzy match lookup. Exact match lookup involves searching the routing table for IP routing information; while fuzzy match lookup involves searching the routing table for both IP and subnet mask information. Specifically, it first performs a first match against multiple routing prefixes in the routing table based on the IP routing information, and then performs a second match based on the subnet mask information to obtain the final match. Since the routing table entries in the chip are pre-configured, the chip area required for the logic circuitry corresponding to exact match lookup is significantly less than that for fuzzy match lookup.

[0052] Specifically, the access layer device acquires a packet to be sent, which includes a destination address. Based on the routing type of the packet within the access layer device, the device uses different routing table lookup methods to obtain the final matching routing table entry. To achieve this, different lookup methods are used depending on the routing type of the packet, host routes and network segment routes need to be separated within the access layer device.

[0053] In one embodiment, obtaining the corresponding routing table entry by using different routing table lookup methods based on the routing type of the packet to be sent in the access layer device includes: performing a longest match lookup in the Layer 3 routing table based on the destination address of the packet to be sent to obtain the corresponding network segment routing table entry; determining the routing type of the packet to be sent in the access layer device based on whether the network segment routing table entry includes a directly connected network segment routing identifier; and obtaining the routing table entry corresponding to the packet to be sent by using different routing table lookup methods based on the routing type.

[0054] First, the access layer device needs to determine the network segment where the packet to be sent is located, and then check whether there is a directly connected network segment route identifier that identifies the host route in the network segment routing table entry. Based on the directly connected network segment route identifier, the routing type of the packet to be sent can be determined, and thus it can be further determined whether to use an exact match search or a fuzzy match search to obtain the corresponding routing table entry.

[0055] Therefore, before confirming the route type of the packet to be sent, it is necessary to first set up a Layer 3 routing table that separates host routes and network segment routes. This means separating host routes from the fuzzy matching lookup table in the Layer 3 routing table, and representing one or more host routes corresponding to each network segment in the fuzzy matching lookup table using directly connected network segment routes. A directly connected network segment route identifier is then set in the corresponding network segment routing table entry, thereby compressing the table entry capacity and specifications of the fuzzy matching lookup table. Directly connected network segment routes can be represented using [IP, mask], and the directly connected network segment route identifier can be formed using any combination of numbers, letters, and characters. A directly connected network segment route means that the destination host of the packet to be sent is in a network segment directly connected to the host device, without needing to go through an access layer device for Layer 3 routing forwarding.

[0056] In one embodiment, the Layer 3 routing table includes network segment routes corresponding to each network segment and one or more host routes; the method further includes: setting a directly connected network segment route for one or more host routes corresponding to each network segment; and setting a directly connected network segment route identifier in the network segment routing table entry corresponding to the directly connected network segment route.

[0057] In one embodiment, determining the routing type of the packet to be sent in the access layer device based on whether the network segment routing table entry includes a directly connected network segment routing identifier includes: when the routing table entry includes a directly connected network segment routing identifier, determining the routing type of the packet to be sent in the access layer device as a host route; when the routing table entry does not include a directly connected network segment routing identifier, determining the routing type of the packet to be sent in the access layer device as a network segment route.

[0058] In one embodiment, obtaining the routing table entry corresponding to the packet to be sent by using different routing table lookup methods according to the routing type includes: when the routing type of the packet to be sent in the access layer device is host routing, obtaining the corresponding host routing table entry based on the destination address by using an exact match lookup method; the exact match lookup method includes a hash lookup method.

[0059] In one embodiment, obtaining the routing table entry corresponding to the packet to be sent by using different routing table lookup methods according to the routing type includes: when the routing type of the packet to be sent in the access layer device is a network segment route, obtaining the corresponding routing table entry based on the destination address using a fuzzy matching lookup method; the fuzzy matching lookup method includes TCAM and LPM lookup methods.

[0060] Step S306: Send the message to be sent to the destination address based on the routing table entry.

[0061] In one embodiment, the host routing table entry includes the outgoing port of the packet to be sent and the destination medium access control address of the host corresponding to the destination address. Specifically, when the routing type of the packet to be sent in the access layer device is host routing, the packet to be sent is sent to the corresponding outgoing port and the host corresponding to the MAC address according to the outgoing port and the destination MAC address in the host routing table entry, based on the queried host routing table entry.

[0062] In one embodiment, such as Figure 4 The diagram illustrates the routing table lookup process for a packet to be sent in the access layer device. As shown, the access layer device first performs a precise match lookup in the Layer 3 routing table based on the destination address (e.g., destination IP address) of the packet. This means the device retrieves the corresponding network segment routing table entry from the precise lookup table (e.g., the TCAM / LPM lookup logical table in the diagram) based on IP and mask information. When the network segment routing table entry includes a directly connected network segment route identifier, the corresponding host routing table entry can be obtained directly using the destination address of the packet through a precise match lookup. This means the device retrieves the corresponding host routing table entry from the module lookup table (e.g., the HASH precise match lookup logical table in the diagram) based on IP information. The host routing table entry includes the output port of the packet and the destination MAC address of the host corresponding to the destination address.

[0063] In one embodiment, when the access layer device simultaneously supports Layer 3 routing and Layer 2 Ethernet switching, the host routing lookup method of Layer 3 routing and the lookup method of Layer 2 Ethernet switching share the logic circuit resources corresponding to exact match lookup. Since both Layer 3 routing and Layer 2 Ethernet lookup methods use exact match lookup, the logic circuit resources corresponding to the lookup methods of the routing table entries for these two functions can be shared in the chip design, setting them as a commonly used exact match lookup logic table.

[0064] In one embodiment, obtaining the routing table entry corresponding to the packet to be sent by using different routing table lookup methods according to the routing type includes: when the routing type of the packet to be sent in the access layer device is host routing, obtaining the corresponding host routing table entry from the exact match lookup logical table based on the destination address using an exact match lookup method; the exact match lookup method includes a hash lookup method.

[0065] In one embodiment, such as Figure 5 The diagram illustrates the lookup process for host routing table entries in a chip that simultaneously supports Layer 3 routing and Layer 2 Ethernet switching. As can be seen, the chip design separates host routing from the fuzzy matching lookup logic table for IP routing (as shown in the TCAM lookup logic table). A smaller-capacity fuzzy matching lookup method (as shown in the TCAM) supports IP network segment routing, while an exact matching lookup method (as shown in the HASH) is used for host route lookup. The chip can flexibly allocate the exact matching lookup logic resources used for Layer 3 host routing and Layer 2 Ethernet switching in different application scenarios. Given a fixed amount of exact matching lookup logic resources, the chip can adapt to various network application scenarios.

[0066] In the aforementioned packet transmission method based on Layer 3 routing, host routing and network segment routing in the access layer device are configured separately. Different routing table lookup methods are used for different routing types of the packet to be transmitted in the access layer device, thereby quickly obtaining the corresponding routing table entries. This reduces the resource consumption of the logic circuits in the access layer device that require extensive lookup of TCAM or longest prefix matching for host routing. By performing routing table lookups separately for host routing and network segment routing, with host routing using an exact match lookup method and network segment routing using a TCAM or longest prefix matching lookup method, the chip area used for Layer 3 routing lookup in the access layer device is reduced. This allows for the use of access layer devices with smaller footprints to transmit packets, reducing chip area and lowering chip costs.

[0067] It should be understood that, although Figure 3-5The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 3-5 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.

[0068] In one embodiment, such as Figure 6 As shown, a packet sending device 600 based on Layer 3 routing is provided, including: a packet acquisition module 602, a routing table entry lookup module 604, and a packet sending module 606, wherein:

[0069] The message acquisition module 602 is used to acquire a message to be sent, wherein the message to be sent includes a destination address.

[0070] The routing table lookup module 604 is used to obtain the corresponding routing table entry by using different routing table lookup methods according to the routing type of the message to be sent in the access layer device.

[0071] The message sending module 606 is used to send the message to be sent to the destination address based on the routing table entry.

[0072] In one embodiment, the routing table lookup module is further configured to perform a longest match lookup in the Layer 3 routing table based on the destination address of the packet to be sent to obtain the corresponding network segment routing table entry; determine the routing type of the packet to be sent in the access layer device based on whether the network segment routing table entry includes a directly connected network segment routing identifier; and obtain the routing table entry corresponding to the packet to be sent by using different routing table lookup methods according to the routing type.

[0073] In one embodiment, the Layer 3 routing table includes network segment routes corresponding to each network segment and one or more host routes; the device further includes a directly connected network segment route identifier module, used to set a directly connected network segment route for one or more host routes corresponding to each network segment; and to set a directly connected network segment route identifier in the network segment routing table entry corresponding to the directly connected network segment route.

[0074] In one embodiment, the routing table lookup module is further configured to determine that the routing type of the message to be sent in the access layer device is host routing when the routing table entry includes a directly connected network segment routing identifier; and to determine that the routing type of the message to be sent in the access layer device is network segment routing when the routing table entry does not include a directly connected network segment routing identifier.

[0075] In one embodiment, the routing table lookup module is further configured to obtain the corresponding host routing table entry based on the destination address when the routing type of the message to be sent in the access layer device is host routing; the exact matching lookup method includes a hash lookup method.

[0076] In one embodiment, the routing table lookup module is further configured to obtain the corresponding routing table entry based on the target address when the routing type of the message to be sent in the access layer device is a network segment route; the fuzzy matching lookup method includes TCAM and LPM lookup methods.

[0077] In one embodiment, the host routing table entry includes the outgoing port of the message to be sent and the destination media access control address of the host corresponding to the destination address.

[0078] The aforementioned packet transmission device based on Layer 3 routing separates the host routing and network segment routing of the access layer device. Different routing table lookup methods are used for different routing types of the packet to be transmitted within the access layer device, thus quickly obtaining the corresponding routing table entry. This reduces the resource consumption of the logic circuits in the access layer device that would otherwise be used for extensive lookup of host routes using TCAM or longest prefix matching. By performing routing table lookups separately for host routes and network segment routes—using exact matching for host routes and TCAM or longest prefix matching for network segment routes—the chip area used for Layer 3 routing lookup logic circuits in the access layer device is reduced. This allows for packet transmission using a smaller access layer device, reducing chip area and lowering chip costs.

[0079] Specific limitations regarding the Layer 3 routing-based message sending device can be found in the limitations of the Layer 3 routing-based message sending method described above, and will not be repeated here. Each module in the aforementioned Layer 3 routing-based message sending device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in the computer device in hardware form, or stored in the memory of the computer device in software form, so that the processor can call and execute the corresponding operations of each module.

[0080] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 7As shown, the computer device includes a processor, memory, network interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements a message transmission method based on a three-layer routing architecture. The display screen can be an LCD screen or an e-ink display screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.

[0081] Those skilled in the art will understand that Figure 7 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0082] In one embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to perform the following steps: acquiring a message to be sent, the message to be sent including a destination address; obtaining corresponding routing table entries using different routing table lookup methods according to the routing type of the message to be sent in the access layer device; the different routing tables are various routing tables obtained by the access layer device in advance by splitting the routing table according to the routing type; and sending the message to be sent to the destination address based on the routing table entries.

[0083] In one embodiment, when the processor executes the computer program, it further performs the following steps: performing a longest match search in the Layer 3 routing table based on the destination address of the message to be sent to obtain the corresponding network segment routing table entry; determining the routing type of the message to be sent in the access layer device based on whether the network segment routing table entry includes a directly connected network segment routing identifier; and obtaining the routing table entry corresponding to the message to be sent by using different routing table lookup methods according to the routing type.

[0084] In one embodiment, the Layer 3 routing table includes network segment routes corresponding to each network segment and one or more host routes; when the processor executes the computer program, it also performs the following steps: setting a directly connected network segment route for one or more host routes corresponding to each network segment; setting a directly connected network segment route identifier in the network segment routing table entry corresponding to the directly connected network segment route.

[0085] In one embodiment, when the processor executes the computer program, it further implements the following steps: when the routing table entry includes a directly connected network segment routing identifier, it determines that the routing type of the message to be sent in the access layer device is a host route; when the routing table entry does not include a directly connected network segment routing identifier, it determines that the routing type of the message to be sent in the access layer device is a network segment route.

[0086] In one embodiment, when the processor executes the computer program, it further implements the following steps: when the routing type of the message to be sent in the access layer device is host routing, the corresponding host routing table entry is obtained based on the destination address using an exact match lookup method; the exact match lookup method includes a hash lookup method.

[0087] In one embodiment, when the processor executes the computer program, it further implements the following steps: when the routing type of the message to be sent in the access layer device is a network segment route, the corresponding routing table entry is obtained based on the destination address using a fuzzy matching lookup method; the fuzzy matching lookup method includes TCAM and LPM lookup methods.

[0088] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When executed by a processor, the computer program performs the following steps: acquiring a message to be sent, the message including a destination address; obtaining corresponding routing table entries using different routing table lookup methods according to the routing type of the message to be sent in the access layer device; the different routing tables are various routing tables obtained by the access layer device in advance by splitting the routing table according to the routing type; and sending the message to be sent to the destination address based on the routing table entries.

[0089] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: performing a longest match search in the Layer 3 routing table based on the destination address of the message to be sent to obtain the corresponding network segment routing table entry; determining the routing type of the message to be sent in the access layer device based on whether the network segment routing table entry includes a directly connected network segment routing identifier; and obtaining the routing table entry corresponding to the message to be sent by using different routing table lookup methods according to the routing type.

[0090] In one embodiment, the Layer 3 routing table includes network segment routes corresponding to each network segment and one or more host routes; when the computer program is executed by the processor, it also performs the following steps: setting a directly connected network segment route for one or more host routes corresponding to each network segment; setting a directly connected network segment route identifier in the network segment routing table entry corresponding to the directly connected network segment route.

[0091] In one embodiment, when the computer program is executed by the processor, it further implements the following steps: when the routing table entry includes a directly connected network segment route identifier, determining that the routing type of the message to be sent in the access layer device is a host route; when the routing table entry does not include a directly connected network segment route identifier, determining that the routing type of the message to be sent in the access layer device is a network segment route.

[0092] In one embodiment, when the computer program is executed by the processor, it further implements the following steps: when the routing type of the message to be sent in the access layer device is host routing, the corresponding host routing table entry is obtained based on the destination address using an exact match lookup method; the exact match lookup method includes a hash lookup method.

[0093] In one embodiment, when the computer program is executed by the processor, it further implements the following steps: when the routing type of the message to be sent in the access layer device is a network segment route, the corresponding routing table entry is obtained based on the destination address using a fuzzy matching lookup method; the fuzzy matching lookup method includes TCAM and LPM lookup methods.

[0094] The aforementioned computer equipment and storage medium for transmitting packets based on Layer 3 routing separate the host routing and network segment routing settings of the access layer device. Different routing table lookup methods are used for different routing types of the packets to be transmitted within the access layer device, thus quickly obtaining the corresponding routing table entries. This reduces the resource consumption of the logic circuits in the access layer device that would otherwise be used extensively for TCAM or longest prefix matching lookups of host routes. By performing routing table lookups separately for host routes and network segment routes—using exact matching for host routes and TCAM or longest prefix matching for network segment routes—the chip area used for Layer 3 routing lookups in the access layer device is reduced. This allows for the use of smaller access layer devices to transmit packets, reducing chip area and lowering chip costs.

[0095] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0096] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0097] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. A message sending method based on Layer 3 routing, characterized in that, The Layer 3 routing table includes network segment routes and host routes corresponding to each network segment. The method includes: Configure a directly connected network segment route for multiple hosts corresponding to each network segment; set the directly connected network segment route identifier in the routing table entry corresponding to each directly connected network segment route in the Layer 3 routing table; Obtain a message to be sent, wherein the message to be sent includes a destination address, and the destination address is an IP address; Based on the routing type of the message to be sent in the access layer device, different routing table lookup methods are used to obtain the corresponding routing table entries; the different routing tables are the various routing tables obtained by the access layer device in advance by splitting the routing table according to the routing type; Specifically, a longest match search is performed in the Layer 3 routing table based on the destination address to obtain the corresponding network segment routing table entry; the routing type of the packet to be sent in the access layer device is determined based on whether the network segment routing table entry includes a directly connected network segment routing identifier; the routing type includes host routing and network segment routing; and different routing table lookup methods are used to obtain the routing table entry corresponding to the packet to be sent based on the routing type. Wherein, when the routing type of the message to be sent in the access layer device is host routing, the corresponding host routing table entry is obtained based on the destination address using an exact match lookup method, the exact match lookup method including a hash lookup method; The packet to be sent is sent to the destination address based on the routing table entry.

2. The method according to claim 1, characterized in that, The step of determining the routing type of the message to be sent in the access layer device based on whether the network segment routing table entry includes a directly connected network segment routing identifier includes: When the routing table entry includes a route identifier for a directly connected network segment, the routing type of the message to be sent in the access layer device is determined to be a host route; When the routing table entry does not include a directly connected network segment routing identifier, the routing type of the message to be sent in the access layer device is determined to be a network segment route.

3. The method according to claim 1, characterized in that, The step of obtaining the routing table entry corresponding to the message to be sent by using different routing table lookup methods according to the routing type includes: When the routing type of the message to be sent in the access layer device is a network segment route, the corresponding routing table entry is obtained based on the destination address using a fuzzy matching search method. The fuzzy matching search methods include TCAM and LPM search methods.

4. The method according to claim 1 or 2, characterized in that, The host routing table entry includes the outgoing port of the message to be sent and the destination medium access control address of the host corresponding to the destination address.

5. A message sending device based on Layer 3 routing, characterized in that, The Layer 3 routing table includes network segment routes and host routes corresponding to each network segment. The device includes: The directly connected network segment route identifier module is used to set a directly connected network segment route for multiple hosts corresponding to each network segment, and to set the directly connected network segment route identifier in the network segment route table entry corresponding to each directly connected network segment route in the Layer 3 routing table; The message acquisition module is used to acquire a message to be sent, wherein the message to be sent includes a destination address; The routing table lookup module is used to: obtain corresponding routing table entries based on the routing type of the packet to be sent in the access layer device using different routing table lookup methods; wherein, based on the destination address, a longest match lookup is performed in the Layer 3 routing table to obtain the corresponding network segment routing table entry; the routing type of the packet to be sent in the access layer device is determined based on whether the network segment routing table entry includes a directly connected network segment routing identifier; the routing type includes host routing and network segment routing; and different routing table lookup methods are used to obtain the routing table entries corresponding to the packet to be sent based on the routing type; wherein, when the routing type of the packet to be sent in the access layer device is host routing, an exact match lookup method is used based on the destination address to obtain the corresponding host routing table entry, the exact match lookup method including hash lookup method; The message sending module is used to send the message to be sent to the destination address based on the routing table entry.

6. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 4.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 4.