Data forwarding method, static routing flow table entry generation method and device, computer equipment and storage medium
By using the static routing flow table entry generation method in the virtualized network, the efficiency problem caused by the frequent exchange of routing flow table entries by distributed routers in the virtualized network environment is solved, and more efficient data forwarding performance and resource utilization are achieved.
Patent Information
- Application Number
- CN202410852205.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-27
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2044-06-27
AI Technical Summary
In a virtualized network environment, when distributed routers implement data forwarding through dynamic routing, routing flow table entries need to be frequently exchanged, resulting in an increase in update traffic, occupying additional network bandwidth, and affecting data forwarding efficiency.
The static routing flow table generation method is used to obtain and match the destination address of the data frame, match it with the static routing flow table entry, update the data packet, and realize data forwarding without frequently exchanging routing flow table entries, reducing the network cost. The burden the controller places on the host CPU and memory.
It effectively improves the usability and forwarding performance of distributed routers in virtualized network environments, reduces network resource occupancy, and solves efficiency problems caused by frequent exchange of routing flow table entries.
Smart Images

Figure CN118784548A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of virtualized network technology, and in particular to a data forwarding method, a static routing flow table item generation method, a device, a computer device and a storage medium. Background Art
[0002] In small and medium-sized virtualized network environments, routers play a vital role. They not only connect multiple networks, but also act as gateways between networks. They are responsible for reading the address information in data packets and determining the data transmission path. For example, they can identify and process multiple network protocols, such as the Ethernet protocol commonly used in local area networks and the TCP / IP (Transmission Control Protocol / Internet Protocol) protocol widely used on the Internet. In this way, routers can parse data packets from different network types, perform address translation (such as converting non-TCP / IP addresses to TCP / IP addresses, or vice versa), and send data to the destination along the best path based on the selected routing algorithm.
[0003] As a software-defined routing device, virtualized distributed routers have shortcomings in forwarding efficiency compared to traditional physical routers. Currently, most software-defined distributed routers use dynamic routing to achieve data forwarding, which requires frequent exchange of routing flow table entries between distributed routers, generates update traffic, occupies additional network bandwidth, affects data forwarding efficiency, and increases the load on the CPU (Central Processing Unit) accordingly.
[0004] Therefore, the related technology has the problem that when forwarding data, it is necessary to frequently exchange routing flow table entries, generate update traffic, occupy additional network bandwidth, and affect data forwarding efficiency. Summary of the invention
[0005] In view of this, the present invention provides a data forwarding method, a static routing flow table generation method, an apparatus, a computer device and a storage medium to solve the problem that when forwarding data, routing 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 invention provides a data forwarding method, which is applied to a distributed router, comprising:
[0007] When receiving a data frame sent by the first host, obtaining a first target address of the data frame;
[0008] Matching the first target address with the first static routing flow table entry, determining a successfully matched target static routing flow table entry, and parsing the data frame to obtain a data packet;
[0009] Obtaining a second destination address from the data packet, obtaining a destination network segment address from the destination static routing flow table entry, and comparing the second destination address with the destination network segment address;
[0010] If the comparison is successful, the third target address is obtained according to the target static routing flow table entry, 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;
[0011] According to the third target address, the data frame to be forwarded is sent to the target device, and the target device sends the data packet to the second host, wherein the second host is determined according to the second target address in the data packet.
[0012] In the data forwarding method provided in this embodiment, the distributed router implements data forwarding according to the first static routing flow table entry, without the need to frequently exchange routing flow table entries, which effectively reduces the burden of the network controller on the host CPU and memory, and reduces the resource occupancy rate of the network in the virtualized environment. The usability and forwarding performance of the distributed router in the virtualized network environment are significantly improved. The problem of frequently exchanging routing flow table entries when forwarding data, generating update traffic, occupying additional network bandwidth, and affecting data forwarding efficiency is solved.
[0013] In some optional implementations, obtaining the third target address according to the target static routing flow entry includes:
[0014] When the first host sends data to the second host for the first time, obtain the next hop address from the target static route flow table entry;
[0015] Send out an address resolution protocol broadcast according to the next hop address to obtain a third target address;
[0016] When the first host does not send data to the second host for the first time, obtain the next hop address from the target static route flow table entry;
[0017] The third target address is obtained by querying the address resolution protocol table according to the next hop address.
[0018] In this embodiment, different methods are used to obtain the third target address 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, ensuring that the data can be forwarded to the correct address.
[0019] In some optional embodiments, the method further comprises:
[0020] Get the connected network segment address;
[0021] Determine whether the connected network segment address is within the preset network segment address range;
[0022] When the connected network segment address is not within the preset network segment address range, obtaining a second static routing flow table entry numbered with a preset number, and determining whether to connect to a distributed network address translation gateway;
[0023] If the distributed network address translation gateway is not connected, matching the connected network segment address with the target network segment address in the second static route flow table entry;
[0024] If the match succeeds, the second static route flow table entry is used as the target static route flow table entry corresponding to the connected network segment address;
[0025] If a distributed network address translation gateway is connected, the preset network segment address is used as the target network segment address corresponding to the connected network segment address, and the gateway address of the distributed network address translation gateway is used as the next hop address corresponding to the connected network segment address.
[0026] In a second aspect, the present invention provides a method for generating a static routing flow table entry, which is applied to a network controller and includes:
[0027] Obtain the target network segment address, next hop address, and source media access control address;
[0028] Determine the corresponding distributed router based on the target network segment address and next hop address;
[0029] A first static routing flow table entry in a 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 the first aspect or any corresponding implementation method thereof.
[0030] The static routing flow table generation method provided in this embodiment configures static routing flow table entries for distributed routers, thereby giving distributed routers in a virtualized network the ability to forward data packets through static routing flow table entries. This effectively reduces the burden of the virtualized network controller on the host CPU and memory, and reduces the resource occupancy rate of the network in a virtualized environment. This solves the problem of frequently exchanging routing flow table entries when forwarding data, generating update traffic, occupying additional network bandwidth, and affecting data forwarding efficiency.
[0031] In some optional embodiments, the method further comprises:
[0032] Determine whether the distributed router is configured with a distributed network address translation gateway;
[0033] If a 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 the source network address translation gateway;
[0034] Recording the gateway address in a first register of the distributed router and storing the media access control address in a second register of the distributed router;
[0035] According to the preset number, preset priority, preset network segment address, gateway address and media access control address, a third static routing flow table entry is generated in the distributed router, and the traffic exit port information corresponding to the third static routing flow table entry is pointed to the network logical port of the distributed network address translation gateway.
[0036] In some optional implementations, after generating the first static routing flow entry in the distributed router, the method further includes:
[0037] Entering the first static route flow entry and the third static route flow entry into a database of the network controller;
[0038] A static routing table is created for the distributed router according to the first static routing flow entry, the third static routing flow entry and the associated information corresponding to the distributed router in the database.
[0039] In this embodiment, a static routing table is created for the distributed router, and the real-time synchronization of the database between the distributed router and the network controller is achieved to ensure the consistency of the updated flow table information of each distributed router. This ensures that even when a new node is added in the virtualized environment, there will be no problem of the flow table of the distributed router of the newly added host node being out of sync with that of other routers.
[0040] In some optional implementations, after determining whether the distributed router is configured with a distributed network address translation gateway, the method further includes:
[0041] In the case where it is determined that a distributed network address translation gateway is configured, creating a judgment condition for prohibiting the creation of a first static routing flow table entry, wherein the judgment condition is that the target network segment address corresponding to the first static routing flow table entry is not a preset network segment address;
[0042] Determine whether there is a first static route flow entry in the database whose target network segment address is a preset network segment address;
[0043] If it exists, stop issuing the new static route flow table item creation task, and output prompt information including 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.
[0044] In this embodiment, when it is determined that a distributed network address translation gateway is configured, interference with the forwarding function of the distributed network address translation gateway is avoided by creating a judgment condition and stopping the creation of the first static routing flow table entry whose target network segment address is a preset network segment address.
[0045] In a third aspect, the present invention provides a data forwarding device, which is deployed in a distributed router and includes:
[0046] A first acquisition module, configured to acquire a first target address of a data frame when receiving a data frame sent by a first host;
[0047] A first determination module is used to match the first target address with the first static routing flow table item, determine the successfully matched target static routing flow table item, and parse the data frame to obtain a data packet;
[0048] A comparison module, used to obtain a second destination address from the data packet, obtain a destination network segment address from a destination static routing flow table entry, and compare the second destination address with the destination network segment address;
[0049] An updating module, configured to obtain a third target address according to the target static routing flow table entry if the comparison is successful, 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 data frame to be forwarded;
[0050] The sending module is used to send the data frame to be forwarded to the target device according to the third target address, and the target device sends the data packet to the second host, wherein the second host is determined according to the second target address in the data packet.
[0051] In a fourth aspect, the present invention provides a static routing flow table entry generation device, which is deployed in a network controller and includes:
[0052] A second acquisition module, used to acquire a target network segment address, a next hop address, and a source media access control address;
[0053] A second determination module is used to determine the corresponding distributed router according to the target network segment address and the next hop address;
[0054] A generation module is used to generate a first static routing flow table entry in a distributed router according to a target network segment address, a next hop address, and a source media access control address, wherein the distributed router is used to execute the data forwarding method of the first aspect or any corresponding implementation method thereof.
[0055] In a fifth aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor are communicatively connected to each other, computer instructions are stored in the memory, and the processor executes the data forwarding method of the above-mentioned first aspect or any corresponding embodiment thereof by executing the computer instructions, or executes the static routing flow table entry generation method of the above-mentioned second aspect or any corresponding embodiment thereof.
[0056] In a sixth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the data forwarding method of the first aspect or any corresponding embodiment thereof, or to execute the static routing flow table entry generation method of the second aspect or any corresponding embodiment thereof.
[0057] In the seventh aspect, the present invention provides a computer program product, including computer instructions, which are used to enable a computer to execute the data forwarding method of the above-mentioned first aspect or any corresponding embodiment, or to execute the static routing flow table entry generation method of the above-mentioned second aspect or any corresponding embodiment. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the related technologies, the drawings required for use in the specific embodiments or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0059] Figure 1 is a schematic flow chart of a data forwarding method according to an embodiment of the present invention;
[0060] Figure 2 is a logical diagram of each host distributed router according to an embodiment of the present invention;
[0061] Figure 3 is a schematic diagram of matching static routing flow table entries according to an embodiment of the present invention;
[0062] Figure 4 is a schematic diagram of screening static routing flow table entries according to an embodiment of the present invention;
[0063] Figure 5 is a schematic diagram of a process for generating a static routing flow entry according to an embodiment of the present invention;
[0064] Figure 6 is a schematic diagram of entering a static routing flow table entry into a network controller according to an embodiment of the present invention;
[0065] Figure 7 is a flow chart of a network controller sending a static routing flow entry according to an embodiment of the present invention;
[0066] Figure 8 is a structural block diagram of a data forwarding device according to an embodiment of the present invention;
[0067] Fig. 9 is a structural block diagram of a device for generating static routing flow table entries according to an embodiment of the present invention;
[0068] Fig.10 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0069] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0070] The embodiment of the present invention provides a data forwarding method, which uses the network controller to issue instructions in a virtualized network environment to achieve the creation of a distributed router. In this process, each node will generate a logical distributed router. Then, an interface is created through the network controller, and a static routing flow table entry is added to the router. The router implements the data forwarding function according to the static routing flow table entry. This effectively reduces the burden of dynamic routing on the CPU and memory, shortens the CPU processing time, and enables network administrators to configure and monitor distributed routing more easily, while simplifying the effect of the routing configuration process.
[0071] According to an embodiment of the present invention, a data forwarding embodiment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a distributed router, and although a 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 this embodiment, a data forwarding method is provided, which can be used in a distributed router. Figure 1 is a flow chart of a data forwarding method according to an embodiment of the present invention. Figure 1 As shown, the process 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 used to issue instructions to create a distributed router, such as Figure 2 As shown in the figure, LogicalRoute is the logical router created by the network controller. In the distributed logic, LogicalRoute can be regarded as three distributed routers on three hosts, namely DVR (distributed virtual router)_1, DVR_2, and DVR_3. There is only one LogicalRoute at the usage and perception level. Figure 2 The blue line in the figure indicates that there is a virtual machine distributed router on each host. The green line indicates that in the overall logical concept, three hosts are chained on one router. The IP addresses of the three hosts are: 192.168.0.0 / 24, 192.168.1.0 / 24, and 192.168.2.0 / 24. Each host is a node.
[0075] Combination Figure 3 This embodiment is described. Figure 3 In the example, a virtual machine with an IP address of 192.168.0.2 and a CIDR of 192.168.0.0 / 24 wants 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] For example, the first host is the host where the virtual machine with an IP address of 192.168.0.2 and a CIDR of 192.168.0.0 / 24 is located. Based on the Internet Control Message Protocol (ICMP), the distributed router receives a message with a header containing a Mac (Media Access Control Address) address of fa:16:3e:b1:75:39 through a gateway with an address of 192.168.0.1. The message contains a data frame sent by the first host. When the distributed router receives the data frame sent by the first host, it obtains the first target address of the data frame. The first target address is the target Mac address contained in the header of the message, for example: fa:16:3e:b1:75:39.
[0077] Step S102, matching the first target address with the first static routing flow table entry, determining a successfully matched target static routing flow table entry, and parsing the data frame to obtain a data packet.
[0078] Specifically, there are multiple first static routing flow table entries in the distributed router, and the first static routing flow table entries are used to manage all network communication forwarding rules and policies, for example: Figure 3 As shown, there are 4 first static route flow table entries, namely: 1. tabel = x(xxx), pr(xx), dst(5.5.5.0 / 24), reg0(192.168.0.5); 2. tabel = x(xxx), pr(xx), dst(4.4.4.0 / 24), reg0(192.168.0.6); 3. tabel = x(xxx), pr(xx), dst(xxxx), reg0(xxxx); 4. tabel = 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 the abbreviation of priority, dst is the abbreviation of destination, and indicates the destination CIDR address, reg (register), src (source).
[0079] The distributed router checks whether the first destination address of the data frame matches its first static routing flow table entry. If it matches and satisfies the fourth forwarding rule in the flow table, the router continues to process the data frame, otherwise, the data frame will be discarded. The first destination address is matched with the first static routing flow table entry. For example, if the first destination address is fa:16:3e:b1:75:39, it is matched with the above four first static routing flow table entries. src.mac (fa:16:3e:b1:75:39) is found in the first static routing flow table entry of the fourth table=12, so this data packet is not discarded and forwarding continues. The successfully matched target static routing flow table entry is the first static routing flow table entry of the fourth table=12.
[0080] After a successful match, the distributed router parses the data frame and extracts the data packet.
[0081] Step S103, obtaining a second target address from the data packet, obtaining a target network segment address from the target static routing flow table entry, and comparing the second target address with the target network segment address.
[0082] Specifically, the distributed router obtains the target IP address in the IP header of the data packet as the second target address, such as 8.8.8.8. The target network segment address is obtained from the target static routing flow table entry, for example: the target static routing flow table entry 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 its target network segment address is dst(8.8.8.0 / 24).
[0083] The distributed router compares the second destination address with the destination network segment address and determines the destination network connection to which the data packet should be forwarded based on the comparison result. For example, 8.8.8.8 is compared with dst(8.8.8.0 / 24), and since 8.8.8.8 satisfies dst(8.8.8.0 / 24) in the destination static route flow table, the comparison is successful.
[0084] Step S104, if the comparison is successful, obtain the third target address according to the target static routing flow table entry, 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 data frame to be forwarded.
[0085] Specifically, if the comparison is successful, the distributed router obtains the next hop address reg0 (192.168.10.5) from the target static routing flow table, and then obtains the Mac address of the next hop address as the third target address through the next hop address, for example: using the ARP (Address Resolution Protocol) table to obtain the Mac address of the next hop address.
[0086] The distributed router updates the data packet according to the first target address and the third target address, including: the distributed router discards the original MAC header in the data packet, adds the first target address and the third target address to the data packet, for example: modifies the MAC header of the data packet to the first target address fa:16:3e:b1:75:39, and modifies the target MAC address to the third target address, i.e., the Mac address of the next hop address.
[0087] Before forwarding the data packet to the next routing interface, the distributed router re-encapsulates the data packet to obtain a data frame to be forwarded.
[0088] Step S105, sending the data frame to be forwarded to the target device according to the third target address, and the target device sends the data packet to the second host, wherein 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, that is, the next hop address. The device of the next address is the target device. The target device performs the final 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 is the second target address, for example: 8.8.8.8, so that the data packet is sent to the final destination IP 8.8.8.8.
[0090] In the data forwarding method provided in this embodiment, the distributed router implements data forwarding according to the first static routing flow table entry, without the need to frequently exchange routing flow table entries, which effectively reduces the burden of the network controller on the host CPU and memory, and reduces the resource occupancy rate of the network in the virtualized environment. The usability and forwarding performance of the distributed router in the virtualized network environment are significantly improved. The problem of frequently exchanging routing flow table entries when forwarding data, generating update traffic, occupying additional network bandwidth, and affecting data forwarding efficiency is solved.
[0091] In some optional implementations, obtaining the third target address according to the target static routing flow entry includes:
[0092] When the first host sends data to the second host for the first time, obtain the next hop address from the target static route flow table entry;
[0093] Send out an address resolution protocol broadcast according to the next hop address to obtain a third target address;
[0094] When the first host does not send data to the second host for the first time, obtain the next hop address from the target static route flow table entry;
[0095] The third target address is obtained 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 an address resolution protocol (ARP) broadcast to obtain the target MAC address as the third target address, and obtain the Mac address of the next hop address through the ARP broadcast packet. The steps include:
[0097] The distributed router obtains the next hop address from the target static route flow table entry. For example, the target static route flow table entry 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 its next hop address 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 according to the ARP broadcast packet as the third target address.
[0099] When the first host does not send data to the second host for the first time, the next hop address is obtained from the target static route flow table entry, and then the Mac address corresponding to the next hop address, that is, the third target address, is queried in the ARP table.
[0100] In this embodiment, different methods are used to obtain the third target address 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, ensuring that the data can be forwarded to the correct address.
[0101] In some optional embodiments, the method further comprises:
[0102] Get the connected network segment address;
[0103] Determine whether the connected network segment address is within the preset network segment address range;
[0104] When the connected network segment address is not within the preset network segment address range, obtaining a second static routing flow table entry numbered with a preset number, and determining whether to connect to a distributed network address translation gateway;
[0105] If the distributed network address translation gateway is not connected, matching the connected network segment address with the target network segment address in the second static route flow table entry;
[0106] If the match succeeds, the second static route flow table entry is used as the target static route flow table entry corresponding to the connected network segment address;
[0107] If a distributed network address translation gateway is connected, the preset network segment address is used as the target network segment address corresponding to the connected network segment address, and the gateway address of the distributed network address translation gateway is used as the next hop address corresponding to the connected network segment address.
[0108] Specifically, after the network controller sets the first static route flow entry in the distributed router, the router obtains the connected network segment address, for example: Figure 4As shown, the connected network segment addresses include 5.5.5.2 and 8.8.8.8, wherein ping (Packet Internet Groper) is a computer network management application, which is usually used to confirm whether a host on the Internet is reachable; 192.168.0.2ping 5.5.5.2 indicates confirming whether the IP address 192.168.0.2 is connected to the network segment address 5.5.5.2, and 192.168.0.2ping 8.8.8.8 indicates confirming whether the IP address 192.168.0.2 is connected to the network segment address 8.8.8.8. The above two operations can obtain the connected network segment addresses of the distributed router including 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] Determine whether the connected network segment address is within the preset network segment address range. 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] When the connected network segment address is not within the preset network segment address range, obtain the second static route flow table entry with the preset number (Table), such as 12, namely logical_route_in_ip, and use the first static route flow table entry with the number 12 as the second static route flow table entry, and the destination address + the next entry is the table12 flow table entry. Determine whether the distributed router is connected to the distributed Network Address Translation (NAT) gateway.
[0111] Combination Figure 4 This 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 entry, such as Figure 4 As shown, the second static route flow table entry includes: 1. The destination address is 5.5.5.0 / 24, and the next hop route IP is 192.168.0.254; 2. The destination address is 4.4.4.0 / 24, and the next hop route IP is 192.168.0.253; 3. The destination address is 3.3.3.0 / 24, and the next hop route IP is 192.168.0.252. The default destination address is 192.168.0.0 / 24, and the default next hop route IP is 192.168.1.1; the default destination address is 192.168.1.0 / 24, and the default next hop route IP is 192.168.0.1 are two other static route flow table entries.
[0113] If the match is successful, the second static routing flow table entry is used as the target static routing flow table entry corresponding to the connected network segment address. For example, the connected network segment address is 5.5.5.2. After matching, it successfully matches the destination address 5.5.5.0 / 24. The second static routing flow table entry (that is, the destination address is 5.5.5.0 / 24, and the next-hop routing IP is 192.168.0.254) is used as the target static routing flow table entry corresponding to the connected network segment address. Then, the router will perform the forwarding operation to the next hop according to the next IP address information stored in register reg0.
[0114] If the distributed router is connected to the distributed NAT gateway, the preset network segment address is used as the target network segment address corresponding to the connected network segment address, for example, the preset network segment address is: 0.0.0.0 / 0, and the IP address of the distributed NAT gateway is used as the next hop address corresponding to the connected network segment address. Then, the distributed router will perform forwarding operations to the next hop according to the next hop address stored in register reg0.
[0115] According to an embodiment of the present invention, an embodiment of a method for generating a static routing flow table entry is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a network controller, and although a 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 this embodiment, a static routing flow table generation method is provided, which can be used in a network controller. Figure 5 is a flow chart of a data forwarding method according to an embodiment of the present invention. Figure 5 As shown, the process includes the following steps:
[0117] Step S501, obtaining a target network segment address, a next hop address and a source media access control address.
[0118] Specifically, in a virtualized network environment, the network controller issues instructions to create distributed routers, such as Figure 2 As shown, LogicalRoute is a distributed router created by the network controller. Then, an interface is created for the distributed router through the network controller, and a static routing flow table entry is generated for the distributed router, thereby realizing its static routing function.
[0119] The network controller creates a static route flow table entry. First, through the network controller interface, define the destination classless inter-domain route (destination CIDR), that is, the target network segment address and the next hop IP address, that is, 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 obtains the source media access control address (source Mac address), for example: fa:16:3e:b1:75:39.
[0121] Step S502: Determine the corresponding distributed router 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, and then selects the corresponding distributed router according to the ID and adds a static routing flow entry for it.
[0123] Set the register values in the distributed router, where reg0 stores the next hop address and reg1 stores the target network segment address, so that the distributed router can obtain the next hop IPv4 address from the register when forwarding data.
[0124] Step S503, generating a first static routing flow entry 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 of the above steps S101 to S105 or any corresponding implementation method thereof.
[0125] Specifically, the network controller generates a first static routing flow table entry in the distributed router, the first static routing flow table entry includes the above-mentioned 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 entry, by matching the gateway MAC address in the CIDR network to which the next hop address belongs, and adding 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 will also assign a number to the first static route flow table item, for example: specify the number of the first static route flow table item as table=12, that is, the IP routing table in the distributed router. Set the priority of the first static route flow table item to ensure that the priority of the newly added first static route flow table item is between the default route of the entire network and the default route of the associated subnet CIDR. By judging the prefix length of the CIDR, a higher priority is assigned, wherein the longer the prefix length, the higher the priority. When the priority is the same, a first static route flow table item will be randomly selected. Add traffic egress port information to the first static route flow table item of the distributed router, and ensure that the 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 matching the next hop address. For example, the traffic egress port information: network (2.2.2.0 / 24) links to router A, add static route destination network: 5.5.5.0 / 24 next hop: 2.2.2.254 egress port information, that is, the port to which the next hop IP address belongs, which can be a gateway or a virtual machine as a forwarding port. Here, only his port information needs to be recorded.
[0127] The distributed router may execute the data forwarding method of steps S101 to S105 or any corresponding implementation manner thereof, which will not be described in detail here.
[0128] The static routing flow table generation method provided in this embodiment configures static routing flow table entries for distributed routers, thereby giving distributed routers in a virtualized network the ability to forward data packets through static routing flow table entries. This effectively reduces the burden of the virtualized network controller on the host CPU and memory, and reduces the resource occupancy rate of the network in a virtualized environment. This solves the problem of frequently exchanging routing flow table entries when forwarding data, generating update traffic, occupying additional network bandwidth, and affecting data forwarding efficiency.
[0129] In some optional implementations, the step of the network controller creating an interface for the distributed router may include steps A1 to A6.
[0130] Step A1, when adding a tenant network to a virtual router, the network controller selects an unused first VF from multiple virtual functions VF (Virtual Function, virtual function) virtualized by the network card of the physical network corresponding to the tenant network to create a tenant network interface for the virtual router.
[0131] Specifically, in actual applications, in order to make the virtual router support SR-IOV technology, it is necessary to add VF to the virtual router. Next, when adding a tenant network to the virtual router, the network controller can select an unused first VF from multiple VFs virtualized by the network card of the physical network corresponding to the tenant network to create a tenant network interface for the virtual router. In this way, the created tenant network interface is an SR-IOV type interface.
[0132] Step A2: Setting the network attributes of the first VF based on the network attributes of the tenant network.
[0133] Specifically, after the tenant network interface is created according to the first VF, in order to enable the tenant network interface to normally send and receive messages, it is also necessary to set corresponding network attributes for the first VF according to the network attributes of the tenant network.
[0134] Step A3, when setting a gateway for the virtual router, the network controller selects an unused second VF from multiple VFs virtualized 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 applications, in order to make the virtual router support SR-IOV technology, it is necessary to add VF to the virtual router. In order for the virtual machine to be connected to the gateway network and then to the external network, when the virtual router sets the gateway, the network controller can select an unused second VF from the multiple VFs virtualized by the network card of the physical network corresponding to the gateway network to create a gateway interface for the virtual router. In this way, the created gateway interface is an SR-IOV type interface.
[0136] Step A4: Setting the network attributes of the second VF based on the network attributes of the gateway network.
[0137] Specifically, after the gateway interface is created according to the second VF, in order to enable the gateway interface to normally send and receive messages, the second VF also needs to be set with corresponding network attributes according to the network attributes of the gateway network.
[0138] In this embodiment, first, when adding a tenant network to a virtual router, the network controller selects an unused first VF from multiple virtual functions VF virtualized by the network card of the physical network corresponding to the tenant network to create a tenant network interface for the virtual router, and sets the network attributes of the first VF based on the network attributes of the tenant network; then, when setting a gateway for the virtual router, the network controller selects an unused second VF from multiple VF virtualized by the network card of the physical network corresponding to the gateway network to create a gateway interface for the virtual router, and sets the network attributes of the second VF based on the network attributes of the gateway network. In this way, the created virtual router interface is realized, that is, the tenant network interface and the gateway interface are both SR-IOV type interfaces, which can realize that the virtual router supports SR-IOV technology, so that the virtual router can be directly connected to the physical network card, so that the three-layer network forwarding performance of the virtual router is accelerated to reach the network forwarding performance equivalent to that of the physical machine, so that when using the tenant network interface and the gateway interface for message forwarding, the message forwarding path can be shortened, and the three-layer network forwarding performance will be improved.
[0139] In some optional embodiments, the method further comprises:
[0140] Determine whether the distributed router is configured with a distributed network address translation gateway;
[0141] If a 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 the source network address translation gateway;
[0142] Recording the gateway address in a first register of the distributed router and storing the media access control address in a second register of the distributed router;
[0143] According to the preset number, preset priority, preset network segment address, gateway address and media access control address, a third static routing flow table entry is generated in the distributed router, and the traffic exit port information corresponding to the third static routing flow table entry is pointed to the network logical port of the distributed network address translation gateway.
[0144] Specifically, this embodiment sets the rules to be followed when generating the first static routing flow entry for the distributed router, including:
[0145] Determine whether the distributed router is configured with a distributed network address translation gateway (distributed NAT gateway). If a distributed NAT gateway is configured, the network controller will automatically create a flow table entry. The network controller obtains the gateway address of the distributed NAT gateway and the media access control address (Mac address) of the source network address translation gateway (Source Network Address Translation, SNAT) address.
[0146] The gateway address of the NAT gateway is recorded in the first register of the distributed router, for example, the first register is reg0; the media access control address is stored in the second register of the distributed router, for example, the second register is 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 entire 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 routing flow table entry is generated in the distributed router, and the target IP segment (dst.ipv4) is set to the preset network segment address, and the source MAC address is set to the media access control address of the source network address translation gateway. The flow exit port information corresponding to the third static routing flow table entry is pointed to the network logical port of the distributed network address translation gateway.
[0148] In some optional implementations, after generating the first static routing flow entry in the distributed router, the method further includes:
[0149] Entering the first static route flow entry and the third static route flow entry into a database of the network controller;
[0150] A static routing table is created for the distributed router according to the first static routing flow entry, the third static routing flow entry and the associated information corresponding to the distributed router in the database.
[0151] Specifically, after generating the first static route flow table entry, the network controller enters the created static route table entry including: the first static route flow table entry and the third static route flow table entry into a database of the network controller.
[0152] The network controller creates a static routing table for the distributed router according to the first static routing flow entry, the third static routing flow entry and the associated information corresponding to the distributed router in the database. The associated information may include: number, priority, traffic egress port information, etc.
[0153] Once the static routing table is configured for the logical router, all distributed routers in the virtualized environment can forward static routing flow entries for each virtual machine as needed based on the information in the network controller database and simultaneously update the routing information. For example: Figure 6As shown in the figure, LogicalRoute is the logical router created by the network controller. In the distributed logic, LogicalRoute can be regarded as three distributed routers on three hosts, namely DVR (distributed virtual router)_1, DVR_2, and DVR_3. There is only one LogicalRoute at the usage and perception levels. 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 of the need for communication. 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., and can be added later. When two virtual machines need to communicate, the static routing flow table entries will be forwarded to their corresponding distributed routers DVR_1 and DVR_2 as needed. For example, the static routing flow table entries Tabel=1, Tabel=2, Tabel=3, ..., Tabel=12 will be forwarded to DVR_1 and DVR_2. DVR_1 and DVR_2 will forward data according to the above static routing flow table entries to realize communication between the two virtual machines.
[0154] In this embodiment, a static routing table is created for the distributed router, and the real-time synchronization of the database between the distributed router and the network controller is achieved to ensure the consistency of the updated flow table information of each distributed router. This ensures that even when a new node is added in the virtualized environment, there will be no problem of the flow table of the distributed router of the newly added host node being out of sync with that of other routers.
[0155] In some optional implementations, after determining whether the distributed router is configured with a distributed network address translation gateway, the method further includes:
[0156] In the case where it is determined that a distributed network address translation gateway is configured, creating a judgment condition for prohibiting the creation of a first static routing flow table entry, wherein the judgment condition is that the target network segment address corresponding to the first static routing flow table entry is not a preset network segment address;
[0157] Determine whether there is a first static route flow entry in the database whose target network segment address is a preset network segment address;
[0158] If it exists, stop issuing the new static route flow table item creation task, and output prompt information including 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.
[0159] Specifically, in order to avoid the interference that the default static route (0.0.0.0 / 0) may cause to the port forwarding function of the NAT gateway, the network controller, when determining that a distributed network address translation gateway is configured, creates a judgment condition for prohibiting the creation of the first static route flow table entry, ensuring that the target network segment address corresponding to the created first static route flow table entry is not the preset network segment address, and prohibiting the creation of a static route with a target network segment address (target CIDR) of 0.0.0.0 / 0 after binding NAT.
[0160] At the same time, the corresponding information is added to the static route list of the network controller database. If a static route entry with a 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 prompt that the creation failed. The specific steps are as follows: The network controller determines whether there is a first static route flow table entry in the database whose target network segment address is the preset network segment address. If so, stop issuing new static route flow table creation tasks, and output a prompt message containing a failure to create a static route flow table entry, where the static route flow table creation task is used to create the first static route flow table entry.
[0161] The above process is as follows Figure 7 As shown, the distributed router creates a static route; it is determined whether the static route has created a static route with a destination CIDR of 0.0.0.0 / 0. If not, the creation is successful. If yes, it is determined whether the distributed router has been bound to a distributed NAT gateway. If not, the creation is successful. If yes, the creation is not allowed and a prompt message is output.
[0162] In this embodiment, when it is determined that a distributed network address translation gateway is configured, interference with the forwarding function of the distributed network address translation gateway is avoided by creating a judgment condition and stopping the creation of the first static routing flow table entry whose target network segment address is a preset network segment address.
[0163] In the present embodiment, a data forwarding device is also provided, and the device is used to implement the above-mentioned embodiment and preferred implementation mode, and the description that has been made is not repeated. As used below, the term "module" can implement the combination of software and / or hardware of the predetermined function. Although the device described in the following embodiments is preferably implemented with software, the implementation of hardware, or the combination of software and hardware is also possible and conceived.
[0164] This embodiment provides a data forwarding device, which is deployed in a distributed router, such as Figure 8 As shown, including:
[0165] A first acquisition module 801 is used to acquire a first target address of a data frame when receiving a data frame sent by a first host;
[0166] A first determination module 802 is used to match the first target address with the first static routing flow table entry, determine a successfully matched target static routing flow table entry, and parse the data frame to obtain a data packet;
[0167] A comparison module 803 is used to obtain a second destination address from the data packet, obtain a destination network segment address from a destination static routing flow table entry, and compare the second destination address with the destination network segment address;
[0168] The updating module 804 is used to obtain the third target address according to the target static routing flow table entry if the comparison is successful, 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 data frame to be forwarded;
[0169] The sending module 805 is used to send the data frame to be forwarded to the target device according to the third target address, and the target device sends the data packet to the second host, wherein the second host is determined according to the second target address in the data packet.
[0170] In some optional implementations, the updating module 804 obtains the third target address according to the target static routing flow entry, including:
[0171] When the first host sends data to the second host for the first time, obtain the next hop address from the target static route flow table entry;
[0172] Send out an address resolution protocol broadcast according to the next hop address to obtain a third target address;
[0173] When the first host does not send data to the second host for the first time, obtain the next hop address from the target static route flow table entry;
[0174] The third target address is obtained by querying the address resolution protocol table according to the next hop address.
[0175] In some optional embodiments, the device is used to:
[0176] Get the connected network segment address;
[0177] Determine whether the connected network segment address is within the preset network segment address range;
[0178] When the connected network segment address is not within the preset network segment address range, obtaining a second static routing flow table entry numbered with a preset number, and determining whether to connect to a distributed network address translation gateway;
[0179] If the distributed network address translation gateway is not connected, matching the connected network segment address with the target network segment address in the second static route flow table entry;
[0180] If the match succeeds, the second static route flow table entry is used as the target static route flow table entry corresponding to the connected network segment address;
[0181] If a distributed network address translation gateway is connected, the preset network segment address is used as the target network segment address corresponding to the connected network segment address, and the gateway address of the distributed network address translation gateway is used as the next hop address corresponding to the connected network segment address.
[0182] This embodiment provides a static routing flow table generation device, which is deployed in a network controller, such as Fig. 9 As shown, including:
[0183] The second acquisition module 901 is used to acquire the target network segment address, the next hop address and the source media access control address;
[0184] A second determination module 902 is used to determine a corresponding distributed router according to a target network segment address and a next hop address;
[0185] The generation module 903 is used to generate a first static routing flow table entry 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 of the above steps S101 to S105 or any corresponding implementation method thereof.
[0186] In some optional embodiments, the device is used to:
[0187] Determine whether the distributed router is configured with a distributed network address translation gateway;
[0188] If a 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 the source network address translation gateway;
[0189] Recording the gateway address in a first register of the distributed router and storing the media access control address in a second register of the distributed router;
[0190] According to the preset number, preset priority, preset network segment address, gateway address and media access control address, a third static routing flow table entry is generated in the distributed router, and the traffic exit port information corresponding to the third static routing flow table entry is pointed to the network logical port of the distributed network address translation gateway.
[0191] In some optional implementations, after generating the first static routing flow entry in the distributed router, the apparatus is further configured to:
[0192] Entering the first static route flow entry and the third static route flow entry into a database of the network controller;
[0193] A static routing table is created for the distributed router according to the first static routing flow entry, the third static routing flow entry and the associated information corresponding to the distributed router in the database.
[0194] In some optional implementations, after determining whether the distributed router is configured with a distributed network address translation gateway, the apparatus is further configured to:
[0195] In the case where it is determined that a distributed network address translation gateway is configured, creating a judgment condition for prohibiting the creation of a first static routing flow table entry, wherein the judgment condition is that the target network segment address corresponding to the first static routing flow table entry is not a preset network segment address;
[0196] Determine whether there is a first static route flow entry in the database whose target network segment address is a preset network segment address;
[0197] If it exists, stop issuing the new static route flow table item creation task, and output prompt information including 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.
[0198] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0199] The data forwarding device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0200] The embodiment of the present invention also provides a computer device having the above Figure 8 The data forwarding device shown and the above Fig. 9 The static routing flow table entry generation device shown.
[0201] See also Fig.10 , Fig.10 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Fig.10As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Fig.10 A processor 10 is taken as an example.
[0202] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0203] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.
[0204] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0205] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0206] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0207] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or 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 a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0208] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.
[0209] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A data forwarding method, characterized in that: The method is applied to a distributed router, and the method comprises: When receiving a data frame sent by a first host, obtaining a first target address of the data frame; Matching the first target address with the first static routing flow table entry, determining a successfully matched target static routing flow table entry, and parsing the data frame to obtain a data packet; Obtaining a second destination address from the data packet, obtaining a destination network segment address from the destination static routing flow table entry, and comparing the second destination address with the destination network segment address; If the comparison is successful, a third target address is obtained according to the target static routing flow table entry, 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; According to the third target address, the data frame to be forwarded is sent to a target device, and 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 according to claim 1, characterized in that The obtaining a third target address according to the target static routing flow entry includes: When 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 entry; Sending an address resolution protocol broadcast according to the next hop address to obtain the third target address; When the first host does not send data to the second host for the first time, obtaining a next hop address from the target static routing flow entry; The third target address is obtained by querying the address resolution protocol table according to the next hop address.
3. The method according to claim 1, characterized in that The method further comprises: Get the connected network segment address; Determine whether the connected network segment address is within a preset network segment address range; When the connected network segment address is not within the preset network segment address range, obtaining a second static routing flow table entry numbered with a preset number, and determining whether to connect to a distributed network address translation gateway; If the distributed network address translation gateway is not connected, matching the connected network segment address with the target network segment address in the second static routing flow table entry; If the match succeeds, use the second static route flow table entry as the target static route flow table entry corresponding to the connected network segment address; If the distributed network address translation gateway is connected, the preset network segment address is used as the target network segment address corresponding to the connected network segment address, and the gateway address of the distributed network address translation gateway is used as the next hop address corresponding to the connected network segment address.
4. A method for generating a static routing flow table entry, characterized in that: The method is applied to a network controller, and the method comprises: Obtain the target network segment address, next hop address, and source media access control address; Determine a corresponding distributed router according to the target network segment address and the next hop address; A first static routing flow table entry 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 according to any one of claims 1 to 3.
5. The method according to claim 4, characterized in that 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 the gateway address of the distributed network address translation gateway and the media access control address of the source network address translation gateway; Recording the gateway address in a first register of the distributed router and storing the media access control address in a second register of the distributed router; According to the preset number, preset priority, preset network segment address, the gateway address and the media access control address, a third static routing flow table entry is generated in the distributed router, and the traffic exit port information corresponding to the third static routing flow table entry is pointed to the network logical port of the distributed network address translation gateway.
6. The method according to claim 5, characterized in that After generating the first static routing flow entry in the distributed router, the method further includes: Entering the first static route flow entry and the third static route flow entry into a database of the network controller; A static routing table is created for the distributed router according to the first static routing flow entry, the third static routing flow entry and the associated information corresponding to the distributed router in the database.
7. The method according to claim 6, characterized in that After determining whether the distributed router is configured with a distributed network address translation gateway, the method further includes: 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 routing flow table entry, wherein the judgment condition is that the target network segment address corresponding to the first static routing flow table entry is not the preset network segment address; Determine whether there is a first static route flow entry in the database whose target network segment address is the preset network segment address; If it exists, stop issuing the new static route flow table item creation task, and output prompt information including the failure of static route flow table item creation, wherein the static route flow table item creation task is used to create the first static route flow table item.
8. A data forwarding device, characterized in that: The device is deployed in a distributed router, and the device includes: A first acquisition module, configured to acquire a first target address of a data frame when receiving a data frame sent by a first host; A first determination module is used to match the first target address with the first static routing flow table item, determine a successfully matched target static routing flow table item, and parse the data frame to obtain a data packet; A comparison module, used to obtain a second target address from the data packet, obtain a target network segment address from the target static routing flow table entry, and compare the second target address with the target network segment address; An updating module, configured to obtain a third target address according to the target static routing flow table entry if the comparison is successful, 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 data frame to be forwarded; A sending module is used to send the data frame to be forwarded to a target device according to the third target address, and 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.
9. A static routing flow table generation device, characterized in that: The device is deployed in a network controller, and the device includes: A second acquisition module, used to acquire a target network segment address, a next hop address, and a source media access control address; A second determination module is used to determine a corresponding distributed router according to the target network segment address and the next hop address; A generation module, used to generate a first static routing flow table entry 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 according to any one of claims 1 to 3.
10. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the data forwarding method described in any one of claims 1 to 3, or executes the static routing flow table entry generation method described in any one of claims 4 to 7 by executing the computer instructions.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the data forwarding method described in any one of claims 1 to 3, or to execute the static routing flow table entry generation method described 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
Method and device for high availability of floating internet protocol address
CN114448934A
Logic router
CN115174470A
Routing system, routing method and routing device of virtual network
CN115277550A
Cited By
Gateway determination method and device, computer equipment and storage medium
CN119276782A
Routing configuration updating method and device, electronic equipment and storage medium
CN119652811A
Mirror data acquisition and transmission method and system, medium and computer equipment
CN119696929A
Method and system for acquiring and transmitting mirror data, medium, and computer equipment
CN119696929B
