Data forwarding method, static route flow table entry generation method and device, computer device and storage medium

By configuring static routing flow table entries for distributed routers, the network bandwidth consumption and CPU load issues caused by frequent switching of routing flow table entries in virtualized networks are resolved, achieving efficient data forwarding.

CN118784548BActive Publication Date: 2025-11-28JINAN INSPUR DATA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410852205.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-27
Publication Date
2025-11-28
Estimated Expiration
2044-06-27

AI Technical Summary

Technical Problem

In a virtualized network environment, distributed routers need to frequently exchange routing flow table entries, resulting in additional network bandwidth consumption and increased CPU load, which affects data forwarding efficiency.

Method used

A static routing flow table entry generation method is adopted. The network controller configures static routing flow table entries for distributed routers, reducing dynamic routing switching. Data forwarding is performed using static routing flow table entries, ensuring accurate forwarding of data packets.

Benefits of technology

It effectively reduces the burden on the host CPU and memory of the network controller, lowers the resource consumption rate in the virtualized network environment, and improves the ease of use and forwarding performance of the distributed router.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118784548B_ABST
    Figure CN118784548B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of virtualization networks, and discloses a data forwarding method, a static route flow table item generation method and device, computer equipment and a storage medium. The data forwarding method comprises the following steps: matching a first target address of a data frame with a first static route flow table item, determining a target static route flow table item matched successfully, and analyzing the data frame to obtain a data packet; obtaining a second target address and a target network segment address, comparing the second target address with the target network segment address, obtaining a third target address according to the target static route flow table item if the comparison is successful, updating the data packet according to the first target address and the third target address, re-encapsulating to obtain a data frame to be forwarded, and sending the data frame to be forwarded to a target device according to the third target address; and sending the data packet to a second host by the target device. The method solves the problem that, when forwarding data, route flow table items need to be frequently exchanged, update traffic is generated, additional network bandwidth is occupied, and the data forwarding efficiency is affected.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of virtualized network, in particular to a data forwarding method, a static route flow entry generation method, device, computer equipment and storage medium. BACKGROUND

[0002] In a small and medium-sized virtualized network environment, the router plays a vital role, it not only connects multiple networks, but also acts as a gateway between networks, responsible for reading address information in the data packet, and deciding the transmission path of data, for example: it can identify and process a variety of network protocols, such as the Ethernet protocol commonly used in LAN and the TCP / IP (Transmission Control Protocol / Internet Protocol) protocol widely used on the Internet. In this way, the router can parse data packets from different network types, perform address conversion (such as converting non-TCP / IP addresses to TCP / IP addresses, or vice versa), and send data along the best path to the destination according to the selected routing algorithm.

[0003] As a kind of software-defined routing device, the virtualized distributed router has deficiency compared with traditional physical router in forwarding efficiency, at present, most software-defined distributed routers use dynamic routing mode to realize data forwarding, which requires frequent exchange of route flow table entries between distributed routers, generates update traffic, occupies additional network bandwidth, affects data forwarding efficiency, and the load of CPU (Central Processing Unit) will also be increased accordingly.

[0004] Therefore, the related technology has the problem that when forwarding data, route flow table entries need to be frequently exchanged, update traffic is generated, additional network bandwidth is occupied, and data forwarding efficiency is affected. SUMMARY

[0005] Therefore, the present application provides a data forwarding method, a static route flow entry generation method, device, computer equipment and storage medium to solve the problem that when forwarding data, route flow table entries need to be frequently exchanged, update traffic is generated, additional network bandwidth is occupied, and data forwarding efficiency is affected.

[0006] In a first aspect, the present application provides a data forwarding method, which is applied to a distributed router, comprising:

[0007] When receiving a data frame sent by a first host, obtaining a first target address of the data frame;

[0008] The first target address is matched with the first static routing flow table item, a target static routing flow table item with a matching success is determined, and a data packet is obtained by parsing the data frame;

[0009] The second target address is obtained from the data packet, a target network segment address is obtained from the target static routing flow table item, and the second target address is compared with the target network segment address;

[0010] If the comparison is successful, a third target address is obtained according to the target static routing flow table item, the data packet is updated according to the first target address and the third target address, the updated data packet is re-encapsulated to obtain a data frame to be forwarded, and the data frame to be forwarded is sent to the target device according to the third target address, and the data packet is sent to the second host by the target device, wherein the second host is determined according to the second target address in the data packet.

[0011] If the comparison is successful, a third target address is obtained according to the target static routing flow table item, the data packet is updated according to the first target address and the third target address, the updated data packet is re-encapsulated to obtain a data frame to be forwarded, and the data frame to be forwarded is sent to the target device according to the third target address, and the data packet is sent to the second host by the target device, wherein the second host is determined according to the second target address in the data packet.

[0012] The data forwarding method provided in the embodiment, the distributed router implements data forwarding according to the first static routing flow table item, without frequent exchange of routing flow table items, effectively reducing the burden of the network controller on the host CPU and memory, and reducing the resource occupancy rate of the network in the virtualization environment. The usability and forwarding performance of the distributed router in the virtualization network environment are significantly improved. The problem that the routing flow table items need to be frequently exchanged when forwarding data, generating update traffic, occupying additional network bandwidth, and affecting data forwarding efficiency is solved.

[0013] In some optional embodiments, obtaining the third target address according to the target static routing flow table item comprises:

[0014] In the case that the first host sends data to the second host for the first time, a next hop address is obtained from the target static routing flow table item;

[0015] An address resolution protocol broadcast is sent according to the next hop address to obtain the third target address;

[0016] In the case that the first host sends data to the second host for the first time, a next hop address is obtained from the target static routing flow table item;

[0017] The third target address is obtained by querying the address resolution protocol table according to the next hop address.

[0018] In the embodiment, the third target address is obtained in different ways according to whether the first host sends data to the second host for the first time, so that the obtained third target address is accurate, and the data can be forwarded to the correct address.

[0019] In some optional embodiments, the method further comprises:

[0020] An already connected network segment address is obtained;

[0021] determining whether the connected network segment address is within a preset network segment address range;

[0022] if the connected network segment address is not within the preset network segment address range, obtaining a second static route flow table item numbered as a preset number, and determining whether a distributed network address translation gateway is connected;

[0023] if the distributed network address translation gateway is not connected, matching the connected network segment address with a target network segment address in the second static route flow table item;

[0024] if the matching is successful, taking the second static route flow table item as a target static route flow table item corresponding to the connected network segment address;

[0025] if the distributed network address translation gateway is connected, taking a preset network segment address as a target network segment address corresponding to the connected network segment address, and taking a gateway address of the distributed network address translation gateway as a next hop address corresponding to the connected network segment address.

[0026] In a second aspect, the present application provides a static route flow table item generation method, which is applied to a network controller and includes:

[0027] obtaining a target network segment address, a next hop address and a source media access control address;

[0028] determining a corresponding distributed router according to the target network segment address and the next hop address;

[0029] generating a first static route flow table item in the distributed router according to the target network segment address, the next hop address and the source media access control address, wherein the distributed router is configured to execute the data forwarding method of the first aspect or any of the corresponding embodiments thereof.

[0030] The static route flow table item generation method provided by the embodiment gives the distributed router in the virtualized network the ability to forward data packets through the static route flow table item by configuring the static route flow table item for the distributed router. The burden of the virtualized network controller on the host CPU and the memory is effectively reduced, and the resource occupancy rate of the network in the virtualized environment is reduced. The problem that the route flow table item needs to be frequently exchanged when forwarding data, resulting in update traffic, occupying additional network bandwidth and affecting the data forwarding efficiency is solved.

[0031] In some optional embodiments, the method further includes:

[0032] determining whether the distributed router is configured with a distributed network address translation gateway;

[0033] If the distributed network address translation gateway is configured, obtaining a gateway address of the distributed network address translation gateway and a media access control address of a source network address translation gateway;

[0034] Recording the gateway address in a first register of the distributed router and saving the media access control address in a second register of the distributed router;

[0035] According to the preset number, the preset priority, the preset network segment address, the gateway address and the media access control address, generating a third static route flow table item in the distributed router, and pointing to a network logical port of the distributed network address translation gateway the traffic egress end information corresponding to the third static route flow table item.

[0036] In some optional embodiments, after generating the first static route flow table item in the distributed router, the method further comprises:

[0037] Entering the first static route flow table item and the third static route flow table item into a database of the network controller;

[0038] According to the first static route flow table item, the third static route flow table item and the associated information corresponding to the distributed router in the database, creating a static route table for the distributed router.

[0039] In the embodiment, the static route table is created for the distributed router, the real-time synchronization of the database between the distributed router and the network controller is realized, and the consistency of the updated flow table information of each distributed router is ensured. This ensures that even when a new node is added in a virtualization environment, the problem of the flow table of the distributed router of the new host node not being synchronized with other routers does not occur.

[0040] In some optional embodiments, after judging whether the distributed network address translation gateway is configured for the distributed router, the method further comprises:

[0041] In the case where it is determined that the distributed network address translation gateway is configured, creating a judgment condition for prohibiting the creation of the first static route flow table item, wherein the judgment condition is that the target network segment address corresponding to the first static route flow table item is not the preset network segment address;

[0042] Judging whether there is the first static route flow table item whose target network segment address is the preset network segment address in the database;

[0043] If there is, stopping the issuance of a new static route flow table item creation task, and outputting prompt information containing a static route flow table item creation failure, wherein the static route flow table item creation task is used to create the first static route flow table item.

[0044] In the embodiment, in the case that it is determined that the distributed network address translation gateway is configured, the interference on the forwarding function of the distributed network address translation gateway is avoided by creating the judging condition and the first static route flow table item of the target network segment address being the preset network segment address.

[0045] In a third aspect, the present application provides a data forwarding device, which is deployed in a distributed router, comprising:

[0046] The first obtaining module is configured to obtain the first target address of the data frame when receiving the data frame sent by the first host;

[0047] The first determining module is configured to match the first target address with the first static route flow table item, determine the target static route flow table item with which the matching succeeds, and analyze the data frame to obtain the data packet;

[0048] The comparison module is configured to obtain the second target address from the data packet, obtain the target network segment address from the target static route flow table item, and compare the second target address with the target network segment address;

[0049] The updating module is configured to, if the comparison succeeds, obtain the third target address according to the target static route flow table item, update the data packet according to the first target address and the third target address, re-encapsulate the updated data packet to obtain the data frame to be forwarded;

[0050] The sending module is configured to send the data frame to be forwarded to the target device according to the third target address, and send the data packet to the second host by the target device, wherein the second host is determined according to the second target address in the data packet.

[0051] In a fourth aspect, the present application provides a static route flow table item generation device, which is deployed in a network controller, comprising:

[0052] The second obtaining module is configured to obtain the target network segment address, the next hop address and the source medium access control address;

[0053] The second determining module is configured to determine the corresponding distributed router according to the target network segment address and the next hop address;

[0054] The generating module is configured to generate the first static route flow table item in the distributed router according to the target network segment address, the next hop address and the source medium access control address, wherein the distributed router is configured to execute the data forwarding method of the first aspect or any of the corresponding embodiments thereof.

[0055] In a fifth aspect, the present application provides a computer device, comprising a memory and a processor, which are communicatively connected with each other, and the memory stores computer instructions, and the processor executes the data forwarding method of the first aspect or any of the corresponding embodiments thereof, or the static route flow entry generating method of the second aspect or any of the corresponding embodiments thereof by executing the computer instructions.

[0056] In a sixth aspect, the present application provides a computer readable storage medium, which stores computer instructions for making a computer execute the data forwarding method of the first aspect or any of the corresponding embodiments thereof, or the static route flow entry generating method of the second aspect or any of the corresponding embodiments thereof.

[0057] In a seventh aspect, the present application provides a computer program product, which comprises computer instructions for making a computer execute the data forwarding method of the first aspect or any of the corresponding embodiments thereof, or the static route flow entry generating method of the second aspect or any of the corresponding embodiments thereof. BRIEF DESCRIPTION OF DRAWINGS

[0058] In order to more clearly illustrate the technical solutions of the specific embodiments or the related art, the drawings needed to be used in the specific embodiments or the related art description will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0059] Figure 1 is a flowchart of the data forwarding method according to an embodiment of the present application;

[0060] Figure 2 is a logic diagram of the host distributed router according to an embodiment of the present application;

[0061] Figure 3 is a schematic diagram of matching the static route flow entry according to an embodiment of the present application;

[0062] Figure 4 is a schematic diagram of screening the static route flow entry according to an embodiment of the present application;

[0063] Figure 5 is a flowchart of the static route flow entry generating method according to an embodiment of the present application;

[0064] Figure 6 is a schematic diagram of the static route flow entry entering the network controller according to an embodiment of the present application;

[0065] Figure 7 is a flowchart of a network controller issuing a static routing flow table item according to an embodiment of the present application;

[0066] Figure 8 is a structural block diagram of a data forwarding device according to an embodiment of the present application;

[0067] Figure 9 is a structural block diagram of a static routing flow table item generation device according to an embodiment of the present application;

[0068] Figure 10 is a hardware structure schematic diagram of a computer device according to an embodiment of the present application. DETAILED DESCRIPTION

[0069] In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.

