CN105847143B - Load balancing method and system based on VRRP - Google Patents
Load balancing method and system based on VRRP Download PDFInfo
- Publication number
- CN105847143B CN105847143B CN201610393276.XA CN201610393276A CN105847143B CN 105847143 B CN105847143 B CN 105847143B CN 201610393276 A CN201610393276 A CN 201610393276A CN 105847143 B CN105847143 B CN 105847143B
- Authority
- CN
- China
- Prior art keywords
- host
- standby
- physical address
- equipment
- address
- Prior art date
- Legal status (The legal status 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 status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L45/00—Routing or path finding of packets in data switching networks
- H04L45/22—Alternate routing
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L45/00—Routing or path finding of packets in data switching networks
- H04L45/74—Address processing for routing
- H04L45/745—Address table lookup; Address filtering
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/10—Flow control; Congestion control
- H04L47/12—Avoiding congestion; Recovering from congestion
- H04L47/125—Avoiding congestion; Recovering from congestion by balancing the load, e.g. traffic engineering
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention relates to the technical field of computer networks, in particular to a load balancing method and system based on VRRP. The system comprises a main device, at least one standby device and at least one host, wherein the main device and the at least one standby device have the same virtual physical address and virtual IP address; the main device is used for collecting the physical address corresponding to each host and writing the physical address into the address information table; the system is also used for distributing part or all physical addresses in the address information table to different standby equipment to finish load balancing distribution; and the standby equipment is used for processing the data packet sent by the host corresponding to the allocated physical address after receiving the physical address allocated by the main equipment. The method and the system provided by the embodiment of the invention can realize load balancing, all the hosts only need to be configured with the same gateway, the configuration is simple, the functions of starting ARP protection or binding and the like of the hosts are not influenced, and the method and the system can also work normally in some devices which can not process free ARP.
Description
Technical Field
The invention relates to the technical field of computer networks, in particular to a load balancing method and system based on VRRP.
Background
In a standard Protocol mode of a Virtual Router Redundancy Protocol (VRRP), only a Master (usually a Router) may forward a message, and a Backup (Backup) is in a monitoring state and cannot forward the message. Although creating multiple backup groups can achieve load sharing among multiple routers, HOSTs (HOSTs) in the local area network need to set up different gateways, increasing the complexity of configuration.
The VRRP load balancing mode (VRRPE for short) is characterized in that a load balancing function is added on the basis of a virtual gateway redundancy Backup function, and message forwarding of Master and Backup routers in the same Backup group is realized. However, in the current VRRP load balancing mode, a host cannot start an Address Resolution Protocol (ARP) binding or protection function, and a VRRP failure is caused in some device environments that do not process a gratuitous ARP.
Disclosure of Invention
The invention aims to overcome the defects in the prior art and provides a load balancing method and system based on VRRP.
In order to achieve the above object, the embodiments of the present invention provide the following technical solutions:
a VRRP-based load balancing system comprises a main device, at least one standby device and at least one host, wherein the main device and the at least one standby device have the same virtual physical address and virtual IP address;
the main device is used for collecting a physical address corresponding to each host in the at least one host and writing the physical address corresponding to each host into an address information table; the system is also used for distributing part or all physical addresses in the address information table to different standby equipment to finish load balancing distribution;
and the standby equipment is used for processing the data packet sent by the host corresponding to the allocated physical address after receiving the physical address allocated by the main equipment.
The embodiment of the invention also provides a load balancing method based on VRRP, which is applied to a load balancing system based on VRRP, the system comprises a main device, at least one standby device and at least one host, the main device and the at least one standby device have the same virtual physical address and virtual IP address, and the method comprises the following steps:
the main equipment collects the physical address corresponding to each host in the at least one host and writes the physical address corresponding to each host into an address information table;
and the main equipment distributes part or all physical addresses in the address information table to different standby equipment to finish load balancing distribution.
Compared with the prior art, the invention has the beneficial effects that: in the load balancing method and system based on the VRRP, the main device and the at least one standby device have the same virtual physical address and virtual IP address, so that the host can obtain the physical addresses of all the standby devices when inquiring the main device for the first time, and the main device does not need to inform the physical addresses of all the standby devices again, i.e. the arp table of the host does not need to be refreshed by arp, so that the load balancing function can normally operate even if the host starts the function of preventing the arp from being refreshed or does not support the host receiving free arp.
Description of the drawings:
fig. 1 is a schematic structural diagram of a load balancing system based on VRRP according to an embodiment of the present invention.
Fig. 2 is a flowchart of a load balancing method based on VRRP according to an embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to test examples and specific embodiments. It should be understood that the scope of the above-described subject matter of the present invention is not limited to the following examples, and any technique realized based on the contents of the present invention is within the scope of the present invention.
Referring to fig. 1, a load balancing system based on VRRP according to an embodiment of the present invention includes a main device, at least one standby device, and at least one host, where the main device and the at least one standby device have the same virtual physical address and virtual IP address.
As shown in fig. 1, in the load balancing system based on VRRP according to the embodiment of the present invention, both the primary device and the standby device are routers, Router a is the primary device, and Router B and Router C are the standby devices. In Router a, Router B and Router C, who is the Master device and who is the standby device, the election mode is the same as the VRRP standard mode, that is, the Master of the standard VRRP (rfc 2338) elects to be the Master according to the priority and with the higher priority, and if the priorities are the same, the Master is the real IP, and if the real IP is the higher, the Master is the Master. The number of the standby devices may be at least one, and in this embodiment, only two standby devices are taken as an example for illustration. And 192.168.0.1 is taken as a gateway, and the gateway corresponds to a physical address (MAC) 00-00-5e-00-01-01, so that the virtual IP addresses of the Router A, the Router B and the Router C are 192.168.0.1, and the virtual physical addresses of the Router A, the Router B and the Router C are 00-00-5 e-00-01-01. The system provided by the embodiment of the invention is provided with four hosts, and the MAC addresses corresponding to the four hosts are respectively as follows: 08-00-27-76-8 f-61, 08-00-27-76-8 f-62, 08-00-27-76-8 f-63, 08-00-27-76-8 f-64.
The HOST device collects (real) physical addresses corresponding to each HOST of the at least one HOST, and writes the physical addresses corresponding to each HOST into an address information table (HOST pool shown in fig. 1), that is, in this embodiment, Router a collects MAC addresses corresponding to four HOSTs (HOST 1, HOST2, HOST3, and HOST 4): 08-00-27-76-8 f-61, 08-00-27-76-8 f-62, 08-00-27-76-8 f-63 and 08-00-27-76-8 f-64, and the four MAC addresses are written into the HOST pool. During specific implementation, the four hosts can respectively send ARP requests to Router A, and the ARP requests comprise MAC addresses; when the host replies the ARP request, the virtual MAC address of the host is informed to the four hosts. Since the virtual MAC addresses of Router B and Router C are the same as Router a, the four hosts also obtain the virtual MAC addresses of all the standby devices correspondingly. When the host sends a packet through Router a, Router a may also obtain the MAC address of the host from the packet. All ARP requests of the host are processed by the master device and the standby device does not reply.
Different from the traditional VRRP load balancing mode: the MAC addresses of the standby devices are different, and after the main device acquires the MAC addresses of all the standby devices, the ARP table of the host needs to be refreshed to inform the host of the MAC addresses of the standby devices, so that the host is required not to start an ARP firewall or an ARP binding function.
The invention creatively adopts the main device and all the standby devices to virtualize the same MAC address, and the main device does not need to refresh the ARP table of the host, so that the host only needs to configure the same gateway, the configuration is simple, the host is not influenced to start the ARP firewall or the ARP binding function, and the device can normally work even in some devices which can not process the free ARP in time.
After collecting the physical addresses of all the hosts, the main device allocates part or all of the physical addresses in the address information table to each standby device to complete load balancing allocation, i.e. the standby device serves part or all of the hosts to process data packets sent by the hosts.
It should be noted that the load balancing referred to in this embodiment does not mean that the main device and each backup device are equally allocated to the host (even when the number of the main devices is inconsistent with the total number of the backup devices and the main device, even allocation cannot be achieved), but means that the main device and the backup device in the same backup group both process the data packets sent by the main device, instead of being processed only by the main device, and the backup device is only in the listening state.
When allocating physical addresses to the standby devices, the main device may directly allocate the physical addresses, or may allocate the physical addresses according to resource status information sent by the standby devices. If the allocation is based on the resource status information of the standby device, the standby device will send its own resource status information to the primary device in advance. The resource status information may include information of the load bearing capacity of the standby devices, such as broadband, CPU, running memory, and the number of allocated hosts, so that the main device allocates physical addresses according to the load bearing capacity of each standby device.
The master device may allocate all physical addresses in the address information table to different standby devices (for example, in the case that the number of hosts that the master device has served is large), or may allocate part of the physical addresses to different standby devices, that is, allocate part of the hosts to different standby devices, and each standby device serves a corresponding host.
The main device may allocate part or all of the physical addresses in the address information table to different standby devices in a plurality of ways, for example, when the number of the part or all of the physical addresses in the address information table is smaller than the number of the standby devices, the main device directly allocates the physical addresses to the part of the standby devices, and each of the part of the standby devices may allocate a plurality of physical addresses, preferably, may also allocate one physical address. When the number of partial or all physical addresses in the address information table is larger than that of the standby equipment, the main equipment allocates a physical address to each standby equipment, and then allocates the rest physical addresses to the standby equipment with relatively small number of allocated hosts preferentially according to the number of allocated hosts in the resource state information of each standby equipment.
For example, in the system shown in FIG. 1, Router A collects four physical addresses: 08-00-27-76-8 f-61, 08-00-27-76-8 f-62, 08-00-27-76-8 f-63 and 08-00-27-76-8 f-64, namely the four physical addresses are written in an address information table (HOST pool). Router A allocates 08-00-27-76-8 f-63 and 08-00-27-76-8 f-64 to Router B and Router C respectively, the Router B and the Router C respectively process data packets sent by the host corresponding to 08-00-27-76-8 f-63 and 08-00-27-76-8 f-64, the rest 08-00-27-76-8 f-61 and 08-00-27-76-8 f-62 are distributed to the Router B and the Router C, the data packets sent by the corresponding hosts 08-00-27-76-8 f-61 and 08-00-27-76-8 f-62 are processed by the host.
After receiving the physical address allocated by the main equipment, the standby equipment stores the allocated physical address; and when the standby equipment receives the data packet sent by the host computer through the network interface, if the physical address corresponding to the host computer is stored, the standby equipment processes the data packet sent by the host computer, otherwise, the standby equipment discards the data packet sent by the host computer.
When the network port receives the data packet sent by the host, if the physical address corresponding to the host is the physical address allocated to the host in the address information table, the host processes the data packet sent by the host, otherwise, the host discards the data packet sent by the host.
For example, in the system shown in fig. 1, Router B processes (e.g., forwards) a packet sent by a host corresponding to 08-00-27-76-8 f-63 when receiving the packet sent by the host; if the data packet sent by the host corresponding to 08-00-27-76-8 f-61 is received, the data packet is directly discarded. When receiving a data packet sent by a host corresponding to 08-00-27-76-8 f-61, Router a processes (e.g., forwards) the data packet sent by the host; if a data packet sent by a host corresponding to 08-00-27-76-8 f-64 is received, the data packet is directly discarded.
The load balancing system based on VRRP provided by the embodiment of the invention not only can realize load balancing, the main equipment and the standby equipment can forward the data packet sent by the host, but also all the hosts only need to configure the same gateway, and the configuration operation is simple; on the other hand, the ARP table of the host does not need to be refreshed, so that the host is not influenced to start the ARP firewall or the ARP binding function when the load balancing function is realized, and the device can normally work even in some devices which cannot process the gratuitous ARP in time.
Referring to fig. 2, the load balancing method based on VRRP according to the embodiment of the present invention is applied to the system according to the embodiment of the present invention, and the method includes the following steps:
step S101: and the main equipment collects the physical address corresponding to each host and writes the physical address corresponding to each host into an address information table.
The manner of collecting the physical address corresponding to the host by the host may be that the host sends an ARP request to the host, and extracts the physical address corresponding to the host from the ARP request; or extracting the physical address corresponding to the host from the data packet sent by the host.
Step S102: each standby device sends its own resource status information to the primary device.
After collecting all the physical addresses corresponding to the hosts, the primary device may directly allocate part or all of the physical addresses to the standby devices. In order to achieve load even distribution as much as possible, it is preferable that the main device performs distribution according to the load capacity that each standby device can bear, that is, the main device performs distribution according to the resource status information of each standby device.
Step S103: and the main equipment allocates part or all of the physical addresses in the address information table to different standby equipment according to the resource state information sent by each standby equipment to finish load balancing allocation.
And the standby equipment allocated to the physical address processes the data packet after receiving the data packet sent by the host corresponding to the allocated physical address, and directly discards the data packet if the data packet is not the data packet sent by the host corresponding to the allocated physical address.
The VRRP-based load balancing method provided by the embodiment of the invention can realize route redundancy under the condition of no free ARP, can avoid ARP spoofing attack, and reduces redundant faults generated by dependence of some equipment on free ARP processing; on the basis of realizing load balance distribution, the safety of the host can be guaranteed, and the functions of starting an arp firewall or arp binding and the like of the host are not influenced.
All of the features disclosed in this specification, or all of the steps in any method or process so disclosed, may be combined in any combination, except combinations of features and/or steps that are mutually exclusive.
Any feature disclosed in this specification (including any accompanying claims, abstract and drawings), may be replaced by alternative features serving equivalent or similar purposes, unless expressly stated otherwise. That is, unless expressly stated otherwise, each feature is only an example of a generic series of equivalent or similar features.
Claims (9)
1. A VRRP (virtual router redundancy protocol) -based load balancing system is characterized by comprising a main device, at least one standby device and at least one host, wherein the main device and the at least one standby device have the same virtual physical address and virtual IP address;
the main device is used for collecting a physical address corresponding to each host in the at least one host and writing the physical address corresponding to each host into an address information table; the system is also used for distributing part or all physical addresses in the address information table to different standby equipment according to the resource state information sent by each standby equipment to finish load balancing distribution;
the standby equipment is used for sending resource state information to the main equipment, and after receiving the physical address distributed by the main equipment, the standby equipment distributed to the physical address processes a data packet sent by a host corresponding to the distributed physical address.
2. The system according to claim 1, wherein when the primary device allocates a physical address, the primary device allocates a part of the physical addresses in the address information table to different standby devices and allocates the remaining physical addresses to itself according to the resource status information sent by each standby device.
3. The system according to claim 2, wherein when the number of the partial physical addresses is greater than the number of the standby devices, the main device allocates a physical address from the partial physical addresses to each of the standby devices, and then preferentially allocates the remaining physical addresses in the partial physical addresses to the standby devices having relatively small numbers of allocated hosts according to the number of allocated hosts in the resource status information of each of the standby devices.
4. The system according to claim 2, wherein when the host receives the packet sent by the host, the host processes the packet sent by the host if the physical address corresponding to the host is the physical address allocated to the host in the address information table, otherwise, discards the packet sent by the host.
5. The system of claim 1, wherein the backup device stores the assigned physical address after receiving the physical address assigned by the primary device; and when the standby equipment receives the data packet sent by the host computer through the network interface, if the physical address corresponding to the host computer is stored, the standby equipment processes the data packet sent by the host computer, otherwise, the standby equipment discards the data packet sent by the host computer.
6. A VRRP (virtual router redundancy protocol) -based load balancing method is applied to a VRRP-based load balancing system, the system comprises a main device, at least one standby device and at least one host, the main device and the at least one standby device have the same virtual physical address and virtual IP address, and the method comprises the following steps:
the main equipment collects the physical address corresponding to each host in the at least one host and writes the physical address corresponding to each host into an address information table;
the main equipment allocates part or all physical addresses in the address information table to different standby equipment according to the resource state information sent by each standby equipment to finish load balancing allocation;
and the standby equipment allocated to the physical address processes the data packet after receiving the data packet sent by the host corresponding to the allocated physical address, and directly discards the data packet if the data packet is not the data packet sent by the host corresponding to the allocated physical address.
7. The method of claim 6, wherein the collecting, by the master device, physical address information corresponding to each of the at least one host comprises: and the master equipment receives the data packet sent by each host in the at least one host, and extracts the physical address corresponding to the host sending the data packet from the data packet.
8. The method of claim 6, wherein the primary device assigns a portion of the physical addresses in the address information table to different standby devices, comprising:
and the main equipment allocates part of physical addresses in the address information table to different standby equipment and allocates the rest physical addresses to the main equipment according to the resource state information sent by each standby equipment.
9. The method of claim 8, wherein the allocating, by the primary device, a part of physical addresses in the address information table to different standby devices according to the resource status information sent by each standby device comprises:
when the number of the partial physical addresses is larger than that of the standby equipment, the main equipment allocates a physical address to each standby equipment from the partial physical addresses respectively, and then allocates the rest physical addresses in the partial physical addresses to the standby equipment with less allocated host number preferentially according to the allocated host number in the resource state information of each standby equipment.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610393276.XA CN105847143B (en) | 2016-06-06 | 2016-06-06 | Load balancing method and system based on VRRP |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610393276.XA CN105847143B (en) | 2016-06-06 | 2016-06-06 | Load balancing method and system based on VRRP |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105847143A CN105847143A (en) | 2016-08-10 |
CN105847143B true CN105847143B (en) | 2022-06-07 |
Family
ID=56575452
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610393276.XA Active CN105847143B (en) | 2016-06-06 | 2016-06-06 | Load balancing method and system based on VRRP |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105847143B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107294845A (en) * | 2017-07-31 | 2017-10-24 | 杭州迪普科技股份有限公司 | VRRP load-balancing methods and device |
CN114079636A (en) * | 2021-10-25 | 2022-02-22 | 深信服科技股份有限公司 | Flow processing method, switch, soft load equipment and storage medium |
CN116193385A (en) * | 2021-11-26 | 2023-05-30 | 中兴通讯股份有限公司 | Signaling transmission method, VRRP networking system, first network entity equipment and storage medium |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103747020A (en) * | 2014-02-18 | 2014-04-23 | 成都致云科技有限公司 | Safety controllable method for accessing virtual resources by public network |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101217448B (en) * | 2008-01-18 | 2013-01-30 | 福建星网锐捷网络有限公司 | Method and system to realize gateway dynamic load sharing |
CN102946348B (en) * | 2012-11-09 | 2016-01-20 | 杭州华三通信技术有限公司 | VRRPE message processing method and equipment in a kind of double layer network |
CN103873368B (en) * | 2012-12-11 | 2017-09-15 | 新华三技术有限公司 | Ethernet message forwarding method and access device |
CN103259740B (en) * | 2013-04-27 | 2017-03-15 | 杭州华三通信技术有限公司 | A kind of load balance process method and device |
CN205792669U (en) * | 2016-06-06 | 2016-12-07 | 北京博维亚讯技术有限公司 | SiteServer LBS based on VRRP |
-
2016
- 2016-06-06 CN CN201610393276.XA patent/CN105847143B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103747020A (en) * | 2014-02-18 | 2014-04-23 | 成都致云科技有限公司 | Safety controllable method for accessing virtual resources by public network |
Non-Patent Citations (3)
Title |
---|
《基于VRRPE的虚拟路由器冗余系统的设计与实现》;顾津吉;《中国优秀硕士学位论文全文数据库》;20121031;全文 * |
《基于VRRP协议实现路由冗余和负载均衡的应用研究》;谷宝磊;《智能计算机与应用》;20141201;全文 * |
《基于负载均衡的VRRP协议的研究与实现》;徐强;《中国优秀硕士学位论文全文数据库》;20120731;全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN105847143A (en) | 2016-08-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107078969B (en) | Realize computer equipment, the system and method for load balancing | |
CN109586972B (en) | Access method and system of user terminal equipment and broadband network gateway | |
EP2993838B1 (en) | Methods for setting a member identity of gateway device and corresponding management gateway devices | |
US9219641B2 (en) | Performing failover in a redundancy group | |
EP3119047B1 (en) | Load balancing method, apparatus and system | |
US20080028071A1 (en) | Communication load reducing method and computer system | |
CN102404418B (en) | Method, device and system for distributing IP (internet protocol) address for user terminal | |
CN102333027B (en) | Traffic load sharing realization method based on virtual router redundancy protocol extend (VRRPE) backup group and realization apparatus thereof | |
CN106161272B (en) | Realize the method and routing device of VRRP load balancing | |
JP2003023444A (en) | Dynamic load distribution system utilizing virtual router | |
CN102215158A (en) | Method for realizing VRRP (Virtual Router Redundancy Protocol) flow transmission and routing equipment | |
CN101827039B (en) | Method and equipment for load sharing | |
US10237157B1 (en) | Managing host failures in a traffic forwarding system | |
CN105847143B (en) | Load balancing method and system based on VRRP | |
CN105743781B (en) | A kind of VRRP load-balancing method and device | |
US9525624B2 (en) | Virtual router redundancy protocol for scalable distributed default routing gateway | |
JPWO2013001641A1 (en) | IP address distribution system | |
JP2010278584A (en) | Network, network device and load distribution method used therefor | |
WO2018161795A1 (en) | Routing priority configuration method, device, and controller | |
JP6445408B2 (en) | Communication system and setting method | |
EP2879338A1 (en) | Logical channel establishing method and system, edge virtual bridging station, and bridge | |
CN104618148B (en) | The backup method and equipment of a kind of firewall box | |
CN106375210A (en) | Method for realizing VRRP (Virtual Router Redundancy Protocol) downlink load balancing and route devices | |
WO2023125271A1 (en) | 5g user terminal ip address confirmation method, apparatus and system | |
US9838302B1 (en) | Managing loss of network connectivity in traffic forwarding systems |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |