WO2017133291A1 - 一种基于服务器集群的报文生成方法和负载均衡器 - Google Patents

一种基于服务器集群的报文生成方法和负载均衡器 Download PDF

Info

Publication number
WO2017133291A1
WO2017133291A1 PCT/CN2016/105230 CN2016105230W WO2017133291A1 WO 2017133291 A1 WO2017133291 A1 WO 2017133291A1 CN 2016105230 W CN2016105230 W CN 2016105230W WO 2017133291 A1 WO2017133291 A1 WO 2017133291A1
Authority
WO
WIPO (PCT)
Prior art keywords
address
destination
server
mac address
obtaining
Prior art date
Application number
PCT/CN2016/105230
Other languages
English (en)
French (fr)
Inventor
韦启蒙
龚飞
胡敏
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority claimed from CN201610944661.9A external-priority patent/CN107026890B/zh
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to EP16889098.6A priority Critical patent/EP3402151B1/en
Priority to KR1020187024414A priority patent/KR102138619B1/ko
Publication of WO2017133291A1 publication Critical patent/WO2017133291A1/zh
Priority to US16/052,923 priority patent/US10911398B2/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/40Network security protocols

Definitions

  • the invention is based on a load balancing technology, and particularly relates to a server cluster-based packet generation method and a load balancer for a server cluster.
  • Load Balance which means that tasks are distributed to multiple operating units for execution, such as Web servers, FTP servers, enterprise critical application servers, and other mission-critical servers to accomplish work tasks.
  • Clustering is to improve the performance of the server and combine multiple servers.
  • VLAN Virtual Local Area Network
  • a virtual local area network is a set of logical devices and users. These devices and users are not restricted by physical location. They can be organized according to factors such as functions, departments, and applications. The communication between them is as if they are Same as in the same network segment, so it is called virtual local area network.
  • the VLAN mainly works in Layer 2 and Layer 3 of the OSI reference model.
  • a VLAN is a broadcast domain, and communication between VLANs is done through a Layer 3 router.
  • Linux Virtual Server The architecture of the virtual server is shown in Figure 1.
  • a group of servers are connected to each other through a high-speed LAN or a geographically distributed WAN with a load balancer at their front end.
  • the load balancer seamlessly balances network requests to real servers, making the structure of the server cluster transparent to customers.
  • Client access to the cluster system provides the same network services as accessing a high-performance, highly available server.
  • the client program is not affected by the server cluster and does not require any modifications.
  • the scalability of the system is achieved by transparently joining and deleting a node in the server farm, achieving high availability by detecting node or service process failures and properly resetting the system.
  • the LVS cluster adopts a three-layer structure, and its main components are: A, load The load balancer, which is the front-end machine to the outside of the cluster, is responsible for sending the client's request to a group of servers for execution, and the client considers the service to be from an IP address.
  • the server pool is a group of servers that actually execute client requests.
  • the services executed include WEB, MAIL, FTP, and DNS.
  • C shared storage, which provides a shared storage area for the server pool, which makes it easy for the server pool to have the same content and provide the same service.
  • LVS clusters use IP load balancing technology and content-based request distribution technology.
  • the load balancer has a good throughput rate, and the request is balancedly transferred to different servers for execution, and the load balancer automatically shields the server from failures, thereby forming a set of servers into a high-performance, highly available virtual server.
  • VS/NAT Virtual Server via Network Address
  • IP tunnels implement virtual server VS/TUN (Virtual Server via IP Tunneling) technology, and VS/DR (Virtual Server via Direct Routing) technology for direct server routing, which can greatly improve system scalability.
  • Sex. VS/NAT, VS/TUN, and VS/DR technologies are three IP load balancing technologies implemented in LVS clusters.
  • the back-end service host wants to transparently perceive the client IP (the IP transmitted in the network is the client IP)
  • the current common technologies on the Internet are the LVS DR and LVS NAT modes, but across the Vlan.
  • the DR mode requires the load balancer and the back-end host to be in the same Vlan, and the current large-scale cloud deployment usually spans the Vlan, which results in the traditional DR mode not being applicable to the large-scale cross-Vlan cluster deployment.
  • the embodiment of the invention provides a packet generation method based on a server cluster, and the method package Included: obtaining a client request message, where the client request message includes a source IP address and a destination IP address;
  • the data packet can be effectively transmitted in a large-scale cross-Vlan deployment, so that the source IP address of the client can be known at the physical layer, the network layer, and the like.
  • obtaining an address resolution protocol ARP response packet includes: obtaining the initial MAC address according to an IP address of the destination server; and obtaining the ARP response packet according to the initial MAC address.
  • the packet can be sent to the network correctly. This ensures that the service is processed normally without changing the source IP address of the packet.
  • the source IP can be obtained at the network layer without modifying any server configuration, so that client behavior analysis and network interception can be performed at the network layer, which greatly improves the client experience.
  • the initial MAC address is obtained from a preset form according to the IP address of the server, where the preset form is used to store a correspondence between an IP address of the server and a MAC address.
  • the preset form is used to store a correspondence between an IP address of the server and a MAC address.
  • the IP address of the destination server is converted according to a preset algorithm to obtain the initial MAC address.
  • the mac address can be constructed in real time, and the flow table does not need to be stored in advance, and the storage space can be saved, and the ARP request can also respond in time.
  • the implementation of the configuration of the mac address can effectively process the request in a timely manner and ensure the normal implementation of the service.
  • the updated destination IP address is the same as the IP address of the server. This message can be sent to the server correctly.
  • An embodiment of the present invention discloses a load balancer for a server cluster, where the load balancer includes: a direct routing module, configured to receive a client request message, where the client request message includes a source IP address and a destination IP address; the direct routing module is further configured to determine a destination server according to the preset load balancing policy; the direct routing module is further configured to send an address resolution protocol ARP request packet according to the destination IP address; The routing module is further configured to obtain an address resolution protocol ARP response packet according to the ARP request packet, where the ARP response packet includes an initial media access control MAC address of the destination server, where the initial MAC address is The destination server has different actual MAC addresses, and the packet address conversion module is configured to update the destination IP address according to the initial MAC address to obtain an updated client request packet, where the updated client request packet includes The source IP address and the updated destination IP address.
  • the load balancer according to the embodiment of the present invention can effectively implement data packet transmission in a large-scale cross-Vlan deployment, so that the source IP address of
  • the direct routing module is further configured to: obtain the initial MAC address according to an IP address of the destination server; and obtain the ARP response packet according to the initial MAC address.
  • the packet can be sent to the network correctly. This ensures that the service is processed normally without changing the source IP address of the packet.
  • the source IP can be obtained at the network layer without modifying any server configuration, so that client behavior analysis and network interception can be performed at the network layer, which greatly improves the client experience.
  • the direct routing module is further configured to: obtain the initial MAC address from a preset form according to an IP address of the server, where the preset form is used to store an IP of the server. Corresponding relationship between the address and the MAC address; obtaining the ARP response packet according to the initial MAC address. In a possible implementation manner, there is a one-to-one correspondence between an IP address and a mac address.
  • the direct routing module is further configured to: according to a preset algorithm
  • the IP address of the destination server is converted to obtain the initial MAC address, and the ARP response packet is obtained according to the initial MAC address.
  • the mac address can be constructed in real time, and the flow table does not need to be stored in advance, and the storage space can be saved, and the ARP request can also respond in time.
  • the implementation of the configuration of the mac address can effectively process the request in a timely manner and ensure the normal implementation of the service.
  • the updated destination IP address is the same as the IP address of the server. This message can be sent to the server correctly.
  • the load balancer further includes a detection module, configured to detect the next hop mac address of the load balancer, and use the next hop mac address as the mac address of the updated message. This allows the message to be sent to the server correctly.
  • An embodiment of another aspect of the present invention provides a load balancer including a processor and a memory, the memory storing executable code, the processor executing the code for obtaining a client request message, where the client request message includes a source IP address and a destination IP address; the executable code is further configured to determine a destination server according to a preset load balancing policy; the executable code is further used according to the purpose
  • the IP address is obtained by the address resolution protocol ARP request packet, and the executable code is further configured to obtain an address resolution protocol ARP response packet according to the ARP request packet, where the ARP response packet includes an initial media access control MAC of the destination server.
  • the load balancer can effectively implement data packet transmission in a large-scale cross-Vlan deployment, so that the source IP address of the client can be known at the physical layer, the network layer, and the like.
  • the processor executes the code to: obtain the initial MAC address according to an IP address of the destination server; and obtain the ARP response packet according to the initial MAC address.
  • the message can be correct by constructing the form of the initial MAC address. Sending to the network not only ensures the normal processing of the service, but also does not change the source IP address of the packet.
  • the source IP can be obtained at the network layer without modifying any server configuration, so that client behavior analysis and network interception can be performed at the network layer, which greatly improves the client experience.
  • the processor executes the code, to: obtain the initial MAC address from a preset form according to an IP address of the server, where the preset form is used to store an IP of the server. Corresponding relationship between the address and the MAC address; obtaining the ARP response packet according to the initial MAC address.
  • the processor executes the code, by: converting an IP address of the destination server according to a preset algorithm to obtain the initial MAC address; and obtaining the ARP according to the initial MAC address. Response message.
  • the mac address can be constructed in real time, and the flow table does not need to be stored in advance, and the storage space can be saved, and the ARP request can also respond in time.
  • the implementation of the configuration of the mac address can effectively process the request in a timely manner and ensure the normal implementation of the service.
  • the updated destination IP address is the same as the IP address of the server. This message can be sent to the server correctly.
  • the processor executes the code for detecting a next hop mac address of the load balancer, and using the next hop mac address as the mac address of the updated message. This allows the message to be sent to the server correctly.
  • Figure 1 is a schematic diagram of the architecture of a virtual server.
  • FIG. 2 is a schematic diagram of an architecture of a virtual router technology implemented by direct routing.
  • FIG. 3 is a schematic diagram of a workflow of implementing virtual server technology by direct routing.
  • FIG. 4 is a schematic diagram of deployment of a load balancer under a large-scale cross-virtual LAN cluster.
  • FIG. 5 is a schematic flowchart of a packet request and a message response of a server cluster according to an embodiment of the present invention.
  • FIG. 6 is a schematic diagram of an implementation manner of generating, transmitting, and responding to a message based on a server cluster according to an embodiment of the present invention.
  • FIG. 7 is a schematic flowchart of a process of an address resolution protocol proxy response flow according to an embodiment of the present invention.
  • FIG. 8 is a flowchart of processing based on a learning flow table according to an embodiment of the present invention.
  • FIG. 9 is a schematic structural diagram of a load balancer used for a server cluster according to an embodiment of the present invention.
  • VS/DR Virtual Server via Direct Routing
  • the VS/DR utilizes the asymmetric characteristics of most Internet services, and the load balancer is only responsible for the equalization request.
  • the server directly returns the response to the client, which can greatly improve the throughput of the entire cluster system.
  • VS/DR The architecture of VS/DR is shown in Figure 2. Both the load balancer and the server group must physically have a network card connected through a non-segmented LAN, such as through a high-speed switch or HUB.
  • the VIP virtual IP
  • the VIP address configured by the load balancer is externally visible and is used to receive request messages of the virtual service. All servers configure the VIP address in their respective Non-ARP. (Address Resolution Protocol) Network On the network device, it is invisible to the outside, only for processing network requests with a destination address of VIP.
  • VS/DR routes packets directly to the target server.
  • the load balancer dynamically selects a server according to the load condition of each server, and does not modify or encapsulate IP packets. Instead, the MAC (Media Access Control) address of the data frame is changed to The MAC address of the server is selected, and the modified data frame is sent on the local area network of the server group. Because the MAC address of the data frame is the selected server, the server can certainly receive the data frame from which the IP packet can be obtained.
  • the server finds that the destination address of the packet is on the local network device, the server processes the packet and then directly returns the response packet to the client according to the routing table.
  • the destination address of the request packet is VIP (Virtual IP, virtual IP), and the source address of the response packet is also VIP.
  • the response message does not need to be modified, and can be directly returned to the client. The client thinks that the service is normal, and does not know which server is being processed.
  • the DR (Direct Routing) mode requires the load balancer and the back-end host to be in the same VLAN.
  • the current large-scale cloud deployment usually spans the Virtual Local Area Network (Vlan), which leads to the traditional DR. Modes cannot be applied with large-scale cross-Vlan cluster deployments.
  • the embodiment of the present invention provides a packet sending method based on the DR technology, which can effectively implement data packet transmission in a large-scale cross-Vlan deployment, so that the source IP address of the client can be known at the physical layer, the network layer, and the like. address.
  • FIG. 4 is a schematic diagram of deployment of a LB (Load Banlancer) in a large-scale Vlan cluster.
  • the client user accesses the server cluster through the Internet, thereby obtaining various services, and the deployment may be in the form of a public cloud or a private cloud.
  • the LB is the front-end machine outside the entire cluster pair and is responsible for sending the client's request to a group of servers for execution.
  • a server group runs multiple VMs (Virtual Machines), which can specifically handle various service requests.
  • VMs Virtual Machines
  • FIG. 5 is a schematic flowchart of a server cluster-based message request and a message response according to an embodiment of the present invention.
  • the switch sends the packet to the LVS (Linux Virtual Server) cluster through the equal-cost route, and manages the flow table to change the destination IP address to the back-end host.
  • the IP address allows the packet to be transmitted to the back-end server across the Vlan.
  • the source IP address in the request packet is not changed. This allows the source IP address of the client to be detected at the network layer.
  • the response packet sent for the request packet you need to do the SNAT (source network address translation), and change the source IP address of the response packet to the public IP address (that is, the destination IP address in the request packet), SNAT.
  • the module can be deployed on the compute node corresponding to the VM. In this way, the source IP address of the response packet received by the client is the same as the destination IP address in the request packet, and the request sent by the client is correctly responded.
  • server cluster-based packet generation, sending, and response according to the embodiment of the present invention is described in detail below with reference to FIG. 6-8.
  • the client's IP address is 200.1.1.19, and the client can be a laptop, desktop, mobile phone, tablet or other network access device.
  • the client needs to request the service with the public IP address of 117.78.6.19.
  • the source IP address of the request packet is 200.1.1.19 and the destination IP address is 117.78.6.19.
  • the client may first issue a request for accessing the domain name, such as accessing www.huawei.com, etc., after the DNS (Domain Name System) server completes the resolution of the domain name, the server names the domain name. The corresponding public IP address is sent to the client.
  • DNS Domain Name System
  • the load balancer at the forefront of the LVS cluster receives the packet and performs a series of processing on the packet.
  • the load balancer selects the server from the server cluster according to the load balancing scheduling algorithm to respond to the request. For example, server 1 has a corresponding IP address of 10.11.12.11; server 2 has a corresponding IP address of 10.11.12.12; and server 3 has a corresponding IP address of 10.11.12.13. In this example, server 3 is selected and the corresponding IP address is 10.11.12.13.
  • the load scheduling strategy and algorithm on the load scheduler mainly includes two aspects of the dynamic feedback load balancing algorithm implemented in the kernel.
  • the dynamic feedback load balancing algorithm mainly combines the weighted connection scheduling algorithm in the kernel, and adjusts the weight of the server according to the load information returned by the dynamic feedback to further avoid load imbalance between servers.
  • the kernel connection scheduling algorithm mainly includes Round-Robin Scheduling, Weighted Round-Robin Scheduling, Least-Connection Scheduling, Weighted Least Scheduling (Weighted Least) -Connection Scheduling), Locality-Based Least Connections Scheduling, Locality-Based Least Connections with Replication Scheduling, Destination Hashing Scheduling, Source Hashing Scheduling and other methods.
  • the dynamic feedback load balancing algorithm considers the real-time load and response of the server, and constantly adjusts the proportion of requests processed between servers to avoid receiving a large number of requests when some servers are overloaded, thereby improving the throughput of the entire system, including connection scheduling and dynamic feedback. Load balancing mechanism, integrated load and weight calculation.
  • three load tables are stored in the load balancer, and the load balancer can perform different functions according to the flow table.
  • the load balancer can construct a MAC address based on the ARP proxy response flow table, so that subsequent packets can be sent to the network.
  • the load balancer can modify the destination mac and destination IP address of the packet according to the address translation flow table, so that the packet can be distributed across VLANs.
  • the next hop mac address detected by the load balancer and stored in the address translation flow table is the next hop mac address detected by the load balancer and stored in the address translation flow table.
  • the load balancer configures the egress gateway IP, periodically. Sends an ARP broadcast probe and obtains the next hop mac address of the network by comparing it with the gateway IP address and stores it in the address translation flow table.
  • the LVS DR module issues an ARP message requesting the corresponding MAC address.
  • the ARP packet is not actually sent to the network, but is intercepted and processed internally by the load balancer.
  • the ARP proxy response flow table first receives the ARP packet, parses the corresponding IP address from the ARP packet (for example, 10.11.12.13), and then generates a fake MAC address for fraud according to the preset rule. .
  • the fake mac address herein does not match the actual physical mac address of the server 3.
  • the fraud is performed by causing the LVS DR module to send a request message to the mac address in the response packet according to the received ARP response packet.
  • the load balancer can send packets to the network correctly. This ensures that the service is processed normally without changing the source IP address of the packets.
  • the source IP can be obtained at the network layer without modifying any server configuration, so that client behavior analysis and network interception can be performed at the network layer, which greatly improves the client experience.
  • the mac address corresponding to the IP address is obtained by using a preset rule, for example, adding two fields before the field of the IP address or adding two fields after the field of the IP address.
  • Example 1 The IP address is 10.11.12.13, and the constructed MAC address is aa.bb.10.11.12.13.
  • Example 2 The IP address is 10.11.12.13, and the constructed MAC address is 10.11.12.13.aa.bb.
  • Example 3 The IP address is 10.11.12.13, and the constructed MAC address is 10.11.aa.12.13.bb.
  • the mac address can be constructed in real time, and the flow table does not need to be stored in advance, and the storage space can be saved, and the ARP request can also respond in time.
  • the implementation of the configuration of the mac address can effectively process the request in a timely manner and ensure the normal implementation of the service.
  • the mac address corresponding to the IP address is obtained by looking up the table, and there is a one-to-one correspondence between the IP address and the mac address.
  • the LVS DR module After receiving the ARP packet, the LVS DR module encapsulates the mac address in the ARP packet with the client's request packet.
  • the destination mac address of the packet is the mac address configured by the ARP proxy response flow table.
  • the source IP address and destination IP address are the same as the client request packet.
  • the LVS DR module directly determines the mac address of the packet as the obtained mac address, and encapsulates the encapsulated packet according to the mac address.
  • the encapsulated packet is not actually sent to the network, but is intercepted internally by the load balancer.
  • the address translation flow table intercepts the packet, and the destination mac of the current packet is aa.bb.10.11.12.13, and the destination IP address is calculated as 10.11.12.13 according to the flow table rule.
  • the mac conversion enables the message to be sent to the next hop in the network
  • the IP conversion enables the message to be distributed across the Vlan (10.11.12.13 is an intranet IP, and the route is reachable).
  • the address translation flow table may also obtain an IP address corresponding to the destination mac by means of a table lookup, and there is a one-to-one correspondence between the IP address and the mac address.
  • the MAC address of the next hop is obtained by the GARP (Generic Attribute Registration Protocol).
  • the network condition may be detected according to a predetermined time interval or according to the request triggering manner; then, the GARP packet is received, the MAC address of the next hop is obtained by parsing the GARP packet, and then the MAC address of the next hop is stored in the address translation stream. table.
  • the server After receiving the client request packet, the server generates a response packet according to the request packet.
  • the source IP address of the response packet is the IP address of the server, and the destination address is the IP address of the client. Passing through After the address translation protocol is translated, the source IP address of the response packet is changed to the public IP address requested by the request packet. The converted response message is then sent directly to the client based on the client's IP address.
  • the address translation module can be deployed on a compute node.
  • the correspondence between the VIP (virtual IP) and the vm (virtual mchine) IP can be saved in the SNAT flow table when the LB is established.
  • the destination IP has been converted to the virtual IP of the intranet, 10.11.12.13, when the vm (virtual machine) returns the packet, the source IP is 10.11.12.13, and the IP originally accessed by the internet client. It is vip 117.68.6.19.
  • the source IP (VM IP) 10.11.12.13 is converted to 117.68.6.19 according to the SNAT flow table and returned to the client to ensure the connectivity of the service.
  • the SNAT flow table is as follows:
  • the load balancer 900 includes a direct routing module 901, which is configured to receive a client request message, and the client requests The packet includes a source IP address and a destination IP address.
  • the direct routing module 901 is further configured to determine a destination server according to a preset load balancing policy.
  • the direct routing module 901 is further configured to send an address resolution protocol ARP request packet according to the destination IP address.
  • the direct routing module 901 is further configured to obtain an address resolution protocol ARP response packet according to the ARP request packet, where the ARP response packet includes an initial media access control MAC address of the destination server, where the initial MAC address is different from the actual MAC address of the destination server.
  • a message address conversion module 902 for using an initial MAC address The address updates the destination IP address to obtain an updated client request message, and the updated client request message includes a source IP address and an updated destination IP address.
  • the load balancer according to the embodiment of the present invention can effectively implement data packet transmission in a large-scale cross-Vlan deployment, so that the source IP address of the client can be known at the physical layer, the network layer, and the like.
  • the direct routing module 901 is further configured to: obtain an initial MAC address according to an IP address of the destination server; and obtain an ARP response packet according to the initial MAC address.
  • the direct routing module 901 is further configured to: obtain an initial MAC address from the preset form according to the IP address of the server, where the preset form is used to store the correspondence between the IP address and the MAC address of the server.
  • the ARP response message is obtained according to the initial MAC address.
  • the direct routing module 901 is further configured to: convert an IP address of the destination server according to a preset algorithm to obtain an initial MAC address; and obtain an ARP response packet according to the initial MAC address.
  • the updated destination IP address is the same as the server's IP address. This message can be sent to the server correctly.
  • the load balancer 900 further includes a detection module 903, configured to detect the next hop mac address of the load balancer, and use the next hop mac address as the mac address of the updated message. This allows the message to be sent to the server correctly.
  • the content is based on the same concept as the method embodiment of the present invention.
  • the description in the method embodiment of the present invention and details are not described herein again.
  • the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本发明涉及一种基于服务器集群的报文生成方法和一种负载均衡器,接收客户端请求报文,所述客户端请求报文包括源IP地址和目的IP地址;根据预先设定的负载均衡策略确定目的服务器;根据所述目的IP地址发送地址解析协议ARP请求报文;根据所述ARP请求报文得到地址解析协议ARP响应报文,所述ARP响应报文包括所述目的服务器的初始介质访问控制MAC地址,其中,所述初始MAC地址与所述目的服务器的实际MAC地址不同;根据所述初始MAC地址更新所述目的IP地址,得到更新后的客户端请求报文,所述更新后的客户端请求报文包括所述源IP地址和更新后的目的IP地址。使用本发明,在报文的传输过程中,并不改变请求报文中的源IP地址,实现在网络层探测到客户端的源IP地址。

