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

By working together with the load balancer and virtual machine manager, the problems of IP address changes and path asymmetry in data packet transmission are solved, achieving transparent data packet transmission and efficient and reliable network communication.

CN119449805BActive Publication Date: 2025-11-25CHINA UNITED NETWORK COMM GRP CO LTD +2
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In existing technologies, the source IP and destination IP may change when data packets pass through a load balancer, which makes it impossible for the backend server to directly obtain the client's IP address. Furthermore, the data packet transmission path is asymmetrical, resulting in data loss and low transmission efficiency.

Method used

The load balancer receives client request packets and adds the real IP address of the backend server. The virtual machine manager of the backend server saves connection tracking information. After the real server processes the data, it generates a response packet. The virtual machine manager modifies the destination MAC address of the response packet to the MAC address of the load balancer to ensure that the packet is correctly returned to the client.

Benefits of technology

It achieves transparent transmission of client IP addresses, ensuring path symmetry of data packets during round trips, improving data transmission efficiency and reliability, and ensuring smooth and consistent network communication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119449805B_ABST
    Figure CN119449805B_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of computers and particularly relates to a data packet transmission method, an electronic device, 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 backend server is added in the request data packet, the request data packet is sent to the backend server, a virtual machine manager in the backend server sends the request data packet to the real server, connection tracking information of the request data packet is saved, the real server processes the request data packet, 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 a MAC address of the load balancer according to the connection tracking information, sends the response data packet to the load balancer, and the load balancer sends the response data packet to the client. The method realizes transparent transmission of the client IP, guarantees path symmetry of the data packet in a round trip process, and improves the efficiency and reliability of data transmission.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a data packet transmission method, electronic device, medium, and program product. Background Technology

[0002] With the continuous advancement of internet technology, network data transmission volume has experienced 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 modern society. This trend has driven continuous innovation and optimization of data packet transmission technology to meet the ever-increasing demand for data transmission.

[0003] In existing technologies, data packet transmission mainly involves setting up a virtual server IP, virtualizing the application resources of multiple real backend servers into a single high-performance application server, and using a load balancer to distribute client application requests to the backend server for processing, generating response data packets, and sending them back to the client.

[0004] However, when data packets pass through a load balancer, their source and destination IP addresses may change, making it impossible for the backend server to directly obtain the client's IP address. At the same time, due to the intervention of the load balancer, the transmission path of the data packets is no longer symmetrical. The request data packets sent by the client and the response data packets returned by the actual server may take different paths. Therefore, existing technologies suffer from data loss and low data transmission efficiency during data packet transmission. Summary of the Invention

[0005] This application provides a data packet transmission method, electronic device, medium, and program product to solve the problems of data loss and low data transmission efficiency during data packet transmission.

[0006] In a first aspect, embodiments of this application provide 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 backend 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 based on the connection tracking information, and then 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 to the optional information of the request data packet.

[0014] Optionally, before the virtual machine manager in the backend server sends the request 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 from the optional information.

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

[0017] Modify the source IP address in the response data packet 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] 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.

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

[0021] The virtual machine manager removes the IP address of the real server from 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] Secondly, embodiments of this application provide a data packet transmission apparatus, comprising:

[0025] A receiving module is used for the load balancer to receive request data packets sent by the client;

[0026] The processing module is used to add the IP address of the real server in the backend server to the request data packet;

[0027] A sending module is used to send the request data packet to the backend server;

[0028] The sending module is also used by the virtual machine manager in the backend server to send the request data packet to the real server;

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

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

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

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

[0033] The sending module is also 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 configured to add the IP address of the real server to the optional information of the request data packet.

[0036] Optionally, the processing module is further configured to have the virtual machine manager 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 from the optional information.

[0037] Optionally, the processing module is further configured 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 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.

[0039] Optionally, the processing module is further configured to have the virtual machine manager delete the IP address of the real server from the optional information.

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

[0041] Thirdly, embodiments of this application provide a data packet transmission device, including: a memory and a processor;

[0042] The memory stores computer-executed instructions;

[0043] The processor executes computer execution instructions stored in the memory, causing the processor to perform the first aspect and / or various possible implementations of the first aspect as described above.

[0044] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the first aspect and / or various possible implementations of the first aspect.

[0045] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the first aspect and / or various possible implementations of the first aspect.

[0046] The data packet transmission method provided in this application embodiment receives request data packets sent by clients through a load balancer, 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 backend 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. This method realizes transparent transmission of client IP, ensures the path symmetry of data packets in the round trip, improves the efficiency and reliability of data transmission, and ensures the smoothness and consistency of the entire network communication. Attached Figure Description

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