[0070] The embodiments of the present application provide a data forwarding method, which realizes creation of a distributed router by using a network controller instruction in a virtualized network environment. In this process, each node generates a logical distributed router. Then, an interface is created by the network controller to add a static routing flow table item to the router, and the router realizes data forwarding function according to the static routing flow table item. This can effectively reduce the burden of dynamic routing on CPU and memory, shorten the CPU processing time, and make it easier for network administrators to configure and monitor the distributed router, and simplify the routing configuration process.

[0071] According to the embodiments of the present application, a data forwarding embodiment is provided. It should be noted that the steps shown in the flowchart of the drawings can be executed in the distributed router, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0072] In the embodiments of the present application, a data forwarding method is provided, which can be used in a distributed router, Figure 1 is a flowchart of a data forwarding method according to an embodiment of the present application, as shown in Figure 1 the flowchart includes the following steps:

[0073] Step S101, when receiving a data frame sent by a first host, obtaining a first target address of the data frame.

[0074] Specifically, in a virtualized network environment, a network controller is utilized to issue instructions to create a distributed router, as shown in Figure 2 LogicalRoute is a logical router created by the network controller. In the distributed logic, LogicalRoute can be regarded as three separate routers on three hosts, respectively DVR (distributed virtual router)_1, DVR_2, DVR_3, and there is only one LogicalRoute in the use level and the perception level. Figure 2 The blue line in the figure indicates that there is a virtual machine distributed router on each host, and the green line indicates that in the overall logical concept, the three hosts are chained on one router, and the IP addresses of the three hosts are 192.168.0.0 / 24, 192.168.1.0 / 24, and 192.168.2.0 / 24, respectively. Each host is a node.

[0075] In combination with Figure 3 The embodiment is described, Figure 3 In the figure, a virtual machine with an IP address of 192.168.0.2 and a CIDR (Classless Inter-Domain Routing) of 192.168.0.0 / 24 needs to communicate with a virtual machine with an IP address of 8.8.8.8 and a CIDR of 8.8.8.0 / 24.

[0076] The first host is, for example, a host on which a virtual machine with an IP address of 192.168.0.2 and a CIDR of 192.168.0.0 / 24 is located. The distributed router receives a packet with a Mac (Media Access Control Address) address of fa:16:3e:b1:75:39 through a gateway (Gateway) with an address of 192.168.0.1 based on an Internet Control Message Protocol (ICMP) network control message. The packet contains a data frame sent by the first host. When the distributed router receives the data frame sent by the first host, the first target address of the data frame is obtained, that is, the target Mac address carried in the packet header, for example, fa:16:3e:b1:75:39.

[0077] In step S102, the first target address is matched with the first static route flow table item, the target static route flow table item with which the matching is successful is determined, and a data packet is obtained by analyzing the data frame.

[0078] Specifically, the distributed router contains multiple first static routing flow table entries. These entries are used to manage all network communication forwarding rules and policies, for example: Figure 3 As shown, there are four first static routing flow table entries: 1. table = x(xxx), pr(xx), dst(5.5.5.0 / 24), reg0(192.168.0.5); 2. table = x(xxx), pr(xx), dst(4.4.4.0 / 24), reg0(192.168.0.6); 3. table = x(xxx), pr(xx), dst(xxxx), reg0(xxxx); 4. table = 12(logi cal_route_in_ip), priority = 500, dst (8.8.8.0 / 24), reg0 (192.168.10.5), src.Mac (fa:16:3e:b1:75:39), where the specific value of x is set according to actual needs, pr is an abbreviation for priority, dst is an abbreviation for destination, reg (register), and src (source).

[0079] The distributed router checks if the first destination address of the data frame matches its own first static routing flow table entry. If they match and the fourth forwarding rule in the flow table is satisfied, the router continues to process the data frame; otherwise, the data frame is discarded. The first destination address is matched against the first static routing flow table entries. For example, if the first destination address is fa:16:3e:b1:75:39, it is matched against the four first static routing flow table entries mentioned above. The fourth entry (table=12) contains src.mac (fa:16:3e:b1:75:39), so the packet is not discarded and forwarded. The successfully matched destination static routing flow table entry is the fourth entry (table=12).

[0080] After a successful match, the distributed router parses the data frame to extract the data packet.

[0081] Step S103: Obtain the second destination address from the data packet, obtain the destination network segment address from the destination static routing flow table entry, and compare the second destination address with the destination network segment address.

[0082] Specifically, the distributed router obtains a target IP address in an IP header of the data packet as the second target address from the data packet, for example, 8.8.8.8. The target network segment address is obtained from the target static route flow table item, for example, the target static route flow table item is 4.tabel=12 (logical_route_in_ip), priority=500, dst(8.8.8.0 / 24), reg0(192.168.10.5), src.Mac(fa:16:3e:b1:75:39), and the target network segment address is dst(8.8.8.0 / 24).

[0083] The distributed router compares the second target address with the target network segment address, and determines a target network connection to which the data packet should be forwarded according to a comparison result. For example, 8.8.8.8 is compared with dst(8.8.8.0 / 24), and the comparison succeeds because 8.8.8.8 satisfies dst(8.8.8.0 / 24) in the target static route flow table item.

[0084] In step S104, if the comparison succeeds, a third target address is obtained according to the target static route flow table item, the data packet is updated according to the first target address and the third target address, and the updated data packet is re-encapsulated to obtain a data frame to be forwarded.

[0085] Specifically, if the comparison succeeds, the distributed router obtains the next hop address reg0(192.168.10.5) from the target static route flow table item, and obtains a Mac address of the next hop address as the third target address by using, for example, an ARP (Address Resolution Protocol) table.

[0086] The distributed router updates the data packet according to the first target address and the third target address, including that the distributed router discards an original MAC header in the data packet, and adds the first target address and the third target address to the data packet. For example, the MAC header of the data packet is modified to the first target address fa:16:3e:b1:75:39, and the target MAC address is modified to the third target address, i.e., the Mac address of the next hop address.

[0087] The distributed router re-encapsulates the data packet to obtain the data frame to be forwarded before forwarding the data packet to the next routing interface.

[0088] In step S105, the data frame to be forwarded is sent to a target device according to the third target address, and the data packet is sent to a second host by the target device, where the second host is determined according to the second target address in the data packet.

[0089] Specifically, the distributed router sends the data frame to be forwarded to the device of the next address according to the Mac address of the third target address, i.e., the next hop address, the device of the next address, i.e., the target device, performs the last decapsulation on the data frame to be forwarded, obtains the data packet, and sends the data packet to the second host, the IP address of the second host being the second target address, for example, 8.8.8.8, so as to realize sending the data packet to the final destination IP 8.8.8.8.

[0090] The data forwarding method provided by the embodiment can realize data forwarding by the distributed router according to the first static routing flow table item, without frequent exchange of the routing flow table item, effectively reducing the burden of the network controller on the host CPU and the memory, reducing the resource occupancy rate of the network in the virtualization environment, significantly improving the usability and forwarding performance of the distributed router in the virtualization network environment, and solving the problem that the routing flow table item needs to be frequently exchanged when forwarding data, generating update traffic, occupying additional network bandwidth, and affecting the data forwarding efficiency.

