Data packet transmission method, electronic device, medium and program product

After receiving the client request packet, the load balancer adds the real server IP address of the backend server and processes and forwards the packets with the assistance of the virtual machine manager, the data loss and inefficiency in packet transmission are solved. The problem is to realize the transparent delivery of client IP and packet path symmetry, improving data transmission efficiency and reliability.

CN119449805AActive Publication Date: 2025-02-14CHINA UNITED NETWORK COMM GRP CO LTD +2
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411603783.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-11
Publication Date
2025-02-14
Estimated Expiration
2044-11-11

AI Technical Summary

Technical Problem

The existing technology has problems such as data loss and low data transmission efficiency during data packet transmission. It is mainly due to the intervention of the load balancer, and the source IP and destination IP changes. The client IP address cannot be directly obtained by the backend server, and the data is The packet transmission path is asymmetric.

Method used

Receive the request packet sent by the client through the load balancer, add the IP address of the real server in the backend server to the request packet, and send the request packet to the backend server. The virtual machine manager in the backend server sends the requested data packet to the real server and saves the connection tracking information of the requested data packet. The real server processes the requested packet and sends a response packet to the virtual machine manager. According to the connection tracking information, the virtual machine manager changes the destination MAC address in the response packet to the MAC address of the load balancer, and sends the response packet to the load balancer. Finally, the load balancer sends the response packet to the client.

Benefits of technology

It realizes transparent transmission of client IP, ensures the path symmetry of data packets during round trip process, improves the efficiency and reliability of data transmission, and ensures smooth and consistent communications of the entire network.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119449805A_ABST
    Figure CN119449805A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of computers, and particularly relates to a data packet transmission method, electronic equipment, a medium and a program product. A request data packet sent by a client is received through a load balancer, an IP address of a real server in a back-end server is added into the request data packet, the request data packet is sent to the back-end server, a virtual machine manager in the back-end server sends the request data packet to the real server, connection tracking information of the request data packet is stored, and the connection tracking information of the real server is stored. The real server processes the request data packet and sends a response data packet to the virtual machine manager, the virtual machine manager modifies a destination MAC address in the response data packet into an MAC address of a load balancer according to the connection tracking information and sends the response data packet to the load balancer, and the load balancer sends the response data packet to the client; according to the method, the transparent transmission of the client IP is realized, the path symmetry of the data packet in the round-trip process is ensured, and the efficiency and reliability of data transmission are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a data packet transmission method, electronic equipment, medium and program product. Background Art

[0002] With the continuous advancement of Internet technology, the amount of network data transmission has shown explosive growth. From personal social media communication to enterprise-level business applications, from communication between IoT devices to data interaction on cloud computing platforms, data packet transmission has become an indispensable part of the operation of modern society. This trend has promoted the continuous innovation and optimization of data packet transmission technology to meet the growing demand for data transmission.

[0003] In the prior art, data packet transmission is mainly achieved by setting a virtual server IP, virtualizing the application resources of multiple real servers at the back end into a high-performance application server, and using a load balancer to distribute the client's application request to the back end server for processing, and generate a response data packet and send it back to the client.

[0004] However, when a data packet passes through a load balancer, its source IP and destination IP may change, resulting in the client IP address being unable to be directly obtained by the backend server; at the same time, due to the intervention of the load balancer, the transmission path of the data packet is no longer symmetrical, and the request data packet sent by the client and the response data packet returned by the real server may pass through different paths. Therefore, the existing technology has problems of data loss and low data transmission efficiency during the data packet transmission process. Summary of the invention

[0005] The embodiments of the present application provide a data packet transmission method, an electronic device, a medium and a program product to solve the problems of data loss and low data transmission efficiency during data packet transmission.

[0006] In a first aspect, an embodiment of the present application provides a data packet transmission method, including:

[0007] The load balancer receives a request data packet sent by the client, adds the IP address of the real server in the backend server to the request data packet, and sends the request data packet to the backend server;

[0008] The virtual machine manager in the back-end server sends the request data packet to the real server and saves the connection tracking information of the request data packet;

[0009] The real server processes the request data packet and sends a response data packet to the virtual machine manager;

[0010] The virtual machine manager modifies the destination MAC address in the response data packet to the MAC address of the load balancer according to the connection tracking information, and sends the response data packet to the load balancer;

[0011] The load balancer sends the response data packet to the client.

[0012] Optionally, adding the IP address of the real server in the backend server to the request data packet includes:

[0013] The IP address of the real server is added in the optional information of the request data packet.

[0014] Optionally, before the virtual machine manager in the back-end server sends the request data packet to the real server, the method further includes:

[0015] The virtual machine manager modifies the destination IP address in the request data packet to the IP address of the real server, and deletes the IP address of the real server in the optional information.

[0016] Optionally, before sending the response data packet to the load balancer, the method further includes:

[0017] The source IP address in the response data packet is modified to the IP address of the load balancer.

[0018] Optionally, adding the IP address of the real server in the backend server to the request data packet includes:

[0019] The destination IP address in the request data packet is modified to the IP address of the real server, and the IP address of the real server is added to the optional information of the request data packet.

[0020] Optionally, before the virtual machine manager in the back-end server sends the request data packet to the real server, the method further includes:

[0021] The virtual machine manager deletes the IP address of the real server in the optional information.

[0022] Optionally, before the load balancer sends the response data packet to the client, the method further includes:

[0023] The load balancer modifies the source IP address in the response data packet to the IP address of the load balancer.

[0024] In a second aspect, an embodiment of the present application provides a data packet transmission device, including:

[0025] A receiving module, used for the load balancer to receive a request data packet sent by a client;

[0026] A processing module, used for adding the IP address of the real server in the backend server to the request data packet;

[0027] A sending module, used for sending the request data packet to the back-end server;

[0028] The sending module is also used for the virtual machine manager in the back-end server to send the request data packet to the real server;

[0029] The processing module is further used to store the connection tracking information of the request data packet;

[0030] The processing module is also used for the real server to process the request data packet;

[0031] The sending module is further used to send a response data packet to the virtual machine manager;

[0032] The processing module is further used for the virtual machine manager to modify the destination MAC address in the response data packet to the MAC address of the load balancer according to the connection tracking information;

[0033] The sending module is further used to send the response data packet to the load balancer;

[0034] The sending module is also used for the load balancer to send the response data packet to the client.

[0035] Optionally, the processing module is further used to add the IP address of the real server to the optional information of the request data packet.

[0036] Optionally, the processing module is also used for the virtual machine manager to modify the destination IP address in the request data packet to the IP address of the real server, and delete the IP address of the real server in the optional information.

[0037] Optionally, the processing module is further used to modify the source IP address in the response data packet to the IP address of the load balancer.

[0038] Optionally, the processing module is further used to modify the destination IP address in the request data packet to the IP address of the real server, and add the IP address of the real server to the optional information of the request data packet.

[0039] Optionally, the processing module is also used for the virtual machine manager to delete the IP address of the real server in the optional information.

[0040] Optionally, the processing module is also used for the load balancer to modify the source IP address in the response data packet to the IP address of the load balancer.

[0041] In a third aspect, an embodiment of the present application provides a data packet transmission device, including: a memory, a processor;

[0042] The memory stores computer-executable instructions;

[0043] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the above first aspect and / or various possible implementations of the first aspect.

[0044] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the first aspect above and / or various possible implementations of the first aspect.

[0045] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the above first aspect and / or various possible implementation methods of the first aspect.

[0046] The data packet transmission method provided in the embodiment of the present application receives a request data packet sent by a client through a load balancer, adds the IP address of a real server in a back-end server to the request data packet, and sends the request data packet to the back-end server. The virtual machine manager in the back-end server sends the request data packet to the real server and saves the connection tracking information of the request data packet. The real server processes the request data packet and sends a response data packet to the virtual machine manager. The virtual machine manager modifies the destination MAC address in the response data packet to the MAC address of the load balancer according to the connection tracking information, and sends the response data packet to the load balancer. The load balancer sends the response data packet to the client. The method realizes transparent transmission of the client IP, and also ensures the path symmetry of the data packet in the round-trip process, improves the efficiency and reliability of data transmission, and ensures the smoothness and consistency of the entire network communication. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0048] Figure 1A flowchart of the data packet transmission method provided by this application;

[0049] Figure 2 Interaction of the data packet transmission method provided in this application Figure 1 ;

[0050] Figure 3 Interaction of the data packet transmission method provided in this application Figure 2 ;

[0051] Figure 4 A schematic diagram of the structure of the data packet transmission device provided by the present application;

[0052] Figure 5 A schematic diagram of the structure of the data packet transmission device provided in this application.

[0053] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0054] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0055] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0056] With the rapid advancement of Internet technology, the amount of network data transmission is increasing at an alarming rate. Whether it is personal interaction on social media, business operations at the enterprise level, or even communication between IoT devices and data exchange on cloud computing platforms, the efficient transmission of data packets has become a key part of the operation of modern society. This development trend has prompted the continuous innovation and optimization of data packet transmission technology to cope with the growing demand for data transmission.

[0057] In the existing technology, data packet transmission mainly depends on the setting of virtual server IP, which can integrate the application resources of multiple back-end real servers into a high-performance application server. This process is achieved with the assistance of a load balancer, which is responsible for intelligently allocating client application requests to back-end servers for processing and generating response data packets to be transmitted back to the client.

[0058] However, when a data packet passes through the load balancer, its source IP and destination IP information may change, which directly causes the real server to be unable to directly obtain the client IP address. In addition, due to the intervention of the load balancer, the transmission path of the data packet becomes asymmetric. In other words, the request data packet sent by the client and the response data packet returned by the real server may travel along different paths. Therefore, the prior art has the problems of data loss and low data transmission efficiency during data packet transmission.