[0048] Figure 1A flowchart of the data packet transmission method provided in 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 data packet transmission apparatus provided in this application;

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

[0053] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0054] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this 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, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with relevant laws, regulations and standards, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0056] With the rapid advancement of internet technology, the volume of network data transmission is surging at an astonishing rate. Whether it's individual interactions on social media, business operations at the enterprise level, or communication between IoT devices and data exchange on cloud computing platforms, efficient data packet transmission has become a crucial aspect of modern society. This trend has driven continuous innovation and optimization of data packet transmission technology to address the ever-growing demand for data transmission.

[0057] In existing technologies, data packet transmission primarily relies on the configuration of virtual server IPs, which can integrate the application resources of multiple backend real servers into a single high-performance application server. This process is achieved with the assistance of a load balancer, which is responsible for intelligently distributing client application requests to backend servers for processing and generating response data packets to send back to the client.

[0058] However, the source and destination IP addresses of data packets may change during their transit through a load balancer, directly preventing the real server from directly obtaining the client's IP address. Furthermore, the load balancer's intervention de-symbolizes the data packet transmission path. That is, the request data packet sent by the client and the response data packet returned by the real server may travel along different paths. Therefore, existing technologies suffer from data loss and low data transmission efficiency during data packet transmission.

[0059] To address the aforementioned issues, the data packet transmission method provided in this application utilizes a load balancer to receive request data packets from clients. Upon receiving the data packet, the load balancer embeds the IP address of a real server in the backend server cluster and then forwards the packet to the backend server. The virtual machine manager on the backend server receives the data packet and further forwards it to the designated real server for processing, simultaneously recording the connection tracking information. After processing the request, the real server generates a response data packet and sends 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, ensuring that the data packet is accurately returned to the load balancer. Finally, the load balancer forwards this response data packet back to the client that initially initiated the request. This method achieves transparent transmission of the client's IP address, ensures path symmetry during the round trip, improves data transmission efficiency and reliability, and ensures smooth and consistent network communication.

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

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

[0062] S101: The load balancer receives the 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.

[0063] A load balancer is a network device or software service whose main function is to intelligently distribute client request packets to a specific backend server for processing in high-concurrency or high-data-traffic environments. This process typically involves receiving request packets from clients and then, based on a specific load balancing algorithm (such as round-robin, least connections, or hashing), adding the IP address of a real server in the backend server cluster to the request packet. After this modification, the load balancer forwards the processed request packet to the selected backend server for further processing and response. For example, an LVS load balancer could be used.

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

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

[0066] Understandably, to enable a load balancer to receive request packets from clients, add the real IP addresses of backend servers to them, and then forward them to the backend servers, the following steps are necessary: ​​First, the basic parameters of the load balancer need to be configured, including the selection of the load balancing algorithm and the configuration of the backend server cluster. This ensures that the load balancer can correctly identify and manage the backend servers. When a client sends request packets, the load balancer needs to detect and receive these packets. This is typically achieved by configuring the load balancer's network interface and detection port. Based on 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 evaluating metrics such as the server's current load and response time. After selecting a backend server, the load balancer needs to add the server's real IP address to the request packet. This is typically achieved by modifying the destination IP address field in the packet header. Finally, the load balancer forwards the modified request packet to the selected backend server.

[0067] In high-traffic scenarios, a single server may be unable to handle all requests, leading to longer response times or even service crashes. Therefore, by distributing request packets across multiple backend servers, load balancers enable parallel request processing, significantly improving system throughput and response time. Furthermore, when a server in the backend server cluster fails, the load balancer can automatically redirect requests to other functioning servers, achieving high service availability. Additionally, by adding the backend server's real IP address to the request packet, the load balancer also enables transparent request forwarding, ensuring that backend servers can correctly parse and process requests.

[0068] For example, adding the real server IP address to the request packet can be done by adding the real server IP address in the backend server to the TCP and UDP options of the request packet.

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

[0070] The virtual machine manager is responsible for receiving request packets from the load balancer and routing them to the actual physical servers. Simultaneously, the virtual machine manager maintains connection tracking information for the request packets to ensure that packets correctly travel between the client and the physical server throughout the 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] Understandably, the virtual machine manager configures network virtualization to create virtual network switches and virtual network interfaces, which connect to the real network interfaces of the backend servers. When the load balancer sends a request packet to the virtual machine manager, the virtual network switch routes it to the correct real server based on information such as the packet's destination address and port number. The virtual machine manager records connection tracking information for the request packets. 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.