Description

一种基于服务器集群的报文生成方法和负载均衡器 技术领域
本发明基于负载均衡技术,具体涉及一种基于服务器集群的报文生成方法和一种用于服务器集群的负载均衡器。
背景技术
负载均衡(Load Balance,LB),其意思就是将任务分摊到多个操作单元上进行执行,例如Web服务器、FTP服务器、企业关键应用服务器和其它关键任务服务器等,从而共同完成工作任务。
集群是为了提高服务器的性能,将多个服务器组合在一起。
VLAN(Virtual Local Area Network)的中文名为″虚拟局域网″。虚拟局域网(VLAN)是一组逻辑上的设备和用户,这些设备和用户并不受物理位置的限制,可以根据功能、部门及应用等因素将它们组织起来,相互之间的通信就好像它们在同一个网段中一样,因此被称为虚拟局域网。
VLAN主要工作在OSI参考模型的第2层和第3层,一个VLAN就是一个广播域,VLAN之间的通信是通过第3层的路由器来完成的。
Linux虚拟服务器(Linux Virtual Server)。虚拟服务器的体系结构如图1所示,一组服务器通过高速的局域网或者地理分布的广域网相互连接,在它们的前端有一个负载均衡器(Load Balancer)。负载均衡器能无缝地将网络请求均衡到真实服务器上,从而使得服务器集群的结构对客户是透明的,客户访问集群系统提供的网络服务就像访问一台高性能、高可用的服务器一样。客户程序不受服务器集群的影响不需作任何修改。系统的伸缩性通过在服务机群中透明地加入和删除一个节点来达到,通过检测节点或服务进程故障和正确地重置系统达到高可用性。
一般来说,LVS集群采用三层结构,其主要组成部分为:A、负载均 衡器(load balancer),它是整个集群对外面的前端机,负责将客户的请求发送到一组服务器上执行,而客户认为服务是来自一个IP地址上的。B、服务器池(server pool),是一组真正执行客户请求的服务器,执行的服务有WEB、MAIL、FTP和DNS等。C、共享存储(shared storage),它为服务器池提供一个共享的存储区,这样很容易使得服务器池拥有相同的内容,提供相同的服务。
LVS集群采用IP负载均衡技术和基于内容请求分发技术。负载均衡器具有很好的吞吐率,将请求均衡地转移到不同的服务器上执行,且负载均衡器自动屏蔽掉服务器的故障,从而将一组服务器构成一个高性能的、高可用的虚拟服务器。
在已有的IP负载均衡技术中,主要有通过网络地址转换(Network Address Translation)将一组服务器构成一个高性能的、高可用的虚拟服务器,我们称之为VS/NAT(Virtual Server via Network Address Translation)技术,IP隧道实现虚拟服务器的VS/TUN(Virtual Server via IP Tunneling)技术,和通过直接路由实现虚拟服务器的VS/DR(Virtual Server via Direct Routing)技术,它们可以极大地提高系统的伸缩性。VS/NAT、VS/TUN和VS/DR技术是LVS集群中实现的三种IP负载均衡技术。
在四层负载均衡器中,如果后端业务主机要全透明感知客户端IP(网络中传输的IP就是客户端IP),目前互联网常用的技术是LVS DR和LVS NAT模式,但在跨Vlan的集群部署架构下,
DR模式需要负载均衡器和后端主机在同一个Vlan,而目前的大规模云化部署通常都跨Vlan的,这导致传统的DR模式无法应用与大规模跨Vlan集群部署中。
发明内容
本发明实施例提供了一种基于服务器集群的报文生成方法,所述方法包 括:得到客户端请求报文,所述客户端请求报文包括源IP地址和目的IP地址;
根据预先设定的负载均衡策略确定目的服务器;根据所述目的IP地址得到地址解析协议ARP请求报文;根据所述ARP请求报文得到地址解析协议ARP响应报文,所述ARP响应报文包括所述目的服务器的初始介质访问控制MAC地址,其中,所述初始MAC地址与所述目的服务器的实际MAC地址不同;根据所述初始MAC地址更新所述目的IP地址,得到更新后的客户端请求报文,所述更新后的客户端请求报文包括所述源IP地址和更新后的目的IP地址。根据本发明实施例的报文生成方法,可以在大规模跨Vlan部署中有效的实现数据报文的发送,从而可以在物理层、网络层等知道客户端的源IP地址。
在本发明一种可能的实现方式中,得到地址解析协议ARP响应报文包括:根据所述目的服务器的IP地址得到所述初始MAC地址;根据所述初始MAC地址得到所述ARP响应报文。通过构造初始MAC地址的形式,使报文可以正确的向网络发送,既可以保证业务的正常处理,又没有改变报文的源IP地址。无需修改任何服务端配置即可在网络层获取到源IP,使得可以在网络层做客户端行为分析、网络拦截等工作,大大提升了客户端体验。
在一种可能的实现方式中,根据所述服务器的IP地址从预设表单中得到所述初始MAC地址,其中,所述预设表单用以存储服务器的IP地址与MAC地址的对应关系。在一种可能的实现方式中,IP地址与mac地址之间存在一一对应的关系。
在一种可能的实现方式中,根据预设算法对所述目的服务器的IP地址进行转换,得到所述初始MAC地址。这种方式可以实时的构造mac地址,不需要预先存储流表,节省存储空间的同时也可以对ARP请求及时的响应。在处理多个请求时,通过实施构造mac地址的形式可以有效的对请求进行及时的处理,并保证业务的正常实现。
在一种可能的实现方式中,更新后的目的IP地址与所述服务器的IP地址相同。这样报文可以正确的发送到服务器。
本发明的实施例公开了一种用于服务器集群的负载均衡器,所述负载均衡器包括:直接路由模块,用于接收客户端请求报文,所述客户端请求报文包括源IP地址和目的IP地址;所述直接路由模块还用于根据预先设定的负载均衡策略确定目的服务器;所述直接路由模块还用于根据所述目的IP地址发送地址解析协议ARP请求报文;所述直接路由模块还用于根据所述ARP请求报文得到地址解析协议ARP响应报文,所述ARP响应报文包括所述目的服务器的初始介质访问控制MAC地址,其中,所述初始MAC地址与所述目的服务器的实际MAC地址不同;报文地址转换模块,用于根据所述初始MAC地址更新所述目的IP地址,得到更新后的客户端请求报文,所述更新后的客户端请求报文包括所述源IP地址和更新后的目的IP地址。根据本发明实施例的负载均衡器,可以在大规模跨Vlan部署中有效的实现数据报文的发送,从而可以在物理层、网络层等知道客户端的源IP地址。
在本发明的一种可能的实现方式中,所述直接路由模块还用于:根据所述目的服务器的IP地址得到所述初始MAC地址;根据所述初始MAC地址得到所述ARP响应报文。通过构造初始MAC地址的形式,使报文可以正确的向网络发送,既可以保证业务的正常处理,又没有改变报文的源IP地址。无需修改任何服务端配置即可在网络层获取到源IP,使得可以在网络层做客户端行为分析、网络拦截等工作,大大提升了客户端体验。
在一种可能的实现方式中,所述直接路由模块还用于:根据所述服务器的IP地址从预设表单中得到所述初始MAC地址,其中,所述预设表单用以存储服务器的IP地址与MAC地址的对应关系;根据所述初始MAC地址得到所述ARP响应报文。在一种可能的实现方式中,IP地址与mac地址之间存在一一对应的关系。
在一种可能的实现方式中,所述直接路由模块还用于:根据预设算法对 所述目的服务器的IP地址进行转换,得到所述初始MAC地址;根据所述初始MAC地址得到所述ARP响应报文。这种方式可以实时的构造mac地址,不需要预先存储流表,节省存储空间的同时也可以对ARP请求及时的响应。在处理多个请求时,通过实施构造mac地址的形式可以有效的对请求进行及时的处理,并保证业务的正常实现。
在一种可能的实现方式中,更新后的目的IP地址与所述服务器的IP地址相同。这样报文可以正确的发送到服务器。
在一种可能的实现方式中,负载均衡器还包括探测模块,用于探测负载均衡器的下一跳mac地址,将下一跳mac地址作为更新后报文的mac地址。从而使得报文可以正确向服务器发送。
本发明的另一方面的实施例了提供了一种负载均衡器,所述负载均衡器包括处理器和存储器,所述存储器存储有可执行的代码,所述处理器执行所述代码用于得到客户端请求报文,所述客户端请求报文包括源IP地址和目的IP地址;可执行代码还用于根据预先设定的负载均衡策略确定目的服务器;可执行代码还用于根据所述目的IP地址得到地址解析协议ARP请求报文;可执行代码还用于根据所述ARP请求报文得到地址解析协议ARP响应报文,所述ARP响应报文包括所述目的服务器的初始介质访问控制MAC地址,其中,所述初始MAC地址与所述目的服务器的实际MAC地址不同;可执行代码用于根据所述初始MAC地址更新所述目的IP地址,得到更新后的客户端请求报文,所述更新后的客户端请求报文包括所述源IP地址和更新后的目的IP地址。根据本发明实施例的负载均衡器,可以在大规模跨Vlan部署中有效的实现数据报文的发送,从而可以在物理层、网络层等知道客户端的源IP地址。
在本发明的一种可能的实现方式中,处理器执行所述代码用于:根据所述目的服务器的IP地址得到所述初始MAC地址;根据所述初始MAC地址得到所述ARP响应报文。通过构造初始MAC地址的形式,使报文可以正确 的向网络发送,既可以保证业务的正常处理,又没有改变报文的源IP地址。无需修改任何服务端配置即可在网络层获取到源IP,使得可以在网络层做客户端行为分析、网络拦截等工作,大大提升了客户端体验。
在一种可能的实现方式中,处理器执行所述代码用于:根据所述服务器的IP地址从预设表单中得到所述初始MAC地址,其中,所述预设表单用以存储服务器的IP地址与MAC地址的对应关系;根据所述初始MAC地址得到所述ARP响应报文。在一种可能的实现方式中,IP地址与mac地址之间存在一一对应的关系。
在一种可能的实现方式中,处理器执行所述代码用于:根据预设算法对所述目的服务器的IP地址进行转换,得到所述初始MAC地址;根据所述初始MAC地址得到所述ARP响应报文。这种方式可以实时的构造mac地址,不需要预先存储流表,节省存储空间的同时也可以对ARP请求及时的响应。在处理多个请求时,通过实施构造mac地址的形式可以有效的对请求进行及时的处理,并保证业务的正常实现。
在一种可能的实现方式中,更新后的目的IP地址与所述服务器的IP地址相同。这样报文可以正确的发送到服务器。
在一种可能的实现方式中,处理器执行所述代码用于探测负载均衡器的下一跳mac地址,将下一跳mac地址作为更新后报文的mac地址。从而使得报文可以正确向服务器发送。
附图说明
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为虚拟服务器的体系结构示意图。
图2为直接路由实现虚拟服务器技术的体系结构示意图。
图3为直接路由实现虚拟服务器技术的工作流程示意图。
图4为大规模跨虚拟局域网集群下负载均衡器的部署示意图。
图5为本发明实施例的基于服务器集群的报文请求和报文响应的流程示意图。
图6为述本发明实施例的基于服务器集群的报文生成,发送和响应的实现方式示意图。
图7为本发明实施例的地址解析协议代理应答流程的处理流程示意图。
图8为本发明实施例的基于学习流表的处理流程图。
图9为本发明实施例的一种用于服务器集群的负载均衡器的结构示意图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
下面结合图2和图3简要介绍下直接路由实现虚拟服务器VS/DR(Virtual Server via Direct Routing)技术,VS/DR利用大多数Internet服务的非对称特点,负载均衡器中只负责均衡请求,而服务器直接将响应返回给客户,可以极大地提高整个集群系统的吞吐量。
VS/DR的体系结构如图2所示:负载均衡器和服务器组都必须在物理上有一个网卡通过不分段的局域网相连,如通过高速的交换机或者HUB相连。VIP(虚拟IP)地址为负载均衡器和服务器组共享,负载均衡器配置的VIP地址是对外可见的,用于接收虚拟服务的请求报文;所有的服务器把VIP地址配置在各自的Non-ARP(Address Resolution Protocol,地址解析协议)网 络设备上,它对外面是不可见的,只是用于处理目标地址为VIP的网络请求。
VS/DR的工作流程如图3所示:VS/DR将报文直接路由给目标服务器。在VS/DR中,负载均衡器根据各个服务器的负载情况,动态地选择一台服务器,不修改也不封装IP报文,而是将数据帧的MAC(MediaAccess Control,介质访问控制)地址改为选出服务器的MAC地址,再将修改后的数据帧在服务器组的局域网上发送。因为数据帧的MAC地址是选出的服务器,所以服务器肯定可以收到这个数据帧,从中可以获得该IP报文。当服务器发现报文的目标地址是在本地的网络设备上,服务器处理这个报文,然后根据路由表将响应报文直接返回给客户。
在VS/DR的一种实现方式中,根据缺省的TCP/IP协议栈处理,请求报文的目标地址为VIP(Virtual IP,虚拟IP),响应报文的源地址肯定也为VIP,所以响应报文不需要作任何修改,可以直接返回给客户,客户认为得到正常的服务,而不会知道是哪一台服务器处理的。
DR(Direct Routing,直接路由)模式需要负载均衡器和后端主机在同一个Vlan,而目前的大规模云化部署通常都跨Vlan(Virtual Local Area Network,虚拟局域网)的,这导致传统的DR模式无法应用与大规模跨Vlan集群部署中。而本发明的实施例提供了一种基于DR技术的报文发送方法,可以在大规模跨Vlan部署中有效的实现数据报文的发送,从而可以在物理层、网络层等知道客户端的源IP地址。
图4是大规模跨Vlan集群下LB(Load Banlancer,负载均衡器)的部署示意图。如图4所示,客户端user通过互联网接入服务器集群,从而得到多种服务,这种部署可以是公用云或私有云的形式。LB是在整个集群对外面的前端机,负责将客户的请求发送到一组服务器上执行。服务器组运行多个的VM(Virtual Machine,虚拟机),这些VM可以具体的处理各种业务请求。
图5公开了本发明实施例的基于服务器集群的报文请求和报文响应的流程示意图。
如图5所示,对于终端发送的请求报文,交换机通过等价路由将报文送到LVS(Linux Virtual Server,Linux虚拟服务器)集群上,配合流表管理,将目的IP修改为后端主机IP,使得报文可以跨Vlan传输到后端服务器;而在这一过程中,并不改变请求报文中的源IP地址,这样可以实现在网络层探测到客户端的源IP地址。
对于针对请求报文发出的响应报文,需要做SNAT(source network address translation,源网络地址转换),将响应报文的源IP改为公网IP(即请求报文中的目的IP),SNAT模块可部署在VM对应的计算节点上。这样客户端收到的响应报文的源IP地址与请求报文中的目的IP地址一致,客户端发出的请求得到了正确的响应。
下面结合图6-图8详细描述本发明实施例的基于服务器集群的报文生成,发送和响应的具体实现方式。
如图6所示,客户端的IP地址为200.1.1.19,客户端可以是笔记本电脑,台式电脑,手机,平板电脑或者其它网络接入设备。客户端需要请求公网IP地址为117.78.6.19的服务,则请求报文的源IP地址为200.1.1.19,目的IP地址为117.78.6.19。
在一种可能的实现方式中,客户端可以先发出访问域名的请求,如访问www.huawei.com等,DNS(Domain Name System,域名系统)服务器完成对该域名的解析后,服务器将该域名对应的公网IP地址发送给客户端。
该请求报文经过路由器转发后,位于LVS集群最前端的负载均衡器接收到该报文,对该报文进行一系列的处理。
负载均衡器在收到该请求报文后,根据负载均衡调度算法从服务器集群中选择服务器来响应该请求。例如,服务器1,对应IP地址为10.11.12.11;服务器2,对应IP地址为10.11.12.12;服务器3,对应IP地址为10.11.12.13等。在本示例中,选择的是服务器3,对应IP地址为10.11.12.13。
具体的根据负载均衡调度算法从服务器集群中选择服务器的方式可参考 现有技术中揭示的各种负载均衡调度算法,本发明实施例仅对此做简要介绍。负载调度器上的负载调度策略和算法主要包括在内核中所实现的动态反馈负载均衡算法两方面。其中,动态反馈负载均衡算法主要是结合内核中的加权连接调度算法,根据动态反馈回来的负载信息来调整服务器的权值,来进一步避免服务器间的负载不平衡。在内核中的连接调度算法上,主要包括轮叫调度(Round-Robin Scheduling)、加权轮叫调度(Weighted Round-Robin Scheduling)、最小连接调度(Least-Connection Scheduling)、加权最小连接调度(Weighted Least-Connection Scheduling)、基于局部性的最少链接(Locality-Based Least Connections Scheduling)、带复制的基于局部性最少链接(Locality-Based Least Connections with Replication Scheduling)、目标地址散列调度(Destination Hashing Scheduling)、源地址散列调度(Source Hashing Scheduling)等方式。动态反馈负载均衡算法考虑服务器的实时负载和响应情况,不断调整服务器间处理请求的比例,来避免有些服务器超载时依然收到大量请求,从而提高整个系统的吞吐率,主要包括连接调度、动态反馈负载均衡机制、综合负载和权值计算等方面。
在本发明的一种实施例中,负载均衡器里保存有三张流表,负载均衡器可以根据流表执行不同的功能。
1、ARP代理应答流表:
负载均衡器在接收ARP报文后,可以根据ARP代理应答流表构造一个MAC地址,使得后续报文可发出网络。
22、地址转换流表:
负载均衡器可以根据地址转换流表修改报文的目的mac和目的IP,使得报文可跨VLAN分发。
3、学习流表:
负载均衡器探测的下一跳mac地址,并存入地址转换流表中。
在本发明的一种实现方式中,负载均衡器通过配置出口网关IP,周期性 发送ARP广播探测,通过和网关IP比对获取网络下一跳mac地址,并存入地址转换流表中。
在本发明的一个示例中,在负载均衡器确定了由服务器3响应该请求报文后,LVS DR模块发出ARP报文,询问对应的MAC地址。该ARP报文并未实际向网络发送,而是被负载均衡器在内部进行拦截并处理。
下面结合图7描述本发明实施例的ARP代理应答流程的处理流程示意图。如图7所示,ARP代理应答流表首先接收ARP报文,从ARP报文中解析出相应的IP地址(例如,10.11.12.13),然后根据预设的规则生成一个假的MAC地址进行欺诈。需要说明的是,此处的假的mac地址是指与服务器3的实际物理mac地址不一致。进行欺诈指的是使得LVS DR模块根据接收到的ARP响应报文,向响应报文中的mac地址发送请求报文。负载均衡器通过构造假的MAC地址的形式,使报文可以正确的向网络发送,既可以保证业务的正常处理,又没有改变报文的源IP地址。无需修改任何服务端配置即可在网络层获取到源IP,使得可以在网络层做客户端行为分析、网络拦截等工作,大大提升了客户端体验。
在本发明的一种实现方式中,通过预设的规则得到IP地址对应的mac地址,例如在IP地址的字段前增加2个字段或者在IP地址的字段后增加两个字段。
例1:IP地址为10.11.12.13,则构造后的MAC地址为aa.bb.10.11.12.13。
例2:IP地址为10.11.12.13,则构造后的MAC地址为10.11.12.13.aa.bb。
例3:IP地址为10.11.12.13,则构造后的MAC地址为10.11.aa.12.13.bb。
这种方式可以实时的构造mac地址,不需要预先存储流表,节省存储空间的同时也可以对ARP请求及时的响应。在处理多个请求时,通过实施构造mac地址的形式可以有效的对请求进行及时的处理,并保证业务的正常实现。
在本发明的一种实现方式中,通过查表的方式得到IP地址对应的mac地址,IP地址与mac地址之间存在一一对应的关系。
LVS DR模块接收ARP报文后,将ARP报文中的mac地址与客户端的请求报文封装在一起。此时的报文的目的mac地址为ARP代理应答流表构造的mac地址,源IP地址与目的IP地址与客户端请求报文相同。
在本发明的一种实施例中,对于来自同一请求的后续报文,LVS DR模块将报文的mac地址直接判断为上述得到的mac地址,根据上述mac地址进行封装得到封装后的报文。
对于封装后的报文,并未实际向网络发送,而是被负载均衡器在内部进行拦截。
在本发明的一种实现方式中,地址转换流表截获报文,获取当前报文的目的mac为aa.bb.10.11.12.13,根据流表规则,计算出目的IP地址为10.11.12.13,同时结合从学习流表中获取到的下一跳mac aa.bb.cc.dd.ee.ff,将当前报文的目的IP和mac进行转换:
目的IP转换:117.78.6.19→10.11.12.13;
目的mac转换:aa.bb.10.11.12.13->aa.bb.cc.dd.ee.ff。
这样mac转换使得报文可发送到网络中下一跳,而IP转换使得报文可跨Vlan分发(10.11.12.13是一个内网IP,路由可达)。
在本发明的一种实现方式中,地址转换流表也可以通过查表的方式得到与目的mac对应的IP地址,IP地址与mac地址之间存在一一对应的关系。
下面结合图8描述本发明实施例的负载均衡器的处理流程图。如图8所示,通过GARP(Generic Attribute Registration Protocol,通用属性注册协议)获得下一跳的mac地址。可以按照预定时间间隔或者根据请求触发的形式对网络情况进行探测;然后接收GARP报文,通过解析GARP报文得出下一跳的MAC地址,然后将下一跳的MAC地址存入地址转换流表。
服务器在收到客户端请求报文后,根据请求报文生成响应报文,响应报文的源IP地址为服务器的IP地址,目的地址为客户端的IP地址。在经过地 址转换协议转换之后,将响应报文的源IP地址改为请求报文所请求访问的公网IP地址。然后将转换后的响应报文根据客户端的IP地址直接发送给客户端。
在本发明的一个实现方式中,地址转换模块可以部署在计算节点calculate node上。
在本发明的一个实现方式中,vip(虚拟IP)和vm(virtual mchine,虚拟机)IP的对应关系是可以在建立LB的时候保存在SNAT流表里。
在请求处理过程中,目的IP已经转换为了内网的虚拟IP,10.11.12.13,当vm(virtual machine,虚拟机)返回报文时,源IP为10.11.12.13,而internet客户端最初访问的IP是vip 117.68.6.19,此时根据SNAT流表将源IP(VM IP)10.11.12.13转换为117.68.6.19返回给客户端,保证业务的连通性。
在一个示例中,SNAT流表如下:
VIP VMIP
117.78.6.19 10.11.12.13
117.78.6.19 10.11.12.14
117.78.6.19 10.11.12.15
…… ……
下面结合图9描述本发明实施例的一种用于服务器集群的负载均衡器900,如图9所示,负载均衡器900包括直接路由模块901,用于接收客户端请求报文,客户端请求报文包括源IP地址和目的IP地址;直接路由模块901还用于根据预先设定的负载均衡策略确定目的服务器;直接路由模块901还用于根据目的IP地址发送地址解析协议ARP请求报文;直接路由模块901还用于根据ARP请求报文得到地址解析协议ARP响应报文,ARP响应报文包括目的服务器的初始介质访问控制MAC地址,其中,初始MAC地址与目的服务器的实际MAC地址不同;报文地址转换模块902,用于根据初始MAC 地址更新所述目的IP地址,得到更新后的客户端请求报文,更新后的客户端请求报文包括源IP地址和更新后的目的IP地址。根据本发明实施例的负载均衡器,可以在大规模跨Vlan部署中有效的实现数据报文的发送,从而可以在物理层、网络层等知道客户端的源IP地址。
在本发明的一种可能的实现方式中,直接路由模块901还用于:根据目的服务器的IP地址得到初始MAC地址;根据初始MAC地址得到ARP响应报文。在一种可能的实现方式中,直接路由模块901还用于:根据服务器的IP地址从预设表单中得到初始MAC地址,其中,预设表单用以存储服务器的IP地址与MAC地址的对应关系;根据初始MAC地址得到所述ARP响应报文。在一种可能的实现方式中,IP地址与mac地址之间存在一一对应的关系。
在一种可能的实现方式中,直接路由模块901还用于:根据预设算法对目的服务器的IP地址进行转换,得到初始MAC地址;根据初始MAC地址得到ARP响应报文。在一种可能的实现方式中,更新后的目的IP地址与服务器的IP地址相同。这样报文可以正确的发送到服务器。
在一种可能的实现方式中,负载均衡器900还包括探测模块903,用于探测负载均衡器的下一跳mac地址,将下一跳mac地址作为更新后报文的mac地址。从而使得报文可以正确向服务器发送。
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本发明并不受所描述的动作顺序的限制,因为依据本发明,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本发明所必须的。
上述装置和系统内的各模块之间的信息交互、执行过程等内容,由于与本发明方法实施例基于同一构思,具体内容可参见本发明方法实施例中的叙述,此处不再赘述。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,上述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,上述的存储介质可为磁碟、光盘、只读存储记忆体(ROM:Read-Only Memory)或随机存储记忆体(RAM:Random Access Memory)等。