[0059] In response to the above problems, the data packet transmission method provided by the present application is responsible for receiving the request data packet from the client through the load balancer. After receiving the data packet, it will embed the IP address of a real server in the back-end server cluster, and then forward the data packet to the back-end server. After the virtual machine manager of the back-end server receives the data packet, it will further send it to the designated real server for processing, and at the same time record the connection tracking information of this time. After the real server processes the request, it will generate a response data packet and send it back to the virtual machine manager. The virtual machine manager uses the previously saved connection tracking information to modify the destination MAC address in the response data packet to the MAC address of the load balancer to ensure that the data packet can be accurately returned to the load balancer. Finally, the load balancer forwards this response data packet to the client that originally initiated the request. This method realizes the transparent transmission of the client IP, and also ensures the path symmetry of the data packet in the round-trip process, improves the efficiency and reliability of data transmission, and ensures the smoothness and consistency of the entire network communication.

[0060] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0061] Figure 1 The flowchart of the data packet transmission method provided in this application. The execution subject of this embodiment is, for example, a server, which includes a load balancer and a backend server, and the backend server includes a virtual machine manager and multiple real servers managed by the virtual machine manager. Figure 1 As shown, the data packet transmission method shown in this embodiment includes:

[0062] S101: The load balancer receives a request data packet sent by a client, adds the IP address of a real server in a backend server to the request data packet, and sends the request data packet to the backend server.

[0063] Among them, the load balancer is a network device or software service. Its main function is to intelligently distribute the request data packets sent by the client to one of the multiple backend servers for processing in a high-concurrency or large data traffic environment. This process usually involves receiving the request data packet from the client, and then adding the IP address of a real server in the backend server cluster to the request data packet based on a specific load balancing algorithm (such as polling, least number of connections, hashing, etc.). After completing this modification, the load balancer forwards the processed request data packet to the selected backend server for further processing and response. For example, the load balancer is LVS load balancing.

[0064] The source IP address of the request data packet sent by the client received by the load balancer is the client's IP address, the destination IP address is the virtual IP address of the load balancer, the source MAC address is the client's MAC address, and the destination MAC address is the MAC address of the load balancer.

[0065] Adding the IP address of the real server in the backend server in the request data packet means changing the source MAC address in the request data packet to the MAC address of the load balancer and the destination MAC address to the MAC address of the real server.

[0066] As you can understand, to achieve the function of the load balancer receiving the request data packet sent by the client, adding the real IP address of the backend server in it and forwarding it to the backend server. First, you need to set the basic parameters of the load balancer, including the selection of the load balancing algorithm, the configuration of the backend server cluster, etc. Ensure that the load balancer can correctly identify and manage the backend server. When the client sends a request data packet, the load balancer needs to detect and receive these data packets. This is usually achieved by configuring the network interface and detection port of the load balancer. According to the configured load balancing algorithm, the load balancer needs to select a suitable server from the backend server cluster to handle the current request. The selection process may involve an evaluation of indicators such as the current load and response time of the server. After selecting the backend server, the load balancer needs to add the real IP address of the server in the request data packet. This is usually achieved by modifying the destination IP address field in the data packet header. Finally, the load balancer forwards the modified request data packet to the selected backend server.

[0067] In high-traffic access scenarios, a single server may not be able to handle all requests, resulting in longer response times or even service crashes. Therefore, by distributing request packets to multiple backend servers, the load balancer implements parallel processing of requests, significantly improving the system's throughput and response time. In addition, when a server in the backend server cluster fails, the load balancer can automatically transfer requests to other normally operating servers, achieving high availability of the service. In addition, by adding the real IP address of the backend server in the request packet, the load balancer also implements transparent forwarding of requests, ensuring that the backend server can correctly parse and process the request.

[0068] For example, adding the real server IP address in the request data packet may include: adding the real server IP address in the backend server in the TCP option and the UDP option of the request data packet.

[0069] S102: The virtual machine manager in the backend server sends the request data packet to the real server and saves the connection tracking information of the request data packet.

[0070] The virtual machine manager is responsible for receiving the request data packets from the load balancer and routing them to the specific real server. At the same time, the virtual machine manager also saves the connection tracking information of the request data packets to ensure that the data packets can correctly travel between the client and the real server during the entire session.

[0071] Connection tracking information refers to the information about each network connection recorded and maintained by the virtual machine manager during network communication. Connection tracking information includes: the MAC address of the load balancer, the IP address of the real server, the IP address of the client, and the IP address of the load balancer.

[0072] As you can understand, the virtual machine manager configures the network virtualization function to create a virtual network switch and virtual network interfaces, which are connected to the real network interfaces of the backend server. When the load balancer sends the request packet to the virtual machine manager, the virtual network switch routes it to the correct real server based on the destination address and port number of the packet. The virtual machine manager records the connection tracking information of the request packet. When the real server processes the request and generates a response packet, the virtual network switch routes it back to the client based on the connection tracking information, thus completing the entire session process.

[0073] By managing the distribution of request packets through the virtual machine manager, real servers can be easily added or removed to adapt to changing workload requirements. Saving the connection tracking information of the request packets helps maintain the integrity and stability of the session, ensuring that the client's request is not interrupted even when migration or failover occurs between real servers. The virtual machine manager can also provide additional security isolation and performance optimization features, such as firewall rules, resource quota limits, and network communication optimization between virtual machines.

[0074] S103: The real server processes the request data packet and sends a response data packet to the virtual machine manager.

[0075] Among them, the source IP address in the response data packet is the IP address of the real server, the destination IP address is the IP address of the client, the source MAC address is the MAC address of the real server, and the destination MAC address is the gateway MAC address of the backend server.

[0076] After receiving the request data packet, the real server will process it accordingly based on its content. This may involve data query, computing task execution, resource allocation, etc. During the processing, the real server may interact with the virtual machine manager to obtain necessary resources or information. Finally, after the processing is completed, the real server will generate a response data packet and send it back to the virtual machine manager.

[0077] The virtual machine manager itself does not have the ability to directly process complex computing tasks or access physical resources, so it needs to rely on real servers to complete these tasks. Real servers have stronger computing power and more abundant resources, and can efficiently process requests from the virtual machine manager and return the processing results to the requester through the virtual machine manager. This mechanism not only improves resource utilization, but also enhances the flexibility and scalability of the system.

[0078] S104: The virtual machine manager modifies the destination MAC address in the response data packet to the MAC address of the load balancer according to the connection tracking information, and sends the response data packet to the load balancer.

[0079] The connection tracking information maintained by the virtual machine manager records all requests forwarded by the load balancer and their corresponding backend servers, client IP addresses, port numbers, and other information. When the backend server sends a response packet, the virtual machine manager checks whether the packet matches an entry in its connection tracking table. Once a match is found, the virtual machine manager reads the MAC address of the load balancer recorded in the entry and writes it to the destination MAC address field of the response packet. The modified response packet is sent to the load balancer, which then correctly forwards the packet to the client based on its own routing table and session status information. In this process, the virtual machine manager needs to ensure the accuracy and real-time nature of the connection tracking information, as well as the security and reliability of network communications.

[0080] In a load balancing environment, the backend server usually does not directly know the real IP address or MAC address of the client. The backend server communicates with the client through the load balancer, which is responsible for distributing the client's request to the appropriate backend server and collecting the responses from the backend server and then forwarding them back to the client. Therefore, when the backend server generates a response packet, their destination address may initially point to the virtual machine manager or directly back to the virtual machine that initiated the request, but this does not conform to the actual situation of network communication. In order to ensure that the packet can be correctly returned to the client, the virtual machine manager needs to modify the destination MAC address of the response packet based on the connection tracking information to point to the load balancer, thereby ensuring the smoothness and accuracy of network communication.

[0081] S105: The load balancer sends a response data packet to the client.

[0082] The source MAC address of the response data packet is changed to the MAC address of the load balancer, and the destination MAC address is changed to the MAC address of the client.

[0083] The load balancer determines which client the response packet should be sent to based on the connection tracking information. The load balancer modifies the destination address of the response packet to the client's IP address and sends it out.

[0084] When the backend server processes the request and generates a response, these responses must first be sent to the load balancer, which then forwards them to the client based on the previous session information. This process ensures the transparency and reliability of network communication, while making the management and maintenance of the backend server more flexible and efficient.

[0085] The data packet transmission method provided in this embodiment receives a request data packet sent by a client through a load balancer, adds the IP address of a real server in a back-end server to the request data packet, and sends the request data packet to the back-end server. The virtual machine manager in the back-end server sends the request data packet to the real server and saves the connection tracking information of the request data packet. The real server processes the request data packet and sends a response data packet to the virtual machine manager. The virtual machine manager modifies the destination MAC address in the response data packet to the MAC address of the load balancer according to the connection tracking information, and sends the response data packet to the load balancer. The load balancer sends the response data packet to the client. The method realizes the transparent transmission of the client IP, and also ensures the path symmetry of the data packet in the round-trip process, improves the efficiency and reliability of data transmission, and ensures the smoothness and consistency of the entire network communication.

[0086] Figure 2 Interaction of the data packet transmission method provided in this application Figure 1 .like Figure 2 As shown, in this embodiment Figure 1 Based on the embodiment, the data packet transmission method is described in detail. The data packet transmission method shown in this embodiment includes:

[0087] S201: The load balancer receives a request data packet sent by a client.

[0088] S202: The load balancer adds the IP address of the real server to the optional information of the request data packet.

[0089] S203: The load balancer sends the request data packet to the virtual machine manager of the backend server.

[0090] The load balancer is in DR mode of LVS load balancing.

[0091] In the process of implementing the load balancer to receive client requests and forward them to the backend server, you first need to configure the forwarding rules and policies of the load balancer. This includes defining the IP address pool of the backend server, setting the load balancing algorithm (such as polling, minimum number of connections, etc.), configuring the session persistence mechanism, etc. Then, when the load balancer receives the request packet from the client, the load balancer will select a suitable server from the IP address pool according to the configured policies and rules, and add the IP address of the server in the optional information of the request packet. Finally, the load balancer sends the processed request packet to the virtual machine manager of the backend server, and the virtual machine manager assigns the request to the corresponding virtual machine instance for processing according to the specific business logic and resource configuration. In this process, the load balancer also needs to monitor the status and performance of the backend server in real time, so as to adjust the distribution strategy in time to ensure the stable operation of the system.

[0092] The reason why the load balancer adds the IP address of the real server in the optional information of the request data packet is that in a distributed system, the client usually only knows the IP address of the load balancer, but not the specific address of the backend server. By adding the IP address of the real server, the load balancer can ensure that the data packet will not be incorrectly routed or discarded during the forwarding process. In addition, the load balancer can also dynamically adjust the distribution strategy of the request data packet according to factors such as the load situation and processing capacity of the backend server, thereby achieving optimal resource configuration and high availability of the system.

[0093] S204: The virtual machine manager modifies the destination IP address in the request data packet to the IP address of the real server, and deletes the IP address of the real server in the optional information.

[0094] S205: The virtual machine manager saves the connection tracking information of the request data packet.

[0095] S206: The virtual machine manager sends the request data packet to the real server.

[0096] After the virtual machine manager receives the request data packet, it writes or calls the corresponding network programming interface or library function to modify the destination IP address of the data packet and delete the optional information. In the process of processing the request data packet, the virtual machine manager needs to save the connection tracking information of the data packet. This can be achieved by maintaining a connection tracking table or database in memory, which records the unique identifier, source IP address, destination IP address, port number and other information of each connection. Finally, the virtual machine manager sends the processed request data packet to the corresponding real server through the network for processing.

[0097] Removing the real server IP address from the optional information in the data packet can reduce redundant information in network communications and also help improve the security of communications. Saving the connection tracking information of the request data packet helps the virtual machine manager accurately identify and track the connection in subsequent communications, thereby achieving session management and connection state maintenance. This is essential to maintaining the stability and reliability of network communications.

[0098] S207: The real server processes the request data packet.

[0099] S208: The real server sends a response data packet to the virtual machine manager.

[0100] The real server needs to install and configure the corresponding services or applications so that it can parse and process the received request packets. This usually includes configuring the detection port, setting the processing logic, and defining the response format. The virtual machine manager needs to be configured to receive the response packets from the real server and forward them to the original requester or perform other processing as needed. This may involve configuring the network stack of the virtual machine manager, defining virtual networks, and setting traffic forwarding rules. Through the configuration and coordination of these steps, effective communication and data exchange between the real server and the virtual machine manager can be achieved.

[0101] The virtual machine manager can dynamically allocate and manage computing resources to ensure high availability and scalability of services. By sending the response data packets of the real server to the virtual machine manager, more flexible traffic control and routing decisions can be achieved, such as redirecting requests to different servers based on the current load situation, or automatically failing over when a server fails. In addition, the virtual machine manager can also provide security isolation and access control functions to ensure that only authorized users or systems can access sensitive data or services.

[0102] S209: The virtual machine manager modifies the destination MAC address in the response data packet to the MAC address of the load balancer according to the connection tracking information.

[0103] S210: The virtual machine manager modifies the source IP address in the response data packet to the IP address of the load balancer.

[0104] S211: The virtual machine manager sends a response data packet to the load balancer.

[0105] S212: The load balancer sends a response data packet to the client.

[0106] First, the virtual machine manager needs to maintain a connection tracking table, which records the connection information between each client request and the backend real server, including the client's IP address, port number, the real server's IP address, and the load balancer's MAC address and IP address. When the real server generates a response packet, the virtual machine manager checks the connection tracking table, finds the corresponding connection information, and modifies the destination MAC address of the response packet to the MAC address of the load balancer. Secondly, the virtual machine manager also needs to modify the source IP address of the response packet and set it to the IP address of the load balancer. Finally, the modified response packet will be sent back to the load balancer by the virtual machine manager, and the load balancer will forward it to the client. In this way, the virtual machine manager can ensure that the response packet is correctly routed back to the client while maintaining the transparency and symmetry of network traffic.

[0107] The load balancer is responsible for receiving client requests and distributing them to one or more real servers at the backend for processing. In order to maintain the connection persistence between the client and the load balancer and ensure that the response data packet can be correctly routed back to the client, the virtual machine manager needs to modify the destination MAC address and source IP address of the response data packet. Doing so ensures that the response data packet received by the client looks like it comes directly from the load balancer, rather than the backend real server. This helps to simplify network configuration, improve system flexibility and scalability, and also helps to implement more sophisticated traffic control and security policies.

[0108] The data packet transmission method provided in this embodiment receives a request data packet sent by a client through a load balancer, adds the IP address of a real server to the optional information of the request data packet, sends the request data packet to the virtual machine manager of the backend server, the virtual machine manager modifies the destination IP address in the request data packet to the IP address of the real server, deletes the IP address of the real server in the optional information, saves the connection tracking information of the request data packet, sends the request data packet to the real server, the real server processes the request data packet, sends a response data packet to the virtual machine manager, the virtual machine manager modifies the destination MAC address in the response data packet to the MAC address of the load balancer according to the connection tracking information, modifies the source IP address in the response data packet to the IP address of the load balancer, the virtual machine manager sends the response data packet to the load balancer, and the load balancer sends the response data packet to the client; the method realizes the transparent transmission of the client IP, and also ensures the path symmetry of the data packet in the round-trip process, improves the efficiency and reliability of data transmission, and ensures the smoothness and consistency of the entire network communication.

[0109] Figure 3 Interaction of the data packet transmission method provided in this application Figure 2 .like Figure 3 As shown, in this embodiment Figure 1 Based on the embodiment, the data packet transmission method is described in detail. The data packet transmission method shown in this embodiment includes:

[0110] S301: The load balancer receives a request data packet sent by a client.

[0111] S302: The load balancer modifies the destination IP address in the request data packet to the IP address of the real server, and adds the IP address of the real server to the optional information of the request data packet.

[0112] S303: The load balancer sends the request data packet to the backend server.

[0113] The load balancer is in NAT mode of LVS load balancing.

[0114] First, the load balancer receives the request packet from the client. Then, the load balancer checks the destination IP address in the request packet and modifies it to the IP address of a backend real server. This step is to ensure that the request can be correctly received and processed by the specified backend server. At the same time, in order to ensure that the backend server can know the target address of the original request when processing the request, the load balancer will also add the IP address of the real server in the optional information of the request packet. Finally, the modified and enhanced request packet will be sent by the load balancer to the corresponding backend server for further processing.

[0115] The use of a load balancer can improve the scalability of the system, allowing the growing user demand to be met by simply adding more servers. Secondly, it enhances the reliability and fault tolerance of the system, because if a backend server fails, the load balancer can redirect requests to other healthy servers, thus ensuring the continuity of service. In addition, the load balancer can optimize performance by intelligently distributing requests to avoid overloading certain servers, thereby achieving a more balanced load distribution.

[0116] S304: The virtual machine manager deletes the IP address of the real server in the optional information.

[0117] S305: The virtual machine manager saves the connection tracking information of the request data packet.

[0118] S306: The virtual machine manager sends the request data packet to the real server.

[0119] First, the virtual machine manager will parse the received request data packet and identify all the information contained in it, including the optional IP address information. Then, according to the preset security policy, the virtual machine manager will delete the optional IP address information from the data packet. At the same time, in order to ensure that the data packet can be correctly routed to the real server, the virtual machine manager will save the connection tracking information of the request data packet, which includes the source, destination, and key nodes in the transmission process of the data packet. Finally, the processed data packet will be repackaged by the virtual machine manager and sent to the real server to complete the entire request processing process. During this process, the virtual machine manager will also continuously monitor the network status and data packet transmission to ensure smooth and secure data transmission.

[0120] The reason why the virtual machine manager deletes the real server IP address in the request data packet is mainly for security reasons. In a virtualized environment, if the physical location and identity of the real server are obtained by the user, it may face various security risks, such as targeted attacks and data leakage. By deleting this information, the virtual machine manager can increase the difficulty for attackers to identify the location of the real server, thereby effectively protecting the server from potential threats. In addition, this operation also helps maintain the stability and reliability of the virtualized environment and prevent service interruptions or performance degradation caused by information leakage.

[0121] S307: The real server processes the request data packet.

[0122] S308: The real server sends a response data packet to the virtual machine manager.

[0123] The real server will first parse the content of the data packet and identify the specific operation or data requested by the client. Then, according to the configuration and logic of the server, it will perform the corresponding operation or calculation and generate a response data packet containing the processing results. After generating the response data packet, the real server will send it to the virtual machine manager.

[0124] The real server needs to process the request packets because these packets usually contain the operations that the client needs to perform or the data information that the client needs to obtain. As the actual provider of the service, the real server must perform corresponding logic or calculations based on the content of the request to generate the response required by the client. At the same time, forwarding the response packets through the virtual machine manager can ensure the effective management and control of network traffic in the virtualized environment and improve the utilization and security of network resources.

[0125] S309: The virtual machine manager modifies the destination MAC address in the response data packet to the MAC address of the load balancer according to the connection tracking information.

[0126] S310: The virtual machine manager sends a response data packet to the load balancer.

[0127] The virtual machine manager identifies which client the response packet should be sent back to based on the previously saved connection tracking information. It then looks up the MAC address of the load balancer and modifies the destination MAC address in the response packet to the MAC address of the load balancer. This step is usually achieved by modifying the relevant fields in the packet header. After the modification is completed, the virtual machine manager sends the response packet to the load balancer.

[0128] The reason why the virtual machine manager needs to modify the destination MAC address in the response packet to the MAC address of the load balancer is that in virtualized network communications, the load balancer usually acts as a communication bridge between the client and the backend real server. When the real server processes the request and generates a response, this response needs to be sent back to the client, and the client originally sent the request through the load balancer. Therefore, in order to ensure that the response packet can be correctly sent back to the client, the virtual machine manager needs to modify the destination MAC address of the response packet to the MAC address of the load balancer, so that the load balancer can receive the response packet and forward it further to the client.

[0129] S311: The load balancer modifies the source IP address in the response data packet to the IP address of the load balancer.

[0130] S312: The load balancer sends a response data packet to the client.

[0131] The load balancer uses a series of network protocols and algorithms to modify the source IP address in the response data packet. When the backend server processes the request and generates a response data packet, these data packets are sent to the load balancer. After receiving these data packets, the load balancer will identify the client corresponding to the original request based on the internal session table or routing rules. Then, the load balancer will modify the source IP address in the response data packet to its own IP address and send the data packet to the client. The load balancer may use various network protocols (such as TCP / IP) and algorithms (such as polling, weighted polling, least number of connections, etc.) to optimize traffic distribution and load balancing effects. Ultimately, the source IP address displayed in the response data packet received by the client will be the address of the load balancer, not the actual address of the backend server.

[0132] The main reason for the load balancer to perform this address modification is to maintain session consistency between the client and the load balancer and to hide the real IP address of the backend server. Doing so ensures that the client always communicates with the backend server through the load balancer, so that traffic can be managed and controlled more effectively. Secondly, hiding the IP address of the backend server increases the security of the network and prevents potential direct attacks. In addition, this modification also enables the load balancer to flexibly select the backend server to handle the request based on the current load situation, thereby improving the performance and reliability of the overall system.

[0133] The data packet transmission method provided in this embodiment receives a request data packet sent by a client through a load balancer, modifies the destination IP address in the request data packet to the IP address of the real server, adds the IP address of the real server in the optional information of the request data packet, sends the request data packet to the back-end server, the virtual machine manager deletes the IP address of the real server in the optional information, saves the connection tracking information of the request data packet, sends the request data packet to the real server, the real server processes the request data packet, and sends a response data packet to the virtual machine manager, the virtual machine manager modifies the destination MAC address in the response data packet to the MAC address of the load balancer according to the connection tracking information, sends the response data packet to the load balancer, the load balancer modifies the source IP address in the response data packet to the IP address of the load balancer, and sends the response data packet to the client; the method realizes the transparent transmission of the client IP, and also ensures the path symmetry of the data packet in the round-trip process, improves the efficiency and reliability of data transmission, and ensures the smoothness and consistency of the entire network communication.

[0134] Figure 4 This is a schematic diagram of the structure of the data packet transmission device provided in this application. Figure 4 As shown, the data packet transmission device 400 provided in this embodiment includes:

[0135] Receiving module 401, used for the load balancer to receive a request data packet sent by a client;

[0136] Processing module 402, used for adding the IP address of the real server in the backend server to the request data packet;

[0137] The sending module 403 is used to send the request data packet to the back-end server;

[0138] The sending module 403 is also used for the virtual machine manager in the back-end server to send the request data packet to the real server;

[0139] The processing module 402 is further used to store the connection tracking information of the request data packet;

[0140] The processing module 402 is also used for the real server to process the request data packet;

[0141] The sending module 403 is further used to send a response data packet to the virtual machine manager;

[0142] The processing module 402 is further configured for the virtual machine manager to modify the destination MAC address in the response data packet to the MAC address of the load balancer according to the connection tracking information;

[0143] The sending module 403 is further used to send the response data packet to the load balancer;

[0144] The sending module 403 is also used for the load balancer to send the response data packet to the client.

[0145] Optionally, the processing module 402 is further configured to add the IP address of the real server to the optional information of the request data packet.

[0146] Optionally, the processing module 402 is further configured for the virtual machine manager to modify the destination IP address in the request data packet to the IP address of the real server, and to delete the IP address of the real server in the optional information.

[0147] Optionally, the processing module 402 is further configured to modify the source IP address in the response data packet to the IP address of the load balancer.

[0148] Optionally, the processing module 402 is further configured to modify the destination IP address in the request data packet to the IP address of the real server, and add the IP address of the real server to the optional information of the request data packet.

[0149] Optionally, the processing module 402 is further configured to enable the virtual machine manager to delete the IP address of the real server in the optional information.

[0150] Optionally, the processing module 402 is further configured for the load balancer to modify the source IP address in the response data packet to the IP address of the load balancer.

[0151] Figure 5 This is a schematic diagram of the structure of the data packet transmission device provided in this application. Figure 5 As shown, the present application provides a data packet transmission device, and the data packet transmission device 500 includes: a receiver 501, a transmitter 502, a processor 503 and a memory 504.

[0152] Receiver 501, used for receiving instructions and data;

[0153] A transmitter 502, used for sending instructions and data;

[0154] Memory 504, used to store computer-executable instructions;

[0155] The processor 503 is used to execute the computer-executable instructions stored in the memory 504 to implement the various steps performed by the data packet transmission method in the above embodiment. For details, please refer to the relevant description in the above embodiment of the data packet transmission method.

[0156] Optionally, the memory 504 may be independent or integrated with the processor 503 .

[0157] When the memory 504 is independently provided, the electronic device further includes a bus for connecting the memory 504 and the processor 503 .

[0158] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the data packet transmission method executed by the above-mentioned data packet transmission device is implemented.

[0159] The present application also provides a computer program product, including a computer program, which implements the above method when executed by a processor.

[0160] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above method is implemented.

[0161] The above-mentioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.

[0162] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.

[0163] The division of units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.

[0164] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0165] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0166] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0167] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0168] Finally, it should be noted that those skilled in the art will readily conceive of other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present invention, which follow the general principles of the present invention and include common knowledge or customary technical means in the art not disclosed by the present invention, are not limited to the precise structure described above and shown in the drawings, and may be modified and changed in various ways without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.

Claims

1. A data packet transmission method, characterized in that: Applied to a server, the server includes a load balancer and a backend server, the backend server includes a virtual machine manager and multiple real servers managed by the virtual machine manager, the method includes: The load balancer receives a request data packet sent by the client, adds the IP address of the real server in the backend server to the request data packet, and sends the request data packet to the backend server; The virtual machine manager in the back-end server sends the request data packet to the real server and saves the connection tracking information of the request data packet; The real server processes the request data packet and sends a response data packet to the virtual machine manager; The virtual machine manager modifies the destination MAC address in the response data packet to the MAC address of the load balancer according to the connection tracking information, and sends the response data packet to the load balancer; The load balancer sends the response data packet to the client.

2. The method according to claim 1, characterized in that Adding the IP address of the real server in the backend server in the request data packet includes: The IP address of the real server is added in the optional information of the request data packet.

3. The method according to claim 2, characterized in that Before the virtual machine manager in the back-end server sends the request data packet to the real server, the method further includes: The virtual machine manager modifies the destination IP address in the request data packet to the IP address of the real server, and deletes the IP address of the real server in the optional information.

4. The method according to claim 2, characterized in that: Before sending the response data packet to the load balancer, the method further includes: The source IP address in the response data packet is modified to the IP address of the load balancer.

5. The method according to claim 1, characterized in that Adding the IP address of the real server in the backend server in the request data packet includes: The destination IP address in the request data packet is modified to the IP address of the real server, and the IP address of the real server is added to the optional information of the request data packet.

6. The method according to claim 5, characterized in that Before the virtual machine manager in the back-end server sends the request data packet to the real server, the method further includes: The virtual machine manager deletes the IP address of the real server in the optional information.

7. The method according to claim 5, characterized in that Before the load balancer sends the response data packet to the client, the method further includes: The load balancer modifies the source IP address in the response data packet to the IP address of the load balancer.

8. A data packet transmission device, characterized in that: include: A receiving module, used for the load balancer to receive a request data packet sent by a client; A processing module, used for adding the IP address of the real server in the backend server to the request data packet; The sending module is further used to send the request data packet to the back-end server; The sending module is also used for the virtual machine manager in the back-end server to send the request data packet to the real server; The processing module is further used to store the connection tracking information of the request data packet; The processing module is also used for the real server to process the request data packet; The sending module is further used to send a response data packet to the virtual machine manager; The processing module is further used for the virtual machine manager to modify the destination MAC address in the response data packet to the MAC address of the load balancer according to the connection tracking information; The sending module is further used to send the response data packet to the load balancer; The sending module is also used for the load balancer to send the response data packet to the client.

9. A data packet transmission device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 7 when executed by a processor.

Citation Information

Patent Citations

  • Load balancing method, device and system of server

    CN103023942A

  • Server load balancing method based on network protocol stack

    CN104301414A

  • Method, device and system for transmitting data

    CN110708393A

  • Load balancing method, device and equipment and storage medium

    CN111193773A

  • Method and system for processing direct server return load balancing using loopback interface in virtual network environment

    US20180063231A1