[0091] In some optional embodiments, obtaining the third target address according to the target static routing flow table item includes:

[0092] In the case that the first host sends data to the second host for the first time, obtaining the next hop address from the target static routing flow table item;

[0093] Issuing an address resolution protocol broadcast according to the next hop address to obtain the third target address;

[0094] In the case that the first host sends data to the second host for the first time, obtaining the next hop address from the target static routing flow table item;

[0095] Obtaining the third target address by querying the address resolution protocol table according to the next hop address.

[0096] Specifically, if the first host sends data to the second host for the first time, the distributed router also needs to perform address resolution protocol (ARP) broadcast to obtain the target MAC address as the third target address, and the next hop address is obtained through the ARP broadcast packet. The steps include:

[0097] The distributed router obtains the next hop address from the target static routing flow table item, for example, the target static routing flow table item is 4.tabel=12 (logical_route_in_ip), priority=500, dst(8.8.8.0 / 24), reg0(192.168.10.5), src.Mac(fa:16:3e:b1:75:39), and the next hop address thereof is reg0(192.168.10.5).

[0098] The distributed router sends an ARP broadcast according to the next-hop address, and obtains the Mac address of the next-hop address as the third target address according to the ARP broadcast packet.

[0099] In the case that the first host sends data to the second host for the first time, the next-hop address is obtained from the target static route flow table item, and then the Mac address corresponding to the next-hop address, i.e., the third target address, is queried in the ARP table.

[0100] In the embodiment, the third target address is obtained in different ways according to whether the first host sends data to the second host for the first time, so that the obtained third target address is accurate, and it is ensured that the data can be forwarded to the correct address.

[0101] In some optional embodiments, the method further comprises:

[0102] obtaining a connected network segment address;

[0103] determining whether the connected network segment address is within a preset network segment address range;

[0104] In the case that the connected network segment address is not within the preset network segment address range, obtaining a second static route flow table item numbered a preset number, and determining whether a distributed network address translation gateway is connected;

[0105] If the distributed network address translation gateway is not connected, matching the connected network segment address with a target network segment address in the second static route flow table item;

[0106] If the matching is successful, taking the second static route flow table item as the target static route flow table item corresponding to the connected network segment address;

[0107] If the distributed network address translation gateway is connected, taking the preset network segment address as the target network segment address corresponding to the connected network segment address, and taking the gateway address of the distributed network address translation gateway as the next-hop address corresponding to the connected network segment address.

[0108] Specifically, after the network controller sets the first static route flow table item in the distributed router, the router obtains a connected network segment address, for example, as follows: Figure 4As shown, the connected network segment addresses include 5.5.5.2 and 8.8.8.8, where ping (Packet Internet Groper, an Internet packet explorer) is a computer network management application, which is usually used to confirm whether a host on the Internet is reachable; 192.168.0.2 ping 5.5.5.2 means to confirm whether the IP address 192.168.0.2 is connected to the network segment address 5.5.5.2, and 192.168.0.2 ping 8.8.8.8 means to confirm whether the IP address 192.168.0.2 is connected to the network segment address 8.8.8.8, and the above two operations can obtain the connected network segment addresses of the distributed router, which include 5.5.5.2 and 8.8.8.8. 192.168.0.0 / 24 and 192.168.1.0 / 24 are network segment addresses.

[0109] It is determined whether the connected network segment address is within the preset network segment address range, and the preset network segment address range is the CIDR range of the default route, for example, in IPv4, the default route is usually represented as 0.0.0.0 / 0.

[0110] In the case that the connected network segment address is not within the preset network segment address range, a second static route flow table item numbered by a preset number, for example, 12, is obtained, that is, logical_route_in_ip, the first static route flow table item numbered by 12 is taken as the second static route flow table item, and the destination address + next is the table 12 flow table item. It is determined whether the distributed router is connected to a distributed Network Address Translation (NAT) gateway.

[0111] In combination Figure 4 The embodiment is described.

[0112] If the distributed router is not connected to the distributed NAT gateway, the connected network segment address is matched with the target network segment address in the second static route flow table item, as shown in Figure 4 As shown, the second static route flow table item includes: 1. The destination address is 5.5.5.0 / 24, and the next hop routing IP is 192.168.0.254; 2. The destination address is 4.4.4.0 / 24, and the next hop routing IP is 192.168.0.253; 3. The destination address is 3.3.3.0 / 24, and the next hop routing IP is 192.168.0.252. The default destination address is 192.168.0.0 / 24, and the default next hop routing IP is 192.168.1.1; the default destination address is 192.168.1.0 / 24, and the default next hop routing IP is 192.168.0.1 are two other static route flow table items.

[0113] If the matching is successful, the second static route flow table item is taken as the target static route flow table item corresponding to the connected network segment address, for example, the connected network segment address is 5.5.5.2, and the matching with the destination address 5.5.5.0 / 24 is successful. The second static route flow table item (i.e., the destination address is 5.5.5.0 / 24, and the next hop routing IP is 192.168.0.254) is taken as the target static route flow table item corresponding to the connected network segment address. Then, the router performs the forwarding operation to the next hop according to the next IP address information stored in the register reg0.

[0114] If the distributed router is connected to the distributed NAT gateway, the preset network segment address is taken as the target network segment address corresponding to the connected network segment address, and the IP address of the distributed NAT gateway is taken as the next hop address corresponding to the connected network segment address. Then, the distributed router performs the forwarding operation to the next hop according to the next hop address stored in the register reg0.

[0115] According to the embodiment of the present application, an embodiment of a static route flow table item generation method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in the network controller, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0116] In the embodiment, a static route flow table item generation method is provided, which can be used in a network controller, Figure 5 is a flowchart of a data forwarding method according to the embodiment of the present application, as Figure 5 shown, the flowchart includes the following steps:

[0117] In step S501, the target network segment address, the next hop address, and the source media access control address are obtained.

[0118] Specifically, in the virtualized network environment, the network controller issues an instruction to create a distributed router, as Figure 2 shown, the LogicalRoute is the distributed router created by the network controller. Then, the network controller creates an interface for the distributed router and generates a static route flow table item for the distributed router, thereby realizing the static routing function of the distributed router.

[0119] The network controller creates a static route flow table item. First, the network controller interface is used to define the destination CIDR (i.e., the target network segment address) and the IP address of the next hop (i.e., the next hop address), for example, the destination CIDR is 5.5.5.0 / 24, and the next hop address is 192.168.0.254.

[0120] In addition, the network controller also acquires a source media access control address (source Mac address), for example: fa: 16: 3e:b1: 75: 39.

[0121] In step S502, a corresponding distributed router is determined according to the target network segment address and the next hop address.

[0122] Specifically, the network controller first identifies the ID (Identity document) of the current distributed router according to the target network segment address and the next hop address, then selects the corresponding distributed router according to the ID, and adds a static routing flow table item to the distributed router.

[0123] The register value in the distributed router is set, wherein reg0 stores the next hop address and reg1 stores the target network segment address, so that the distributed router can obtain the IPv4 address of the next hop when forwarding data from the register.

[0124] In step S503, a first static routing flow table item in the distributed router is generated according to the target network segment address, the next hop address and the source media access control address, wherein the distributed router is used to execute the data forwarding method of steps S101-S105 or any embodiment thereof.

[0125] Specifically, the network controller generates the first static routing flow table item in the distributed router, and the first static routing flow table item contains the target network segment address, the next hop address and the source media access control address, wherein the network controller adds the source media access control address to the first static routing flow table item, matches the gateway MAC address in the CIDR network to which the next hop address belongs, and adds it to the SRC.MAC address register. In this way, the distributed router can identify the source CIDR network domain of the data frame when forwarding.

[0126] In addition, the network controller also allocates a number for the first static routing flow table item, for example, specifies that the number of the first static routing flow table item is table=12, that is, an IP routing table in the distributed router. The priority of the first static routing flow table item is set, and it is ensured that the priority of the newly added first static routing flow table item is between the global default route and the default route of the associated subnet CIDR. A higher priority is allocated by judging the prefix length of the CIDR, and the longer the prefix length is, the higher the priority is. When the priorities are the same, one of the first static routing flow table items is randomly selected. Traffic egress port information is added to the first static routing flow table item of the distributed router, and the traffic egress port information is used to ensure that data can be correctly forwarded to the CIDR network where the next hop address is located according to the logical routing port of the CIDR network matched with the next hop address. For example, the network (2.2.2.0 / 24) links the router A, and the static routing destination network: 5.5.5.0 / 24 next hop: 2.2.2.254 egress port information is added. The egress port information is the port to which the next hop IP address belongs, which can be a gateway or a virtual machine as a forwarding port. Only the port information needs to be recorded here.

[0127] The distributed router can perform the data forwarding method of the steps S101 to S105 or any embodiment thereof, and details are not repeated here.

[0128] The static routing flow table item generation method provided in the embodiment can configure a static routing flow table item for a distributed router, and give the distributed router in a virtualized network the ability to forward data packets through the static routing flow table item. The burden of the virtualized network controller on the host CPU and memory is effectively reduced, and the resource occupancy rate of the network in the virtualized environment is reduced. The problem that the routing flow table item needs to be frequently exchanged when forwarding data, generating update traffic, occupying additional network bandwidth, and affecting data forwarding efficiency is solved.

[0129] In some optional embodiments, the step of creating an interface for the distributed router by the network controller can include steps A1 to A6.

[0130] In step A1, when a tenant network is added to a virtual router, the network controller selects an unused first VF from a plurality of virtual functions VF (Virtual Function) virtually output by a network card of a physical network corresponding to a tenant network to create a tenant network interface for the virtual router.

[0131] Specifically, in actual application, in order to make the virtual router support the SR-IOV technology, the VF needs to be added to the virtual router, and then when adding the tenant network to the virtual router, the network controller can select an unused first VF from the plurality of VFs virtually output by the network card of the physical network corresponding to the tenant network to create a tenant network interface for the virtual router, so that the created tenant network interface is an SR-IOV type interface.

[0132] Step A2, setting the network attribute of the first VF based on the network attribute of the tenant network.

[0133] Specifically, after creating the tenant network interface according to the first VF, in order to enable the tenant network interface to normally send and receive packets, it is also necessary to set the first VF with corresponding network attributes according to the network attribute of the tenant network.

[0134] Step A3, when setting the gateway for the virtual router, the network controller selects an unused second VF from the plurality of VFs virtually output by the network card of the physical network corresponding to the gateway network to create a gateway interface for the virtual router.

[0135] Specifically, in actual application, in order to make the virtual router support the SR-IOV technology, the VF needs to be added to the virtual router, and in order for the virtual machine to be connected to the gateway network and then to the external network, when setting the gateway for the virtual router, the network controller can select an unused second VF from the plurality of VFs virtually output by the network card of the physical network corresponding to the gateway network to create a gateway interface for the virtual router, so that the created gateway interface is an SR-IOV type interface.

[0136] Step A4, setting the network attribute of the second VF based on the network attribute of the gateway network.

[0137] Specifically, after creating the gateway interface according to the second VF, in order to enable the gateway interface to normally send and receive packets, it is also necessary to set the second VF with corresponding network attributes according to the network attribute of the gateway network.

[0138] In the embodiment, first, when adding a tenant network to a virtual router, the network controller selects an unused first VF from a plurality of virtual functions VF virtually output by a network adapter of a physical network corresponding to the tenant network to create a tenant network interface for the virtual router, and sets network attributes of the first VF based on network attributes of the tenant network; then, when setting a gateway for the virtual router, the network controller selects an unused second VF from a plurality of VFs virtually output by a network adapter of a physical network corresponding to the gateway network to create a gateway interface for the virtual router, and sets network attributes of the second VF based on network attributes of the gateway network. In this way, the created virtual router interfaces, i.e., the tenant network interface and the gateway interface, are SR-IOV type interfaces, and the virtual router can support the SR-IOV technology, so that the virtual router can be directly connected to the physical network adapter, and the three-layer network forwarding performance of the virtual router is accelerated to a network forwarding performance comparable to that of a physical machine, thereby shortening the message forwarding path when using the tenant network interface and the gateway interface for message forwarding, and improving the three-layer network forwarding performance.

[0139] In some optional embodiments, the method further comprises:

[0140] determining whether the distributed router is configured with a distributed network address translation gateway;

[0141] if the distributed network address translation gateway is configured, obtaining a gateway address of the distributed network address translation gateway and a media access control address of a source network address translation gateway;

[0142] recording the gateway address in a first register of the distributed router and saving the media access control address in a second register of the distributed router;

[0143] generating a third static route flow table item in the distributed router according to the preset number, the preset priority, the preset network segment address, the gateway address, and the media access control address, and pointing traffic egress end information corresponding to the third static route flow table item to a network logical port of the distributed network address translation gateway.

[0144] Specifically, the embodiment sets rules to be followed when generating the first static route flow table item for the distributed router. Specifically, the rules include:

[0145] determining whether the distributed router is configured with a distributed network address translation gateway (distributed NAT gateway). If the distributed NAT gateway is configured, the network controller will automatically create a flow table item. The network controller obtains a gateway address of the distributed NAT gateway and a media access control address (Mac address) of a source network address translation (Snat) address.

[0146] The gateway address of the NAT gateway is recorded in a first register of the distributed router, for example, reg0; and the media access control address is stored in a second register of the distributed router, for example, reg1.

[0147] The preset number is, for example, table=12 (i.e., logical_route_in_ip), the preset priority is, for example, priority=1, and the preset network segment address is, for example, the full network range (0.0.0.0 / 0). According to the preset number, the preset priority, the preset network segment address, the gateway address, and the media access control address, a third static route flow table item is generated in the distributed router, the target IP segment (dst.ipv4) is set as the preset network segment address, and the source MAC address is set as the media access control address of the source network address translation gateway. The traffic egress port information corresponding to the third static route flow table item is directed to the network logical port of the distributed network address translation gateway.

[0148] In some optional embodiments, after the first static route flow table item in the distributed router is generated, the method further includes:

[0149] The first static route flow table item and the third static route flow table item are recorded in the database of the network controller.

[0150] According to the first static route flow table item, the third static route flow table item, and the associated information of the distributed router in the database, a static route table is created for the distributed router.

[0151] Specifically, after the first static route flow table item is generated, the network controller records the created static route table items, including the first static route flow table item and the third static route flow table item, in the database of the network controller.

[0152] The network controller creates a static route table for the distributed router according to the first static route flow table item, the third static route flow table item, and the associated information of the distributed router in the database. The associated information can include, for example, a number, a priority, and traffic egress port information.

[0153] Once the logical router is configured with the static route table, all the distributed routers in the virtualization environment can forward the static route flow table items for each virtual machine according to the information in the database of the network controller as needed, and synchronously update the route information, for example, as follows: Figure 6LogicalRoute is a logical router created by the network controller. In the distributed logic, the LogicalRoute can be regarded as three separate routers on three hosts, respectively DVR (distributed virtual router)_1, DVR_2, and DVR_3. There is only one LogicalRoute in the use layer and the perception layer. The orange line in the figure indicates that DVR_1, DVR_2, and DVR_3 can communicate with each other, and the blue line indicates that data is being transmitted because communication is needed. Therefore, the network controller creates a static routing table for the distributed router, that is, a static routing table for the logical router, including: Tabel=1, Tabel=2, Tabel=3, …, Tabel=12, etc., which can be added later. When two virtual machines need to communicate, the corresponding distributed routers DVR_1 and DVR_2 are forwarded static routing flow table items as needed, for example: Tabel=1, Tabel=2, Tabel=3, …, Tabel=12 are forwarded to DVR_1 and DVR_2. DVR_1 and DVR_2 will forward data according to the above static routing flow table items to realize the communication between the two virtual machines.

[0154] In the embodiment, a static routing table is created for the distributed router, realizing real-time synchronization between the distributed router and the network controller, and ensuring the consistency of the update of the flow table information of each distributed router. This ensures that even when a new node is added in a virtualized environment, the problem of synchronization of the flow table of the distributed router of the new host node with other routers does not occur.

[0155] In some optional embodiments, after determining whether the distributed network address translation gateway is configured, the method further comprises:

[0156] In the case where it is determined that the distributed network address translation gateway is configured, a judgment condition for prohibiting the creation of the first static routing flow table item is created, wherein the judgment condition is that the target network segment address corresponding to the first static routing flow table item is not a preset network segment address.

[0157] It is determined whether there is a first static routing flow table item of the target network segment address in the database.

[0158] If there is, the issuance of a new static routing flow table item creation task is stopped, and prompt information containing a static routing flow table item creation failure is output, wherein the static routing flow table item creation task is used to create the first static routing flow table item.

[0159] Specifically, to avoid the interference of the default static route (0.0.0.0 / 0) on the NAT gateway port forwarding function, the network controller creates a judgment condition for prohibiting the creation of the first static route flow table item in a case where it is determined that the distributed network address translation gateway is configured, ensures that the target network segment address corresponding to the created first static route flow table item is not the preset network segment address, and prohibits the creation of a static route with the target network segment address (target CIDR) of 0.0.0.0 / 0 after the NAT is bound.

[0160] Meanwhile, corresponding information is supplemented in the static route list of the network controller database. If the static route entry with the target CIDR of 0.0.0.0 / 0 already exists in the database of the network controller, the network controller will not issue a new static route creation task and will prompt a creation failure. The specific steps are as follows: the network controller judges whether the first static route flow table item with the target network segment address being the preset network segment address exists in the database. If yes, the network controller stops issuing the new static route flow table item creation task and outputs the prompt information containing the static route flow table item creation failure, wherein the static route flow table item creation task is used to create the first static route flow table item.

[0161] The above process is shown in Figure 7 The distributed router creates a static route; judges whether the static route has created a static route with the target CIDR of 0.0.0.0 / 0. If not, the creation is successful. If yes, the distributed router judges whether the distributed NAT gateway has been bound. If not, the creation is successful. If yes, the creation is not allowed and the prompt information is outputted.

[0162] In the embodiment, in a case where it is determined that the distributed network address translation gateway is configured, the interference on the forwarding function of the distributed network address translation gateway is avoided by creating the judgment condition and stopping the creation of the first static route flow table item with the target network segment address being the preset network segment address.

[0163] In the embodiment, a data forwarding device is also provided, which is used to implement the above-described embodiments and preferred embodiments, and details are not repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware or a combination of software and hardware is also possible and is contemplated.

[0164] The embodiment provides a data forwarding device, which is deployed in a distributed router, as shown in Figure 8 The data forwarding device comprises:

[0165] The first acquisition module 801 is configured to acquire a first target address of a data frame when receiving the data frame sent by a first host.

[0166] The first determining module 802 is configured to match the first target address with the first static routing flow table item, determine a target static routing flow table item with which the matching is successful, and parse the data frame to obtain a data packet;

[0167] The comparison module 803 is configured to obtain a second target address from the data packet, obtain a target network segment address from the target static routing flow table item, and compare the second target address with the target network segment address;

[0168] The updating module 804 is configured to, if the comparison is successful, obtain a third target address according to the target static routing flow table item, update the data packet according to the first target address and the third target address, and re-encapsulate the updated data packet to obtain a to-be-forwarded data frame;

[0169] The sending module 805 is configured to send the to-be-forwarded data frame to a target device according to the third target address, and send the data packet to a second host by the target device, where the second host is determined according to the second target address in the data packet.

[0170] In some optional embodiments, the updating module 804 obtains the third target address according to the target static routing flow table item, including:

[0171] In a case where the first host sends data to the second host for the first time, obtaining a next-hop address from the target static routing flow table item;

[0172] Sending an address resolution protocol broadcast according to the next-hop address to obtain the third target address;

[0173] In a case where the first host sends data to the second host for the first time, obtaining a next-hop address from the target static routing flow table item;

[0174] Querying the third target address in an address resolution protocol table according to the next-hop address.

[0175] In some optional embodiments, the apparatus is configured to:

[0176] Obtain a connected network segment address;

[0177] Determine whether the connected network segment address is within a preset network segment address range;

[0178] In a case where the connected network segment address is not within the preset network segment address range, obtaining a second static routing flow table item numbered as a preset number, and determining whether a distributed network address translation gateway is connected;

[0179] If the distributed network address translation gateway is not connected, matching the connected network segment address with a target network segment address in the second static routing flow table item;

[0180] If the matching is successful, the second static route flow table item is taken as a target static route flow table item corresponding to the connected network segment address.

[0181] If the connected distributed network address translation gateway is connected, a preset network segment address is taken as a target network segment address corresponding to the connected network segment address, and a gateway address of the distributed network address translation gateway is taken as a next hop address corresponding to the connected network segment address.

[0182] The embodiment provides a static route flow table item generation device, which is arranged in a network controller, such as a distributed router, and comprises a first obtaining module 901, a second obtaining module 902, and a generation module 903. Figure 9 As shown in the figure, the device comprises:

[0183] The first obtaining module 901 is configured to obtain a target network segment address, a next hop address, and a source media access control address.

[0184] The second obtaining module 902 is configured to determine a corresponding distributed router according to the target network segment address and the next hop address.

[0185] The generation module 903 is configured to generate a first static route flow table item in the distributed router according to the target network segment address, the next hop address, and the source media access control address, wherein the distributed router is used to execute the data forwarding method in the steps S101 to S105 or any of the embodiments thereof.

[0186] In some optional embodiments, the device is used for:

[0187] determining whether the distributed router is configured with a distributed network address translation gateway;

[0188] if the distributed network address translation gateway is configured, obtaining a gateway address of the distributed network address translation gateway and a media access control address of a source network address translation gateway;

[0189] recording the gateway address in a first register of the distributed router and saving the media access control address in a second register of the distributed router;

[0190] generating a third static route flow table item in the distributed router according to a preset number, a preset priority, a preset network segment address, the gateway address, and the media access control address, and pointing traffic egress end information corresponding to the third static route flow table item to a network logical port of the distributed network address translation gateway.

[0191] In some optional embodiments, after the first static route flow table item in the distributed router is generated, the device is further used for:

[0192] entering the first static route flow table item and the third static route flow table item into a database of the network controller.

[0193] According to the first static route flow table item, the third static route flow table item and the association information corresponding to the distributed router in the database, the static route table of the distributed router is created.

[0194] In some optional embodiments, after judging whether the distributed network address translation gateway is configured for the distributed router, the apparatus is further configured to:

[0195] In the case that the distributed network address translation gateway is configured, a judgment condition for prohibiting the creation of the first static route flow table item is created, wherein the judgment condition is that the target network segment address corresponding to the first static route flow table item is not the preset network segment address.

[0196] Judge whether the first static route flow table item of the target network segment address being the preset network segment address exists in the database.

[0197] If the first static route flow table item exists, stop issuing a new static route flow table item creation task, and output prompt information containing a static route flow table item creation failure, wherein the static route flow table item creation task is used to create the first static route flow table item.

[0198] Further function descriptions of the above-mentioned various modules and units are the same as those of the above-mentioned corresponding embodiments, and will not be repeated here.

[0199] The data forwarding apparatus in the embodiment is presented in the form of a functional unit, and the unit herein refers to an ASIC (Application Specific Integrated Circuit, Application Specific Integrated Circuit) circuit, a processor and a memory executing one or more software or fixed programs, and / or other devices that can provide the above-mentioned functions.

[0200] The embodiment of the application further provides a computer device having the above-mentioned Figure 8 data forwarding apparatus and the above-mentioned Figure 9 static route flow table item generation apparatus.

[0201] Please refer to Figure 10 , Figure 10 is a structural schematic diagram of a computer device provided by an optional embodiment of the application, as shown in Figure 10As shown, the computer device includes one or more processors 10, memory 20, and interfaces 30 for the various components to communicate with one another. The various components communicate through one or more buses, and can be mounted on a common motherboard or in other manners as appropriate. The processor 10 can execute instructions, for example, stored in the memory 20 or elsewhere to implement processes that the computer device is designed to perform, for example, the processes of the various embodiments described herein. The computer device also includes one or more mass storage devices 40 for storing data files. Such mass storage device 40 can include floppy disk drives, hard disk drives, or optical disc storage, or a combination of these, among others. The mass storage device 40 can store data including computer readable instructions for implementing the embodiments described herein. Figure 10 The processor 10 is used in the embodiments as an example.

[0202] The processor 10 can be a central processing unit, a network processor, or a combination of both. The processor 10 can further include a hardware chip. The hardware chip can be an application specific integrated circuit, a programmable logic device, or a combination of both. The programmable logic device can be a complex programmable logic device, a field programmable logic device, a general array logic, or any combination thereof.

[0203] The memory 20 stores instructions that can be executed by the at least one processor 10, to cause the at least one processor 10 to perform the methods described in the above embodiments.

[0204] The memory 20 can include a program storage area and a data storage area. The program storage area can store an operating system, application programs, and the like for use by the at least one processor 10. The data storage area can store data created by the computer device, as well as data received by the computer device. The memory 20 can also include a high speed random access memory (RAM), and can also include a non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some alternative embodiments, the memory 20 can include memory that is remote from the processor 10, such as the memory / storage devices 40 discussed below. The remote memory can be connected to the computer device through a network, such as the Internet, a proprietary area network, a local area network, a mobile communications network, or a combination of these. Examples of networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communications network, or a combination of these.

[0205] The memory 20 can include a volatile memory, such as random access memory (RAM), and can also include a non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. The memory 20 can also include a combination of these types of memory.

[0206] The computer device also includes a communication interface 30 that enables the computer device to communicate with other devices or networks with which it is in communication. For example, the communication interface 30 can enable the computer device to communicate with an external input / output device 50, such as a display, keyboard, or mouse; with a wireless communication network, such as a local area network (LAN), a metropolitan area network (MAN), or a wide area network (WAN); with a wireless node, such as a base station or an access point; or with a device of the network with which the computer device is in communication, such as a modem, a router, or a network switch.

[0207] The embodiments of the present application further provide a computer readable storage medium, and the method according to the embodiments of the present application can be implemented in hardware, firmware, or recorded in a storage medium, or stored in a remote storage medium or a non-transitory machine readable storage medium and downloaded to a local storage medium through network, so that the method described herein can be processed by such software on a storage medium using a general purpose computer, a special purpose processor, or programmable or special hardware. The storage medium can be a magnetic disk, an optical disk, a read-only memory, a random access memory, a flash memory, a hard disk, or a solid state disk, etc. Further, the storage medium can also include a combination of the above-mentioned memories. It can be understood that the computer, the processor, the microprocessor controller, or the programmable hardware includes a storage component that can store or receive software or computer code, when the software or computer code is accessed and executed by the computer, the processor, or the hardware, the method shown in the above embodiments is implemented.

