A method for load balancing using eBPF to connect to backend server vxlan

By using eBPF technology to modify the destination address of vxlan packets on load balancing devices, the vxlan connection between load balancing and back-end servers is realized, solving the problems of high resource occupation and unreasonable allocation in the existing technology, and achieving efficient resources Reasonable use.

CN117857255BActive Publication Date: 2025-02-11CHINA TELECOM CLOUD TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311693742.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-11
Publication Date
2025-02-11
Estimated Expiration
2043-12-11

AI Technical Summary

Technical Problem

The existing load balancing technology has high consumption and unreasonable problems in resource occupation and allocation, resulting in wasting resources or insufficient allocation that affects business processing.

Method used

The eBPF technology is used to process the packets sent by the load balancing device to the backend server. By modifying the outer destination IP address and the inner destination MAC address of the vxlan message, the load balancing and the backend server are realized.

Benefits of technology

Through eBPF technology, the vxlan connection between load balancing devices and back-end servers is realized, solving the problems of resource isolation and rational utilization between multiple tenants, and avoiding resource waste caused by virtual machines or containers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117857255B_ABST
    Figure CN117857255B_ABST
Patent Text Reader

Abstract

The invention discloses a method for realizing connection with back-end server vxlan by using eBPF for load balancing, which relates to the technical field of data network communication, and aims to solve the problem that load balancing has high resource consumption, needs to allocate CPU and memory in advance, cannot effectively and reasonably allocate and use resources, causes resource waste, or insufficient resource allocation affects business processing, and the key points of the technical solution are S1: when load balancing needs to support vxlan network, eBPF is used to process the message sent to the back-end server; S2: vxlan network connection is used between load balancing and back-end server; S3: bridge address forwarding table is configured to fix the outer destination address of vxlan encapsulated in the message sent in this VRF (1.2.3.4); S4: eBPF is used to modify the outer destination IP address of the vxlan message to the IP address of the host machine where the server is located; S5: editing the program, so that the program can be run to enable eBPF to realize connection with the back-end server vxlan. The effect of fully and reasonably utilizing system resources is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data network communication, and in particular to a method for load balancing using eBPF to realize connection with a back-end server vxlan. Background Art

[0002] Load balancing is built on the existing network structure. It provides a cheap, effective and transparent method to expand the bandwidth of network devices and servers, increase throughput, enhance network data processing capabilities, and improve network flexibility and availability.

[0003] Load balancing means distributing the workload to multiple operating units, such as Web servers, FTP servers, enterprise key application servers, and other mission-critical servers, so as to complete the work tasks together.

[0004] In order to support multi-tenancy and isolation between tenants, the common practice for load balancing is to create an independent virtual machine for each tenant to run the load balancing application or to run each tenant's load balancing application in an independent container.

[0005] The above-mentioned existing technical solutions have the following defects: load balancing resources are expensive and require CPU and memory to be allocated in advance, and resources cannot be allocated and used effectively and reasonably, resulting in resource waste, or insufficient resource allocation affects business processing. Summary of the invention

[0006] The purpose of the present invention is to provide a method for supporting encapsulation of different vxlan outer message destination IP addresses according to different back-end server IP addresses, using eBPF to modify the outer destination IP address according to the destination IP address of the vxlan inner message, and realizing connection with the back-end server vxlan using eBPF for load balancing.

[0007] To achieve the above object, the present invention provides the following technical solutions:

[0008] A method for load balancing to connect to a backend server vxlan using eBPF is as follows:

[0009] S1: When load balancing needs to support vxlan network, eBPF is used to process the messages sent to the backend server to ensure the connectivity of the vxlan network;

[0010] S2: The load balancer and the backend server are connected using a vxlan network, and each backend server has its corresponding host machine;

[0011] S3: Configure the bridge address forwarding table to fix the vxlan outer destination address (1.2.3.4) of the message encapsulated in this VRF. The outer destination IP address of the vxlan message should be the IP address of the host where the backend server is located.

