VRRP Load Balance Technology Simulation Practice Based on GNS3

. This paper introduced the working principle of VRRP Load Balance Technology and technical detail. Through simulation software GNS3 it constructed the Load Balance network, and configured the VRRP technology, which causes the different local area network to data flow load balance through the VRRP technology, when a single point of failure occurs, the gateway can be migrated adaptively without affect the normal use of the network. It provides a flexible and effective solution to implement the load balance lab environment.


VRRP working principle
In order to achieve the above functionality, the concept of the virtual router should be introduced into the network. The virtual router is composed of a primary router and multiple standby routers under the guidance of VRRP protocol configuration. When the setting is online, only the primary router transmits the data packet. When the primary router fails, the backup router automatically takes over the responsibility of data packet forwarding according to the VRRP setting.
Network engineers use physical routers to configure and build virtual routers based on network requirements utilize the VRRP protocol. Communication between the host and the virtual router on the network is based on VRRP logical configuration, that is, the LAN host does not need to know the actual router information. With VRRP, a set of routers on the LAN (Router A, Router B, and Router C in Figure 1) can be combined into virtual routers marked on the right side of the diagram. By setting the IP address of the virtual router to 10.1.1.1, you can see that the IP address is the same as the address of the physical router "A", so that the virtual router is called the IP address owner. Router A, Router B, Router C also have a corresponding IP addresses setting: Router A's IP address is 10.1.1.1, Router B's IP address is 10.1.1.2, Router C's IP address is 10. 1.1.3. The host in the LAN only needs to set its default gateway to the IP address of the virtual router 10.1.1.1, and does not need to care about IP properties of other physical routers A, B and C. So the host in the network communicates with the external network through this virtual router. For the virtual router to work correctly, the following config needs to be set: First of all, we need to select the main router from among all the physical routers. Meanwhile, the virtual MAC address information should be set. If the virtual IP address is the same as one of the VRRP routers in the VRRP group, this router is the IP address owner, and it will be selected as the primary router. If the above config is not established, the primary router is elected by priority, and if the priority of the router devices is the same, the primary IP address of each device is compared, the IP address with a larger number will be the primary router.
The primary router selected according to the above mechanism is in the Master state, which is called the Master router. Other routers in the Backup state are called Backup routers.
The virtual router in the VRRP group has a unique virtual MAC address: 00-00-5E-00-01- [VRID]. Among them, VRID represents the identity of the VRRP group, with a range of 0~255. In Figure 1 above, three routers are in the same VRRP group, which is identified by a group number between 0 and 255.  Secondly, the state transition between backup routers and primary routers. Typically, when the primary router is working, and it will broadcast its status to other routers in the same LAN periodically. If the other routers do not receive the notification for three consecutive cycles or notification with a priority of 0 is received, the primary router selection process will be toggled.
Last, VRRP state transition: Routers in the VRRP group have three states: Initialized, Master, and Backup. Figure 2 shows the state transition of the routers.

GNS3 simulation software
GNS3 is an open source network simulator that helps network engineers simulate, configure, test, and troubleshoot networks. When working with Dynamips, IOU, VMWare, Docker, VPCS, and QEMU, it can simulate the hardware platforms of nearly all kinds of devices from different suppliers including routers, switches, firewalls, such as Cisco, ASA, F5. At the same time, the official version of the GNS3 simulator comes with a graphical user interface, enabling simulation of complex networks.

Simulation topology
The simulation is designed in GNS3 using either a layer three switch or a router. When using routers, a version of IOS that supports HSRP protocol must be used. A LAN environment with three hosts introduced, PC1 and PC2 point to the same gateway and PC3 to another. By default, LAN hosts can access external networks through different gateway devices, As shown in Figure 3.

Simulation configuration
Firstly, VPCS is used to configure PC1, PC2, and PC3, which are emulated as hosts in LAN. The gateway of PC1 and PC2 are pointed to F0 interface of router R1 with IP address 10.0.0.251, and the gateways of PC3 are pointed to F0 interface of router R2 with IP address 10.0.0.252. We can launch "ping" and "trace" commands on PC1, PC2, and PC3 to verify that the network is reachable and to track the flow of data.
It is assumed that the F0 interface of router R1 being set to downstate, the external network is unreachable from PC1 and PC2. However, redundant devices are not fully utilized by default, so when a single point failure occurs, it will inevitably cause "no network access " error on some devices. To solve this problem, VRRP protocol is configured on R1 and R2. The configuration is as follows: For router R1 in the network, it is configured with a virtual IP address of 10.0.0.253 in VRRP group 1, which will be used as a gateway for LAN hosts. At the same time, the priority of this device is set to 200, turned on preemptive mode to allow on-demand switching between primary and backup routing states.
R1 is also configured with a virtual IP address of 10.0.0.254 with a priority of 150 in VRRP group 2, running in preemption configuration, as shown in Figure 4. For router R2, it is configured with a virtual IP address of 10.0.0.253 and a priority of 150 in VRRP group 1 with preemption mode switch on. With such a configuration, PC1 and PC2 select the left router R1 as the gateway device according to the priority. Moreover, R2 is configured with a virtual IP address of 10.0.0.254 and a priority of 200 in VRRP group 2 with preemption mode switch on, PC3 chooses the right router R2 as the gateway device according to this priority of VRRP setting, load balancing is achieved when difference PC got it is own routing path as shown in Figure 5.
Router R3 configures the routing protocol so that the data can reach the external network, and the configuration is shown in Figure 6.

Simulation Test
With the above configuration, the packets sent by PC1 and PC2 will automatically switch to the F0 interface of R2 to reach the external network when the F0 interface of R1 router is set to the downstate. Conversely, when the F0 interface of R2 router is set to downstate, then the packets sent by PC3 to the external network will automatically switch to the F0 interface of R1.

Conclusion
As can be seen from the testing, since two different VRRP groups are enabled in the network, redundancy can be well ensured. When either R1 or R2 fails, the host can automatically switch routing paths, ensure network reliability, and a redundant backup mechanism is constructed. Also, when all routers working normally, all computers can transmit data in different routing according to their respective gateway, this can better achieve load balancing.