[0073] Managing the distribution of request packets through Virtual Machine Manager allows for the easy addition or removal of live servers to adapt to changing workload demands. Maintaining connection tracking information for request packets helps maintain session integrity and stability, ensuring uninterrupted client requests even during migrations or failovers between live servers. Virtual Machine Manager also provides additional security isolation and performance optimization features, such as firewall rules, resource quota limits, and optimized network communication 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] In the response data packet, the source IP address 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 a request data packet, the real server processes it accordingly. This may involve data querying, execution of computational tasks, and resource allocation. During processing, the real server may interact with the virtual machine manager to obtain necessary resources or information. Finally, after processing is complete, the real server generates a response data packet and sends it back to the virtual machine manager.

[0077] The virtual machine manager itself does not have the ability to directly handle complex computing tasks or access physical resources; therefore, it needs to rely on a physical server to accomplish these tasks. The physical server has greater computing power and richer resources, enabling it to 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 system's flexibility and scalability.

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

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

[0080] In a load-balanced environment, backend servers typically do not directly know the client's real IP address or MAC address. Backend servers communicate with clients through a load balancer, which distributes client requests to the appropriate backend servers, collects responses from backend servers, and then forwards them back to the client. Therefore, when a backend server generates response packets, their initial destination address might point to the virtual machine manager or be directly returned to the requesting virtual machine, but this does not reflect the realities of network communication. To ensure packets are correctly returned to the client, the virtual machine manager needs to modify the destination MAC address of the response packets based on connection tracking information, directing it to the load balancer, thus ensuring smooth and accurate network communication.

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

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

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

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

[0085] The data packet transmission method provided in this embodiment receives request data packets sent by clients through a load balancer, 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 backend 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 then sends the response data packet to the client. This method achieves transparent transmission of the client's IP address, ensures the path symmetry of the data packet during the round trip, 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 embodiments, 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 request data packets sent by the client.

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

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

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

[0091] In implementing a load balancer that receives client requests and forwards them to backend servers, the first step is to configure the load balancer's forwarding rules and policies. This includes defining the IP address pool for backend servers, setting load balancing algorithms (such as round-robin, least connections, etc.), and configuring session persistence mechanisms. Then, when the load balancer receives a request packet from a client, it selects a suitable server from the IP address pool based on the configured policies and rules, and adds the server's IP address to the optional information in the request packet. Finally, the load balancer sends the processed request packet to the virtual machine manager of the backend server. The virtual machine manager then distributes the request to the appropriate virtual machine instance for processing based on the specific business logic and resource configuration. Throughout this process, the load balancer also needs to monitor the status and performance of the backend servers in real time to adjust the distribution strategy promptly and ensure stable system operation.

[0092] The reason load balancers add the actual server's IP address to the optional information of request packets is that in distributed systems, clients typically only know the load balancer's IP address, not the specific addresses of the backend servers. By adding the actual server's IP address, the load balancer ensures that packets are not misrouted or dropped during forwarding. Furthermore, the load balancer can dynamically adjust the distribution strategy of request packets based on factors such as the load and processing capacity of the backend servers, thereby optimizing resource allocation and ensuring high system availability.

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

[0094] S205: The virtual machine manager saves connection tracking information for request packets.

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

[0096] After receiving a request data packet, the virtual machine manager modifies the destination IP address and deletes optional information by writing or calling corresponding network programming interfaces or library functions. During the processing of the request data packet, the virtual machine manager needs to save the connection tracking information of the packet. This can be achieved by maintaining a connection tracking table or database in memory, which records information such as the unique identifier of each connection, source IP address, destination IP address, and port number. Finally, the virtual machine manager sends the processed request data packet over the network to the corresponding real server for further processing.

[0097] Removing the real server IP address from optional information in data packets reduces redundancy in network communication and also helps improve communication security. Saving connection tracking information from request packets helps the virtual machine manager accurately identify and track the connection in subsequent communications, enabling session management and connection state maintenance. This is crucial for maintaining the stability and reliability of network communication.

[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 live server needs to have the appropriate services or applications installed and configured to parse and process received request packets. This typically includes configuring the detection port, setting up processing logic, and defining the response format. The virtual machine manager needs to be configured to receive response packets from the live server and forward them to the original requester or perform other processing as needed. This may involve configuring the virtual machine manager's network stack, defining virtual networks, and setting traffic forwarding rules. Through the configuration and coordination of these steps, effective communication and data exchange between the live server and the virtual machine manager can be achieved.

[0101] Virtual machine managers can dynamically allocate and manage computing resources, ensuring high availability and scalability of services. By sending response packets from live servers to the virtual machine manager, more flexible traffic control and routing decisions can be made, such as redirecting requests to different servers based on current load or automatically performing failover in case of server failure. Furthermore, virtual machine managers can provide security isolation and access control functions, ensuring 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 packet to the MAC address of the load balancer based on the connection tracking information.

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

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

[0105] S212: The load balancer sends the 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 load balancer's MAC address. Second, the virtual machine manager also needs to modify the source IP address of the response packet, setting it to the load balancer's IP address. Finally, the modified response packet is sent back to the load balancer by the virtual machine manager, which then forwards it to the client. In this way, the virtual machine manager can ensure that response packets are correctly routed back to the client while maintaining the transparency and symmetry of network traffic.

[0107] A load balancer is responsible for receiving client requests and distributing them to one or more backend physical servers for processing. To maintain a persistent connection between the client and the load balancer, and to ensure that response packets are correctly routed back to the client, the virtual machine manager needs to modify the destination MAC address and source IP address of the response packets. This ensures that the response packets received by the client appear to originate directly from the load balancer, rather than from the backend physical servers. This helps simplify network configuration, improves system flexibility and scalability, and also facilitates finer-grained traffic control and security policies.

[0108] The data packet transmission method provided in this embodiment receives request data packets sent by clients through a load balancer. The IP address of the real server is added to the optional information of the request data packet. The request data packet is then sent 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 and deletes the IP address of the real server from the optional information. Connection tracking information of the request data packet is saved, and the request data packet is sent to the real server. The real server processes the request data packet and sends a response data packet to the virtual machine manager. Based on the connection tracking information, the virtual machine manager modifies the destination MAC address in the response data packet to the MAC address of the load balancer and modifies the source IP address in the response data packet to the IP address of the load balancer. The virtual machine manager then sends the response data packet to the load balancer, which in turn sends the response data packet to the client. This method achieves transparent transmission of the client's IP address and ensures the path symmetry of data packets during round trips, improving the efficiency and reliability of data transmission and ensuring smooth and consistent 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 embodiments, 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 request data packets sent by the client.

[0111] S302: The load balancer modifies the destination IP address in the request 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 packet.

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

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

[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 suitable backend server. This step ensures the request can be correctly received and processed by the designated backend server. Simultaneously, to ensure the backend server knows the original request's destination address when processing the request, the load balancer also adds the real server's IP address to the optional information in the request packet. Finally, the modified and enhanced request packet is sent by the load balancer to the appropriate backend server for further processing.

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

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

[0117] S305: The virtual machine manager saves connection tracking information for request packets.

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

[0119] First, the virtual machine manager parses the received request data packet, identifying all information it contains, including optional IP address information. Then, according to a preset security policy, the virtual machine manager removes this optional IP address information from the data packet. Simultaneously, to ensure the data packet is correctly routed to the live server, the virtual machine manager saves connection tracking information for the request data packet, including the packet's origin, destination, and key nodes in the transmission process. Finally, the processed data packet is repackaged by the virtual machine manager and sent to the live server, completing the entire request processing process. Throughout this process, the virtual machine manager continuously monitors network status and data packet transmission to ensure smooth and secure data transmission.

[0120] The primary reason the virtual machine manager removes the real server's IP address from request packets is for security reasons. In a virtualized environment, if the physical location and identity of the real server are obtained by users, it may face various security risks, such as targeted attacks and data breaches. By removing this information, the virtual machine manager increases the difficulty for attackers to identify the real server's location, thereby effectively protecting the server from potential threats. Furthermore, this operation also helps maintain the stability and reliability of the virtualized environment, preventing service interruptions or performance degradation due to information leaks.

[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 first parses the data packet to identify the specific operation or data requested by the client. Then, based on the server's configuration and logic, it executes the corresponding operation or calculation, generating a response data packet containing the processing result. After generating the response data packet, the real server sends it to the virtual machine manager.

[0124] The real server needs to process request packets because these packets typically contain the operations or data information that the client needs to perform. As the actual service provider, the real server must execute the corresponding logic or calculations based on the request content to generate the response required by the client. Simultaneously, forwarding response packets through the virtual machine manager ensures effective management and control of network traffic in the virtualized environment, improving network resource utilization and security.

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

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

[0127] The virtual machine manager uses previously saved connection tracking information to identify which client the response packet should be sent to. Then, it looks up the load balancer's MAC address and modifies the destination MAC address in the response packet to match the load balancer's MAC address. This step is typically achieved by modifying relevant fields in the packet header. After modification, the virtual machine manager sends the response packet to the load balancer.

[0128] The reason the virtual machine manager modifies the destination MAC address in the response packet to the load balancer's MAC address is that in virtualized network communication, the load balancer typically acts as a communication bridge between the client and the backend physical server. When the physical server processes the request and generates a response, this response needs to be sent back to the client, which initially sent the request through the load balancer. Therefore, to ensure that the response packet is correctly sent back to the client, the virtual machine manager needs to modify the destination MAC address of the response packet to the load balancer's MAC address. This allows the load balancer to receive the response packet and forward it to the client.

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

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

[0131] Load balancers use a series of network protocols and algorithms to modify the source IP address in response packets. When a backend server processes a request and generates a response packet, this packet is sent to the load balancer. Upon receiving these packets, the load balancer identifies the client corresponding to the original request based on its internal session table or routing rules. Then, the load balancer modifies the source IP address in the response packet to its own IP address and sends the packet to the client. Load balancers may use various network protocols (such as TCP / IP) and algorithms (such as round-robin, weighted round-robin, least connections, etc.) to optimize traffic distribution and load balancing. Ultimately, the source IP address displayed in the response packet received by the client will be the load balancer's address, not the actual address of the backend server.

[0132] The primary reason load balancers perform this address modification is to maintain session consistency between clients and the load balancer and to hide the real IP addresses of backend servers. This ensures that clients always communicate with backend servers through the load balancer, allowing for more effective traffic management and control. Secondly, hiding the backend server's IP address increases network security and prevents potential direct attacks. Furthermore, this modification allows the load balancer to flexibly select backend servers to handle requests based on the current load, thereby improving the overall system performance and reliability.

[0133] The data packet transmission method provided in this embodiment receives request data packets sent by clients 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 to the optional information of the request data packet, and sends the request data packet to the backend server. The virtual machine manager deletes the IP address of the real server from the optional information, saves the connection tracking information of the request data packet, and 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 and 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. This method achieves transparent transmission of client IP and ensures the path symmetry of data packets during round trips, improving the efficiency and reliability of data transmission and ensuring the smoothness and consistency of the entire network communication.

[0134] Figure 4 A schematic diagram 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] The receiving module 401 is used for the load balancer to receive request data packets sent by the client;

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

[0137] Sending module 403 is used to send the request data packet to the backend server;

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

[0139] The processing module 402 is also used to save 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 also used to send a response data packet to the virtual machine manager;

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

[0143] The sending module 403 is also 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 to have the virtual machine manager 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 from 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 have the virtual machine manager delete the IP address of the real server from the optional information.

[0150] 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.

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

[0152] Receiver 501 is used to receive instructions and data;

[0153] Transmitter 502 is used to send commands and data;

[0154] Memory 504 is used to store instructions executed by the computer;

[0155] Processor 503 is used to execute computer execution instructions stored in memory 504 to implement the various steps of the data packet transmission method in the above embodiments. For details, please refer to the relevant descriptions in the foregoing embodiments of the data packet transmission method.

[0156] Alternatively, the memory 504 can be either standalone or integrated with the processor 503.

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

[0158] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the data packet transmission method performed by the aforementioned data packet transmission device.

[0159] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.

[0160] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described method.

[0161] The aforementioned 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 storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.

[0162] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from 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 reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.

[0163] The division of units is merely a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.

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

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

[0166] If a function is implemented as 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 this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0167] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.

[0168] Finally, it should be noted that other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein, and is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.

Claims

1. A data packet transmission method, characterized in that, Applied to the server side, the server side includes a load balancer and backend servers, the backend servers include 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 backend 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 based on the connection tracking information, and then 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 to the request data packet includes: The IP address of the real server is added to 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 backend 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 from 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: Modify the source IP address in the response data packet 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 to the request data packet includes: 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.

6. The method according to claim 5, characterized in that, Before the virtual machine manager in the backend server sends the request data packet to the real server, the method further includes: The virtual machine manager removes the IP address of the real server from 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 is used for the load balancer to receive request data packets sent by the client; The processing module is used to add the IP address of the real server in the backend server to the request data packet; The sending module is also used to send the request data packet to the backend server; The sending module is also used by the virtual machine manager in the backend server to send the request data packet to the real server; The processing module is also used to save the connection tracking information of the request data packet; The processing module is also used by the real server to process the request data packet; The sending module is also used to send a response data packet to the virtual machine manager; The processing module is further configured to have the virtual machine manager modify the destination MAC address in the response data packet to the MAC address of the load balancer based on the connection tracking information; The sending module is also 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-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in 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, when executed by a processor, are used to implement the method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Load balancing method, device and system of server

    CN103023942A

  • Server load balancing method based on network protocol stack

    CN104301414A