Claims (9)

  1. 一种基于服务器集群的报文生成方法,其特征在于,所述方法包括:
    得到客户端请求报文,所述客户端请求报文包括源IP地址和目的IP地址;
    根据预先设定的负载均衡策略确定目的服务器;
    根据所述目的IP地址得到地址解析协议ARP请求报文;
    根据所述ARP请求报文得到地址解析协议ARP响应报文,所述ARP响应报文包括所述目的服务器的初始介质访问控制MAC地址,其中,所述初始MAC地址与所述目的服务器的实际MAC地址不同;
    根据所述初始MAC地址更新所述目的IP地址,得到更新后的客户端请求报文,所述更新后的客户端请求报文包括所述源IP地址和更新后的目的IP地址。
  2. 根据权利要求1所述的报文生成方法,其特征在于,所述得到地址解析协议ARP响应报文包括:
    根据所述目的服务器的IP地址得到所述初始MAC地址;
    根据所述初始MAC地址得到所述ARP响应报文。
  3. 根据权利要求2所述的报文生成方法,其特征在于,所述根据所述目的服务器的IP地址得到所述初始MAC地址,包括:
    根据所述服务器的IP地址从预设表单中得到所述初始MAC地址,其中,所述预设表单用以存储服务器的IP地址与MAC地址的对应关系。
  4. 根据权利要求2所述的报文生成方法,其特征在于,所述根据所述目的服务器的IP地址得到所述初始MAC地址,包括:
    根据预设算法对所述目的服务器的IP地址进行转换,得到所述初始MAC地址。
  5. 根据权利要求1-4任意之一所述的报文生成方法,其特征在于,所述更新后的目的IP地址与所述服务器的IP地址相同。
  6. 一种用于服务器集群的负载均衡器,其特征在于,所述负载均衡器包括:
    直接路由模块,用于得到客户端请求报文,所述客户端请求报文包括源IP地址和目的IP地址;
    所述直接路由模块还用于根据预先设定的负载均衡策略确定目的服务器;
    所述直接路由模块还用于根据所述目的IP地址得到地址解析协议ARP请求报文;
    所述直接路由模块还用于根据所述ARP请求报文得到地址解析协议ARP响应报文,所述ARP响应报文包括所述目的服务器的初始介质访问控制MAC地址,其中,所述初始MAC地址与所述目的服务器的实际MAC地址不同;
    报文地址转换模块,用于根据所述初始MAC地址更新所述目的IP地址,得到更新后的客户端请求报文,所述更新后的客户端请求报文包括所述源IP地址和更新后的目的IP地址。
  7. 根据权利要求6所述的负载均衡器,其特征在于,所述直接路由模块用于:
    根据所述目的服务器的IP地址得到所述初始MAC地址;
    根据所述初始MAC地址得到所述ARP响应报文。
  8. 根据权利要求6所述的负载均衡器,其特征在于,所述直接路由模块还用于:
    根据所述服务器的IP地址从预设表单中得到所述初始MAC地址,其中,所述预设表单用以存储服务器的IP地址与MAC地址的对应关系;
    根据所述初始MAC地址得到所述ARP响应报文。
  9. 根据权利要求6所述的负载均衡器,其特征在于,所述直接路由模块还用于:
    根据预设算法对所述目的服务器的IP地址进行转换,得到所述初始MAC地址;
    根据所述初始MAC地址得到所述ARP响应报文。