[0012] S4: To ensure that the message sent from the load balancer to the backend server can arrive smoothly, use eBPF to modify the outer destination IP address of the vxlan message to the IP address of the host where the server is located, and modify the inner destination MAC address of the vxlan message to the server MAC address;

[0013] S5: Edit the program and run it to enable eBPF to connect to the backend server vxlan.

[0014] Furthermore, the S5 program is first built by loading ebpf through tc, and loading the program for modifying the outer destination IP address of vxlan into the kernel;

[0015] Use LLVM clang to compile pktmangle.bpf.c, which contains the message modification and eBPF Maps definitions, into pktmangle.o.

[0016] Use TC loader to load pktmangle.o into the kernel and attach it to the egress hook point;

[0017] The kernel uses the Verifier to verify pktmangle.o to ensure the security of the kernel during execution, and converts it into native instructions that can be executed by the kernel through the JIT compiler.

[0018] Furthermore, the S5 program is set up and then configures the routing destination IP 1.2.3.4 next hop to the gateway

[0019] ip route add 1.2.3.4 via gw_ip

[0020] Then configure VRF and vxlan interfaces, routing, neighbors, and bridge address forwarding tables

[0021] #Create VRF

[0022] ip link add vrf-xx up type vrf table 40xx

[0023] #Create a vxlan interface

[0024] ip link add vxlan-xx up addr vxlan_mac master vrf-xx type vxlan id xxremote 0.0.0.0 dstport 4789

[0025] #Configure the vxlan interface IP

[0026] ip addr add dev vxlan-xx vxlan_ip / vxlan_ip_mask_len

[0027] #Configure vrf default route

[0028] ip route add default via vxlan_gw_ip vrf vrf-xx dev vxlan-xx

[0029] #Set the MAC corresponding to the default gateway under VRF

[0030] ip neigh add vxlan_gw_ip lladdr EE:FF:FF:FF:FF:FF dev vxlan-xx

[0031] #Add FDB table

[0032] bridge fdb add EE:FF:FF:FF:FF:FF dev vxlan-xx dst 1.2.3.4

[0033] Note: xx is vni.

[0034] Furthermore, the S5 program builds and modifies the ebpf map table, adding the correspondence between the backend server IP address and the host IP address where it is located.

[0035] The user-state agent process writes data to eBPF Maps through bpf bcc when configuring the backend server.

[0036] key1: backend server IP address

[0037] key2:vni

[0038] value1: IP address of the host where the backend server is located

[0039] value2: backend server MAC address,

[0040] Complete the program construction and request the data.

[0041] Furthermore, the data request process is that the message is processed by the load balancing application and the destination IP address is modified, and then it reaches the kernel to prepare for processing and sending the message after load balancing processing.

[0042] client_ip:client_port-->rs_ip:rs_port

[0043] After searching for routes and neighbors in VRF

[0044] vxlan_ip:port1(vxlan_mac)-->rs_ip:rs_port(EE:FF:FF:FF:FF:FF)

[0045] After finding fdb, vxlan encapsulation

[0046] Inside: vxlan_ip:port1(vxlan_mac)-->rs_ip:rs_port(EE:FF:FF:FF:FF:FF)

[0047] Foreign: -->1.2.3.4:4789

[0048] Find out the interface (physical network default gateway)

[0049] Inside: vxlan_ip:port1(vxlan_mac)-->rs_ip:rs_port(EE:FF:FF:FF:FF:FF)

[0050] External: Load balancing device physical port ip:port2 (physical port mac) --> 1.2.3.4:4789 (physical gateway mac).

[0051] Furthermore, during the data request process, it is found that there is a hook for reception processing in the egress during the message sending phase, and the corresponding eBPF processing is called.

[0052] Furthermore, when the corresponding eBPF process is called, the value in the eBPF Maps is checked according to the key.

[0053] key1: backend server IP address rs_ip

[0054] key2:vni xx

[0055] value1: IP address of the host where the backend server is located rip

[0056] value2: backend server MAC address rs_mac.

[0057] Furthermore, the obtained value is used to modify the outer destination IP address and inner destination MAC address of the vxlan message.

[0058] Inside: vxlan_ip:port1(vxlan_mac)-->rs_ip:rs_port(rs_mac)

[0059] External: Load balancing device physical port ip:port2 (physical port mac) --> rip:4789.

[0060] Furthermore, after completing the above steps, the kernel process is returned to continue processing, and the message is sent to the backend server.

[0061] Furthermore, the outer destination IP address configured by the vxlan interface in S2 is fixed, and the inner message destination MAC address is the MAC address of the VRF default gateway.

[0062] In summary, the beneficial technical effects of the present invention are:

[0063] 1. The present invention realizes the vxlan connection between the load balancing device and the backend service through eBPF, so that multiple tenants are isolated through VRF+vxlan, fully and reasonably utilize system resources, and solves the resource waste and unreasonable allocation problems caused by the use of virtual machines or containers;

[0064] 2. The present invention configures the bridge address forwarding table to fix the vxlan outer destination address (1.2.3.4) of the message encapsulated in this VRF, and modifies the corresponding outer destination IP address according to the inner message destination IP address through eBPF to realize the vxlan connection solution of load balancing and back-end services. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] Figure 1 It is a schematic diagram of the system flow structure of the present invention. DETAILED DESCRIPTION

[0066] The method of the present invention is further described in detail below in conjunction with the accompanying drawings.

[0067] Embodiment 1

[0068] Reference Figure 1 , a method for load balancing using eBPF to connect to a backend server vxlan, characterized in that: the method is as follows:

[0069] S1: When load balancing needs to support vxlan network, eBPF is used to process the messages sent to the backend server to ensure the connectivity of the vxlan network;

[0070] S2: The load balancer and the backend server are connected using a vxlan network. Each backend server has its corresponding host. The outer destination IP address configured on the vxlan interface is fixed, and the inner destination MAC address of the message is the MAC address of the VRF default gateway.

[0071] S3: Configure the bridge address forwarding table to fix the vxlan outer destination address of the message encapsulated in this VRF (1.2.3.4). The outer destination IP address of the vxlan message should be the IP address of the host where the backend server is located;

[0072] S4: To ensure that the message sent from the load balancer to the backend server can arrive smoothly, use eBPF to modify the outer destination IP address of the vxlan message to the IP address of the host where the server is located, and modify the inner destination MAC address of the vxlan message to the server MAC address;

[0073] S5: Edit the program and run it to enable eBPF to connect to the backend server vxlan.

[0074] First, load ebpf through tc and load the program that modifies the outer destination IP address of vxlan into the kernel;

[0075] Use LLVM clang to compile pktmangle.bpf.c, which contains the message modification and eBPF Maps definitions, into pktmangle.o.

[0076] Use TC loader to load pktmangle.o into the kernel and hook it to the egress hook point;

[0077] The kernel uses the Verifier to verify pktmangle.o to ensure the security of the kernel during execution, and converts it into native instructions that can be executed by the kernel through the JIT compiler.

[0078] The S5 program is then configured to route the destination IP 1.2.3.4 to the next hop to the gateway

[0079] ip route add 1.2.3.4via gw_ip

[0080] Then configure VRF and vxlan interfaces, routing, neighbors, and bridge address forwarding tables

[0081] #Create VRF

[0082] ip link add vrf-xx up type vrf table 40xx

[0083] #Create a vxlan interface

[0084] ip link add vxlan-xx up addr vxlan_mac master vrf-xx type vxlan id xxremote 0.0.0.0 dstport 4789

[0085] #Configure the vxlan interface IP

[0086] ip addr add dev vxlan-xx vxlan_ip / vxlan_ip_mask_len

[0087] #Configure vrf default route

[0088] ip route add default via vxlan_gw_ip vrf vrf-xx dev vxlan-xx

[0089] #Set the MAC corresponding to the default gateway under VRF

[0090] ip neigh add vxlan_gw_ip lladdr EE:FF:FF:FF:FF:FF dev vxlan-xx

[0091] #Add FDB table

[0092] bridge fdb add EE:FF:FF:FF:FF:FF dev vxlan-xx dst 1.2.3.4

[0093] Note: xx is vni.

[0094] Modify the ebpf map table and add the correspondence between the backend server IP address and its host IP address

[0095] The user-state agent process writes data to eBPF Maps through bpf bcc when configuring the backend server.

[0096] key1: backend server IP address

[0097] key2:vni

[0098] value1: IP address of the host where the backend server is located

[0099] value2: backend server MAC address,

[0100] Complete the program construction and request the data.

[0101] After the message is processed by the load balancing application and the destination IP address is modified, it reaches the kernel and is ready to be processed and sent.

[0102] client_ip:client_port-->rs_ip:rs_port

[0103] After searching for routes and neighbors in VRF

[0104] vxlan_ip:port1(vxlan_mac)-->rs_ip:rs_port(EE:FF:FF:FF:FF:FF)

[0105] After finding fdb, vxlan encapsulation

[0106] Inside: vxlan_ip:port1(vxlan_mac)-->rs_ip:rs_port(EE:FF:FF:FF:FF:FF)

[0107] Foreign: -->1.2.3.4:4789

[0108] Find out the interface (physical network default gateway)

[0109] Inside: vxlan_ip:port1(vxlan_mac)-->rs_ip:rs_port(EE:FF:FF:FF:FF:FF)

[0110] External: Load balancing device physical port ip:port2 (physical port mac) --> 1.2.3.4:4789 (physical gateway mac).

[0111] During the data request process, it is found that there is a hook for reception processing in the egress during the message sending phase, and the corresponding eBPF processing is called.

[0112] When calling the corresponding eBPF process, check the value in the eBPF Maps according to the key

[0113] key1: backend server IP address rs_ip

[0114] key2:vni xx

[0115] value1: IP address of the host where the backend server is located rip

[0116] value2: backend server MAC address rs_mac.

[0117] Then use the obtained value to modify the outer destination IP address and inner destination MAC address of the vxlan message

[0118] Inside: vxlan_ip:port1(vxlan_mac)-->rs_ip:rs_port(rs_mac)

[0119] External: Load balancing device physical port ip:port2 (physical port mac) --> rip:4789.

[0120] After completing the above steps, return to the kernel process to continue processing, and send the message to the backend server.

[0121] Embodiment 2

[0122] eBPF can process network packets in the kernel safely and efficiently. Therefore, when load balancing needs to support vxlan networks, eBPF is used to process messages sent to backend servers to ensure the connectivity of the vxlan network.

[0123] The load balancer and the backend server are connected using a vxlan network. Each backend server has its corresponding host. The outer destination IP address configured for the vxlan interface is fixed, and the inner destination MAC address of the message is the MAC address of the VRF default gateway. The bridge address forwarding table is configured to fix the outer destination address of the vxlan encapsulated in the message sent from this VRF (1.2.3.4). The outer destination IP address of the vxlan message should be the IP address of the host where the backend server is located. To ensure that the message sent from the load balancer to the backend server can arrive smoothly, use eBPF to modify the outer destination IP address of the vxlan message to the IP address of the host where the server is located, and modify the inner destination MAC address of the vxlan message to the server MAC address.

[0124] tc loads ebpf and loads the program that modifies the outer destination IP address of vxlan into the kernel

[0125] Use LLVM clang to compile pktmangle.bpf.c, which contains the message modification and eBPF Maps definitions, into pktmangle.o

[0126] Use the TC loader to load pktmangle.o into the kernel and attach it to the egress hook point.

[0127] The kernel uses the Verifier to verify pktmangle.o to ensure the security of the kernel during execution; it is converted into local instructions executable by the kernel through the JIT (Just-In-Time) compiler.

[0128] Configure the route destination IP 1.2.3.4 as the next hop to the gateway

[0129] ip route add 1.2.3.4via gw_ip

[0130] Configure VRF and vxlan interfaces, routing, neighbors, and bridge address forwarding tables

[0131] #Create VRF

[0132] ip link add vrf-xx up type vrf table 40xx

[0133] #Create a vxlan interface (specify MAC, id, outer destination port 4789)

[0134] ip link add vxlan-xx up addr vxlan_mac master vrf-xx type vxlan id xxremote 0.0.0.0 dstport 4789

[0135] #Configure the vxlan interface IP

[0136] ip addr add dev vxlan-xx vxlan_ip / vxlan_ip_mask_len

[0137] #Configure vrf default route

[0138] ip route add default via vxlan_gw_ip vrf vrf-xx dev vxlan-xx

[0139] #Set the MAC corresponding to the default gateway under VRF (to prevent ARP)

[0140] ip neigh add vxlan_gw_ip lladdr EE:FF:FF:FF:FF:FF dev vxlan-xx

[0141] #Add FDB table (specify the outer destination IP address as 1.2.3.4)

[0142] bridge fdb add EE:FF:FF:FF:FF:FF dev vxlan-xx dst 1.2.3.4

[0143] Note: xx is vni

[0144] Modify the ebpf map table and add the correspondence between the backend server IP address and its host IP address

[0145] The user-state agent process writes data to eBPF Maps through bpf bcc when configuring the backend server.

[0146] key1: backend server IP address (vxlan message inner destination IP address)

[0147] key2:vni (vni corresponding to vxlan)

[0148] value1: IP address of the host where the backend server is located (the outer destination IP address of the vxlan message)

[0149] value2: backend server MAC address (vxlan message inner destination MAC address)

[0150] Data request process:

[0151] After the message is processed by the load balancing application and the destination IP address is modified (the destination IP address is modified to the backend server address), it reaches the kernel and is ready to be processed and sent.

[0152] Packet after load balancing processing

[0153] client_ip:client_port-->rs_ip:rs_port

[0154] After searching for routes and neighbors in VRF

[0155] vxlan_ip:port1(vxlan_mac)-->rs_ip:rs_port(EE:FF:FF:FF:FF:FF)

[0156] After finding fdb, vxlan encapsulation

[0157] Inside: vxlan_ip:port1(vxlan_mac)-->rs_ip:rs_port(EE:FF:FF:FF:FF:FF)

[0158] Foreign: -->1.2.3.4:4789

[0159] Find out the interface (physical network default gateway)

[0160] Inside: vxlan_ip:port1(vxlan_mac)-->rs_ip:rs_port(EE:FF:FF:FF:FF:FF)

[0161] External: Load balancing device physical port ip:port2 (physical port mac) --> 1.2.3.4:4789 (physical gateway mac)

[0162] It is found that there is a hook in the egress during the message sending phase, and the corresponding eBPF processing is called.

[0163] Check the value in eBPF Maps according to the key (the inner destination IP address and vni of the vxlan message)

[0164] key1: backend server IP address rs_ip

[0165] key2:vni xx

[0166] value1: IP address of the host where the backend server is located rip

[0167] value2: backend server MAC address rs_mac

[0168] Use the obtained value to modify the outer destination IP address and inner destination MAC address of the vxlan message

[0169] Inside: vxlan_ip:port1(vxlan_mac)-->rs_ip:rs_port(rs_mac)

[0170] External: Load balancing device physical port ip:port2 (physical port mac) --> rip:4789 (physical gateway mac)

[0171] Return to the kernel process to continue processing

[0172] The message is sent to the backend server.

[0173] Through eBPF, vxlan connection between load balancing equipment and backend services is realized, so that multiple tenants are isolated through VRF+vxlan, and system resources are fully and reasonably utilized. It solves the problem of resource waste and unreasonable allocation caused by the use of virtual machines or containers.

[0174] Embodiment 3

[0175] tc load ebpf

[0176] tc qdisc add dev interface clsact

[0177] tc filter add dev interface egress bpf direct-action object-filepktmangle.o section changemac verbose

[0178] Configure the route destination IP 1.2.3.4 as the next hop to the gateway

[0179] ip route add 1.2.3.4 via gw_ip

[0180] Configure VRF and vxlan interfaces, routing, neighbors, and bridge address forwarding tables

[0181] ip link add vrf-xx up type vrf table 40xx

[0182] ip link add vxlan-xx up addr vxlan_mac master vrf-xx type vxlan id xxremote 0.0.0.0 dstport 4789

[0183] ip addr add dev vxlan-xx vxlan_ip / vxlan_ip_mask_len

[0184] ip route add default via vxlan_gw_ip vrf vrf-xx dev vxlan-xx

[0185] ip neigh add vxlan_gw_ip lladdr EE:FF:FF:FF:FF:FF dev vxlan-xx

[0186] bridge fdb add EE:FF:FF:FF:FF:FF dev vxlan-xx dst 1.2.3.4

[0187] Note: xx is vni

[0188] Modify the ebpf map table and add the correspondence between the backend server IP address and its host IP address

[0189] The user-state agent process writes data to eBPF Maps through bpf bcc when configuring the backend server.

[0190] key1: backend server IP address (vxlan message inner destination IP address)

[0191] key2:vni (vni corresponding to vxlan)

[0192] value1: IP address of the host where the backend server is located (the outer destination IP address of the vxlan message)

[0193] value2: backend server MAC address (vxlan message inner destination MAC address)

[0194] Sending requests to backend servers on the load balancing device

[0195] ip vrf exec vrf-xx curl--interface vxlan-xx rs_ip:rs_port

[0196] ip vrf exec vrf-xx ping-I vxlan-xx rs_ip.

[0197] It is important to note that the construction and arrangement of the present application shown in a number of different exemplary embodiments are only exemplary. Although only a few embodiments are described in detail in this disclosure, it should be readily understood by those who refer to this disclosure that many modifications are possible (e.g., the size, scale, structure, shape and proportion of various elements, and parameter values ​​(e.g., temperature, pressure, etc.), mounting arrangements, use of materials, color, changes in orientation, etc.) without substantially departing from the novel teachings and advantages of the subject matter described in this application. For example, an element shown as integrally formed may be composed of multiple parts or elements, the position of an element may be inverted or otherwise changed, and the nature or number or position of discrete elements may be changed or altered. Therefore, all such modifications are intended to be included within the scope of the present invention. The order or sequence of any process or method steps may be changed or reordered according to an alternative embodiment. In the claims, any "means plus function" clause is intended to cover the structure that performs the function described herein, and is not only structurally equivalent but also equivalent in structure. Other substitutions, modifications, changes and omissions may be made in the design, operating conditions and arrangement of the exemplary embodiments without departing from the scope of the present invention. Therefore, the invention is not limited to a specific embodiment, but extends to numerous modifications still falling within the scope of the appended claims.

[0198] Additionally, in order to provide a concise description of exemplary embodiments, all features of an actual embodiment (ie, those features that are not relevant to the best mode presently contemplated for carrying out the invention or those that are not relevant to implementing the invention) may not be described.

[0199] It will be appreciated that in the development of any actual implementation, as in any engineering or design project, numerous implementation-specific decisions may be made. Such a development effort may be complex and time-consuming, but will be a routine task of design, fabrication, and production for those of ordinary skill having the benefit of this disclosure without undue experimentation.

[0200] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.

Claims