[0208] Part of the present application can be applied as a computer program product, for example, computer program instructions, when executed by a computer, the operation of the computer can invoke or provide the method and / or technical solutions according to the present application. Those skilled in the art should understand that the form of computer program instructions in computer readable medium includes but is not limited to source file, executable file, installation package file, etc. Correspondingly, the way of computer program instructions executed by computer includes but is not limited to: the computer directly executes the instructions, or the computer compiles the instructions and then executes the corresponding compiled program, or the computer reads and executes the instructions, or the computer reads and installs the instructions and then executes the corresponding installed program. Here, the computer readable medium can be any available computer readable storage medium or communication medium accessible to the computer.

[0209] Although the embodiments of the present application are described in conjunction with the accompanying drawings, various modifications and changes can be made by those skilled in the art without departing from the spirit and scope of the present application, and such modifications and changes fall within the scope defined by the appended claims.

Claims

1. A data forwarding method, characterized by, The method is applied to a distributed router, and the method comprises: Upon receiving a data frame sent by a first host, obtaining a first target address of the data frame; matching the first target address with a first static routing flow table item, determining a target static routing flow table item with which matching succeeds, and parsing the data frame to obtain a data packet; obtaining a second target address from the data packet and a target network segment address from the target static routing flow table item, and comparing the second target address with the target network segment address; if the comparison succeeds, obtaining a third target address according to the target static routing flow table item, updating the data packet according to the first target address and the third target address, and re-encapsulating the updated data packet to obtain a data frame to be forwarded; sending the data frame to be forwarded to a target device according to the third target address, so that the target device sends the data packet to a second host, wherein the second host is determined according to the second target address in the data packet.

2. The method of claim 1, wherein, The method further comprises: in a case where the first host sends data to the second host for the first time, obtaining a next-hop address from the target static routing flow table item; issuing an address resolution protocol broadcast according to the next-hop address to obtain the third target address; in a case where the first host sends data to the second host for the first time, obtaining a next-hop address from the target static routing flow table item; querying the address resolution protocol table according to the next-hop address to obtain the third target address.

3. The method of claim 1, wherein, The method further comprises: obtaining a connected network segment address; determining whether the connected network segment address is within a preset network segment address range; in a case where the connected network segment address is not within the preset network segment address range, obtaining a second static routing flow table item with a preset number, and determining whether a distributed network address translation gateway is connected; if the distributed network address translation gateway is not connected, matching the connected network segment address with a target network segment address in the second static routing flow table item; if the matching succeeds, taking the second static routing flow table item as a target static routing flow table item corresponding to the connected network segment address; if the distributed network address translation gateway is connected, taking a preset network segment address as a target network segment address corresponding to the connected network segment address, and taking a gateway address of the distributed network address translation gateway as a next-hop address corresponding to the connected network segment address.

4. A method for generating a static routing flow table entry, the method comprising: The method is applied to a network controller, and the method comprises: obtaining a target network segment address, a next-hop address, and a source medium access control address; determining a corresponding distributed router according to the target network segment address and the next-hop address; generating a first static routing flow table item in the distributed router according to the target network segment address, the next-hop address, and the source medium access control address, wherein the distributed router is configured to execute the data forwarding method in any one of claims 1 to 3.

5. The method of claim 4, wherein, The method further comprises: determining whether the distributed router is configured with a distributed network address translation gateway; if the distributed network address translation gateway is configured, obtaining a gateway address of the distributed network address translation gateway and a media access control address of a source network address translation gateway; recording the gateway address in a first register of the distributed router and saving the media access control address in a second register of the distributed router; generating a third static route flow table item in the distributed router according to a preset number, a preset priority, a preset network segment address, the gateway address and the media access control address, and pointing to a network logical port of the distributed network address translation gateway with traffic egress information corresponding to the third static route flow table item.

6. The method of claim 5, wherein, After the first static route flow table item in the distributed router is generated, the method further comprises: entering the first static route flow table item and the third static route flow table item into a database of the network controller; creating a static route table for the distributed router according to the first static route flow table item, the third static route flow table item and associated information corresponding to the distributed router in the database.

7. The method of claim 6, wherein, After the determination of whether the distributed router is configured with the distributed network address translation gateway, the method further comprises: if it is determined that the distributed network address translation gateway is configured, creating a judgment condition for prohibiting the creation of the first static route flow table item, wherein the judgment condition is that the target network segment address corresponding to the first static route flow table item is not the preset network segment address; determining whether there is a first static route flow table item with the preset network segment address in the database; if there is, stopping the issuance of a new static route flow table item creation task and outputting prompt information containing a static route flow table item creation failure, wherein the static route flow table item creation task is used to create the first static route flow table item.

8. A data forwarding apparatus, characterized by comprising: The device is deployed in a distributed router, and the device comprises: a first obtaining module, configured to obtain a first target address of a data frame when the data frame sent by a first host is received; a first determining module, configured to match the first target address with a first static route flow table item, determine a target static route flow table item with a matching success, and parse a data packet from the data frame; a comparison module, configured to obtain a second target address from the data packet and a target network segment address from the target static route flow table item, and compare the second target address with the target network segment address; an updating module, configured to, if the comparison is successful, obtain a third target address according to the target static route flow table item, update the data packet according to the first target address and the third target address, and re-encapsulate the updated data packet to obtain a to-be-forwarded data frame; and a sending module, configured to send the to-be-forwarded data frame. The sending module is configured to send the data frame to be forwarded to a target device according to the third target address, and send the data packet to a second host by the target device, wherein the second host is determined according to the second target address in the data packet.

9. A static route flow table entry generation apparatus, characterized by comprising: The device is deployed in a network controller, and the device comprises: The second obtaining module is configured to obtain a target network segment address, a next hop address, and a source medium access control address; The second determining module is configured to determine a corresponding distributed router according to the target network segment address and the next hop address; The generating module is configured to generate a first static route flow table item in the distributed router according to the target network segment address, the next hop address, and the source medium access control address, wherein the distributed router is configured to execute the data forwarding method in any one of claims 1 to 3.

10. A computer device, comprising: The device comprises: A memory and a processor, which are communicatively connected, and the memory stores computer instructions, and the processor executes the computer instructions to execute the data forwarding method in any one of claims 1 to 3 or the static route flow table item generation method in any one of claims 4 to 7.

11. A computer readable storage medium, characterized in that, The computer readable storage medium stores computer instructions, and the computer instructions are used to make a computer execute the data forwarding method in any one of claims 1 to 3 or the static route flow table item generation method in any one of claims 4 to 7.

Citation Information

Patent Citations

  • Method and device for transmitting data message

    CN104869058A

  • Network management method and device, equipment and storage medium

    CN113691453A