PCT/CN2016/105230 2016-02-02 2016-11-09 一种基于服务器集群的报文生成方法和负载均衡器 WO2017133291A1 (zh)

Priority Applications (3)

Application Number Priority Date Filing Date Title
EP16889098.6A EP3402151B1 (en) 2016-02-02 2016-11-09 Server cluster-based message generation method and load balancer
KR1020187024414A KR102138619B1 (ko) 2016-02-02 2016-11-09 서버 클러스터에 기초한 메시지 생성 방법 및 부하 균형기
US16/052,923 US10911398B2 (en) 2016-02-02 2018-08-02 Packet generation method based on server cluster and load balancer

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
CN201610072967 2016-02-02
CN201610072967.X 2016-02-02
CN201610944661.9 2016-11-02
CN201610944661.9A CN107026890B (zh) 2016-02-02 2016-11-02 一种基于服务器集群的报文生成方法和负载均衡器

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US16/052,923 Continuation US10911398B2 (en) 2016-02-02 2018-08-02 Packet generation method based on server cluster and load balancer

Publications (1)

Publication Number Publication Date
WO2017133291A1 true WO2017133291A1 (zh) 2017-08-10

Family

ID=59499294

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/105230 WO2017133291A1 (zh) 2016-02-02 2016-11-09 一种基于服务器集群的报文生成方法和负载均衡器