1. A load balancing method using eBPF to connect to a backend server vxlan is characterized by: The method is as follows: S1: When load balancing needs to support vxlan network, eBPF is used to process the messages sent to the backend server to ensure the connectivity of the vxlan network; S2: The load balancer and the backend server are connected using a vxlan network, and each backend server has its corresponding host machine; S3: Configure the bridge address forwarding table to fix the outer destination address of the vxlan encapsulated in the message sent from this VRF (1.2.3.4). The outer destination IP address of the vxlan message should be the IP address of the host where the backend server is located; S4: To ensure that the message sent from the load balancing to the backend server can arrive smoothly, use eBPF to modify the outer destination IP address of the vxlan message to the IP address of the host where the server is located, and modify the inner destination MAC address of the vxlan message to the server MAC address; S5: Edit the program and run it to enable eBPF to connect to the backend server vxlan; The program is set up and then the routing destination IP 1.2.3.4 is configured as the next hop to the gateway ip route add 1.2.3.4 via gw_ip Then configure VRF and vxlan interfaces, routing, neighbors, and bridge address forwarding tables # Create VRF ip link add vrf-xx up type vrf table 40xx # Create a vxlan interface ip link add vxlan-xx up addr vxlan_mac master vrf-xx type vxlan id xxremote 0.0.0.0 dstport 4789 # Configure the vxlan interface IP ip addr add dev vxlan-xx vxlan_ip / vxlan_ip_mask_len #Configure vrf default route ip route add default via vxlan_gw_ip vrf vrf-xx dev vxlan-xx # Set the MAC corresponding to the default gateway under VRF ip neigh add vxlan_gw_ip lladdr EE:FF:FF:FF:FF:FF dev vxlan-xx # Add FDB table bridge fdb add EE:FF:FF:FF:FF:FF dev vxlan-xx dst 1.2.3.4 Note: xx is vni; Program construction modifies the ebpf map table and adds the correspondence between the backend server IP address and its host IP address The user-state agent process writes data to eBPF Maps through bpf bcc when configuring the backend server. key1: backend server IP address key2: vni value1: IP address of the host where the backend server is located value2: backend server MAC address, Complete the program construction and request the data; The data request process is as follows: after the message is processed by the load balancing application and the destination IP address is modified, it reaches the kernel and is ready to process and send the message after load balancing processing. client_ip:client_port --> rs_ip:rs_port After searching for routes and neighbors in VRF vxlan_ip:port1 (vxlan_mac) --> rs_ip:rs_port (EE:FF:FF:FF:FF:FF) After finding fdb, vxlan encapsulation Inside: vxlan_ip:port1 (vxlan_mac) --> rs_ip:rs_port (EE:FF:FF:FF:FF:FF) Foreign: --> 1.2.3.4:4789 Find out the interface (physical network default gateway) Inside: vxlan_ip:port1 (vxlan_mac) --> rs_ip:rs_port (EE:FF:FF:FF:FF:FF) External: Load balancing device physical port ip:port2 (physical port mac) --> 1.2.3.4:4789 (physical gateway mac).

2. According to claim 1, a load balancing method using eBPF to achieve connection with the backend server vxlan is characterized in that: The S5 program is first built by loading ebpf through tc, and loading the program for modifying the outer destination IP address of vxlan into the kernel; Use LLVM clang to compile pktmangle.bpf.c, which contains the message modification and eBPF Maps definitions, into pktmangle.o. Use TC loader to load pktmangle.o into the kernel and hook it to the egress hook point; The kernel uses the Verifier to verify pktmangle.o to ensure the security of the kernel during execution, and converts it into native instructions that can be executed by the kernel through the JIT compiler.

3. According to claim 2, a load balancing method using eBPF to achieve connection with the backend server vxlan is characterized in that: During the data request process, it is found that there is a hook for reception processing in the egress during the message sending phase, and the corresponding eBPF processing is called.

4. According to claim 3, a load balancing method using eBPF to achieve connection with the backend server vxlan is characterized in that: When calling the corresponding eBPF process, check the value in the eBPF Maps according to the key key1: backend server IP address rs_ip key2: vni xx value1: IP address of the host where the backend server is located value2: backend server MAC address rs_mac.

5. According to claim 4, a load balancing method using eBPF to achieve connection with the backend server vxlan is characterized in that: Then use the obtained value to modify the outer destination IP address and inner destination MAC address of the vxlan message Inside: vxlan_ip:port1 (vxlan_mac) --> rs_ip:rs_port (rs_mac) External: Load balancing device physical port ip:port2 (physical port mac) --> rip:4789.

6. According to claim 5, a load balancing method using eBPF to achieve connection with the backend server vxlan is characterized in that: After completing the above steps, return to the kernel process to continue processing, and send the message to the backend server.

7. A load balancing method according to claim 6, wherein the eBPF is used to realize the connection with the back-end server vxlan, characterized in that: The outer destination IP address configured for the vxlan interface in S2 is fixed, and the inner message destination MAC address is the MAC address of the VRF default gateway.

Citation Information

Patent Citations

  • Load balancing method based on VXLAN (Virtual Extensible Local Area Network) and land balancer

    CN108616456A