Country Status (1)

Country Link
WO (1) WO2017133291A1 (zh)

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111212134A (zh) * 2019-12-31 2020-05-29 北京金山云网络技术有限公司 一种请求报文处理方法、装置、边缘计算系统和电子设备
CN111327647A (zh) * 2018-12-13 2020-06-23 北京金山云网络技术有限公司 一种容器对外提供服务的方法、装置及电子设备
CN111818151A (zh) * 2020-07-03 2020-10-23 紫光云技术有限公司 基于ip隧道实现负载均衡器透传客户端ip的方法
CN111970362A (zh) * 2020-08-17 2020-11-20 上海势航网络科技有限公司 基于lvs的车联网网关集群方法及系统
CN112015544A (zh) * 2020-06-30 2020-12-01 苏州浪潮智能科技有限公司 一种k8s集群的负载均衡方法、装置、设备及存储介质
CN113141400A (zh) * 2021-04-14 2021-07-20 网宿科技股份有限公司 一种网络服务的访问方法及装置
CN113709054A (zh) * 2021-07-16 2021-11-26 济南浪潮数据技术有限公司 一种基于keepalived的LVS系统部署调节方法、装置及系统
CN114205360A (zh) * 2021-12-08 2022-03-18 京东科技信息技术有限公司 数据传输方法、装置及系统
CN114629820A (zh) * 2022-03-25 2022-06-14 阿里巴巴(中国)有限公司 网络连通性检测方法、装置、设备及介质
CN114697338A (zh) * 2020-12-28 2022-07-01 北京金山云网络技术有限公司 云计算的数据传输方法、装置以及服务端设备
CN114827078A (zh) * 2022-04-01 2022-07-29 阿里云计算有限公司 节点访问方法以及数据传输系统
CN117041130A (zh) * 2023-08-24 2023-11-10 宸芯科技股份有限公司 路由恢复方法及装置、接入节点、星型网络及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101296238A (zh) * 2008-06-17 2008-10-29 杭州华三通信技术有限公司 一种保持安全套接层会话持续性的方法及设备
CN103023942A (zh) * 2011-09-27 2013-04-03 奇智软件(北京)有限公司 一种服务器负载均衡方法、装置及系统
CN103384255A (zh) * 2011-12-31 2013-11-06 华为数字技术(成都)有限公司 虚拟机集群的负载均衡方法、服务器及系统
US9141625B1 (en) * 2010-06-22 2015-09-22 F5 Networks, Inc. Methods for preserving flow state during virtual machine migration and devices thereof

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101296238A (zh) * 2008-06-17 2008-10-29 杭州华三通信技术有限公司 一种保持安全套接层会话持续性的方法及设备
US9141625B1 (en) * 2010-06-22 2015-09-22 F5 Networks, Inc. Methods for preserving flow state during virtual machine migration and devices thereof
CN103023942A (zh) * 2011-09-27 2013-04-03 奇智软件(北京)有限公司 一种服务器负载均衡方法、装置及系统
CN103384255A (zh) * 2011-12-31 2013-11-06 华为数字技术(成都)有限公司 虚拟机集群的负载均衡方法、服务器及系统

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111327647A (zh) * 2018-12-13 2020-06-23 北京金山云网络技术有限公司 一种容器对外提供服务的方法、装置及电子设备
CN111212134A (zh) * 2019-12-31 2020-05-29 北京金山云网络技术有限公司 一种请求报文处理方法、装置、边缘计算系统和电子设备
CN112015544A (zh) * 2020-06-30 2020-12-01 苏州浪潮智能科技有限公司 一种k8s集群的负载均衡方法、装置、设备及存储介质
CN111818151A (zh) * 2020-07-03 2020-10-23 紫光云技术有限公司 基于ip隧道实现负载均衡器透传客户端ip的方法
CN111970362B (zh) * 2020-08-17 2023-09-15 上海势航网络科技有限公司 基于lvs的车联网网关集群方法及系统
CN111970362A (zh) * 2020-08-17 2020-11-20 上海势航网络科技有限公司 基于lvs的车联网网关集群方法及系统
CN114697338A (zh) * 2020-12-28 2022-07-01 北京金山云网络技术有限公司 云计算的数据传输方法、装置以及服务端设备
CN113141400A (zh) * 2021-04-14 2021-07-20 网宿科技股份有限公司 一种网络服务的访问方法及装置
CN113141400B (zh) * 2021-04-14 2023-04-07 网宿科技股份有限公司 一种网络服务的访问方法及装置
CN113709054A (zh) * 2021-07-16 2021-11-26 济南浪潮数据技术有限公司 一种基于keepalived的LVS系统部署调节方法、装置及系统
CN114205360A (zh) * 2021-12-08 2022-03-18 京东科技信息技术有限公司 数据传输方法、装置及系统
CN114205360B (zh) * 2021-12-08 2024-04-16 京东科技信息技术有限公司 数据传输方法、装置及系统
CN114629820A (zh) * 2022-03-25 2022-06-14 阿里巴巴(中国)有限公司 网络连通性检测方法、装置、设备及介质
CN114629820B (zh) * 2022-03-25 2023-09-12 阿里巴巴(中国)有限公司 网络连通性检测方法、装置、设备及介质
CN114827078A (zh) * 2022-04-01 2022-07-29 阿里云计算有限公司 节点访问方法以及数据传输系统
CN117041130A (zh) * 2023-08-24 2023-11-10 宸芯科技股份有限公司 路由恢复方法及装置、接入节点、星型网络及存储介质
CN117041130B (zh) * 2023-08-24 2024-04-30 宸芯科技股份有限公司 路由恢复方法及装置、接入节点、星型网络及存储介质

Similar Documents

Publication Publication Date Title
US10911398B2 (en) Packet generation method based on server cluster and load balancer
WO2017133291A1 (zh) 一种基于服务器集群的报文生成方法和负载均衡器
US20220206908A1 (en) Techniques for replicating state information for high availability
CN109937401B (zh) 经由业务旁路进行的负载均衡虚拟机的实时迁移
US9548965B2 (en) Proxy methods for suppressing broadcast traffic in a network
JP2022517199A (ja) シームレスなマルチクラウドルーティングおよびポリシーの相互接続
US11005805B2 (en) Managing link aggregation traffic in edge nodes
CN105577723B (zh) 虚拟化网络中实现负载分担的方法和装置
CN116235482A (zh) 虚拟层2网络
US9992153B2 (en) Managing link aggregation traffic in edge nodes
US11895030B2 (en) Scalable overlay multicast routing
US20230370421A1 (en) Scaling ip addresses in overlay networks
US11362863B2 (en) Handling packets travelling from logical service routers (SRs) for active-active stateful service insertion
US10924397B2 (en) Multi-VRF and multi-service insertion on edge gateway virtual machines
EP4292262A1 (en) Cloud infrastructure resources for connecting a service provider private network to a customer private network
US10931565B2 (en) Multi-VRF and multi-service insertion on edge gateway virtual machines
CN116711270A (zh) 虚拟化的云环境中的层2联网信息
CN117597894A (zh) 用于图形处理单元的路由策略
CN116648892A (zh) 虚拟化云环境中的层2联网风暴控制
CN117561705A (zh) 用于图形处理单元的路由策略

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16889098

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

WWE Wipo information: entry into national phase

Ref document number: 2016889098

Country of ref document: EP

ENP Entry into the national phase

Ref document number: 2016889098

Country of ref document: EP

Effective date: 20180807

ENP Entry into the national phase

Ref document number: 20187024414

Country of ref document: KR

Kind code of ref document: A

WWE Wipo information: entry into national phase

Ref document number: 1020187024414

Country of ref document: KR