VRRP configuration guide applies to RUT230, RUT240, RUT950 and RUT955 routers and includes examples from both Windows and Linux Operating systems.
Virtual Router Redundancy Protocol (VRRP) is a computer networking protocol that provides for automatic assignment of available Internet Protocol (IP) routers to participating hosts. This increases the availability and reliability of routing paths via automatic default gateway selections on an IP subnetwork.
This chapter provides a guide on how to configure VRRP on RUT routers. You can find a more general description of VRRP here
Configuration overview and prerequisites
Before we begin, let's overview the configuration that we are attempting to achieve and the prerequisites that make it possible.
- 2 RUTxxx routers
- a switch
- a PC
The aim of this setup is to configure a system that will keep the PC connected to the internet when one of the routers fails.
- the two routers will be connected to the switch and will both have a separate WAN connection (Internet access)
- the PC will be connected to the switch as well
- the two routers and the PC will belong to the same subnet
- both routers will have VRRP configured and enabled with the same VRRP IP address that is also in the same subnet
- the PC will have a Static IP configuration: the IP address will be in the same subnet as the two routers; the Gateway will be the VRRP IP address
If you don't have a switch at your disposal and just want to back up your Mobile connection, we also present alternate configuration scheme that doesn't require a switch:
In this scheme the devices are connected sequentially instead of in parallel. For this reason, if Router1 crashes, there will be no path to Router2. It is useful only in instances when only the WAN connection fails.
Even though the scheme is different, all of the configurations are the same. Therefore, it is safe to follow the rest of this guide step-by-step despite whichever scheme you choose to use.
Configuring the routers
VRRP configuration from the router's side is pretty basic. You'll need to set a VRRP address, a Virtual ID, VRRP router's priority and internet connection checking settings. Most of these settings are the same for both routers and some are just default values. You'll find the step-by-step instruction bellow. If you only wish to find out the router VRRP parameter values and don't want to read the entire guide, you can skip to 3.4 section of this guide.
VRRP IP address
First you'll have to configure a VRRP IP address that will work as a gateway to the internet for your PC. The VRRP IP address will have to be in the same subnet as the routers. A subnet is defined by the third segment of an IP address, for example, for the IP address 192.168.1.1 - 1 is the subnet; for 192.168.2.1 - 2 is the subnet and so on.
For this guide we'll use the default VRRP IP address 192.168.1.253, which is in the first subnet. Therefore, both routers' LAN IP addresses will have to be in the first subnet as well. You can configure a RUT router's LAN IP address in the Network → LAN section of the router's WebUI where it will the first setting in the entire page (you can find more information on the LAN section here).
The LAN IP addresses used for this guide are:
Router1 - 192.168.1.1
Router2 - 192.168.1.2
Virtual ID and priority
Next we'll need to set Virtual IDs and priority numbers both of the routers. Virtual IDs are used to group routers into VRRP clusters that usually operate in different segments of a LAN. For our simple setup both of the routers will have to be in the same VRRP cluster, therefore, they will have the same Virtual ID. For this example we'll use the default Virtual ID value which is 1.
Priority defines a router's priority in a VRRP cluster, i.e., the router with the higher Priority number is considered to be the "Master" and will be the one providing other devices in LAN with an Internet connection unless it somehow fails. In case of failure, the router with the second highest Priority number (a "Slave" router) will become the "Master" router and provide an Internet connection from then. So the next step is to choose which router will act as the "Master" and which will act as the "Slave". For this example lets set Router1 Priority to 255, making it the "Master", and Router2 Priority to 100, making it the "Slave".
The actual values do not matter as long as they are in the range of 1 - 255. If both values are equal, then the "Master" will be picked at random.
Check Internet Connection
The 'Check Internet Connection section is used to set up periodic checks that determine whether the internet connection is down. The router sends an ICMP ping packet at a specified frequency (Ping interval) to a specified host (Ping IP address) on the Internet and waits for a response. If that response does not arrive in the specified amount of time (Ping timeout) the router will send a specified amount of retry ping packets (Ping retry count). If there is still no response received, the Internet connection for that router will be considered as "down" and the devices in LAN will get their Internet connection from the router with the next highest Priority.
Ping IP address can be any IP address or hostname. The address should not belong to your LAN and should always be reachable from WAN, e.g., Google's DNS server - 18.104.22.168, which we will use for this example.
Ping interval is the time interval (in seconds) between two pings. The shorter the Ping interval is, the faster the router can determine whether the internet connection is down. Lets set a Ping interval of 5 seconds for this example.
Ping timeout (sec) is the amount of time (in seconds) that the router will wait for a response ping packet. If the router doesn't receive a response in the time specified in this field, it will send a retry ping(s) (if specified). If that fails as well, the internet connection for that router will be considered as down. Lets set the Ping timeout of 1 second for this example.
Ping packet size defines the size (in bytes) of the ping packet. Lets set the Ping Packet size to 56 bytes for this example.
Ping retry count is the number of secondary ping packets that the router will send in case the initial ping does not get a response. After this number of pings is exceeded, the internet connection will considered as down. Lets set a Ping retry count of 1 for this example.
Router configuration summary
This section of the guide is a summary of router configurations used for this guide.
|VRRP LAN Configuration Settings|
|Check Internet Connection|
|Ping IP address||22.214.171.124||126.96.36.199|
|Ping timeout (sec)||1||1|
|Ping packet size||56||56|
|Ping retry count||1||1|
Setting up a static IP for your PC
Next you'll need to set up a Static IP address on your PC. This is necessary because if you use DHCP, your PC will be assigned an IP address from one of the routers and will not use the VRRP address as its gateway to the internet.
To set up a Static IP address on a Linux operating system, open /etc/network/interfaces file with the nano editor by issuing this command via the Terminal app:
$ sudo nano /etc/network/interfaces
Next, add these lines to the file:
# My static network interface auto enp3s0 iface ens33 inet static address 192.168.1.3 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.253 dns-nameservers 188.8.131.52 184.108.40.206
enp3s0 is the name of the wired network interface. Replace with the name of your wired network interface. address is the IP address of your network interface. Lets set it to 192.168.1.3 for this example. Another key component in this segment is gateway. As you can see in the example above, it is set to 192.168.1.253, the same as the VRRP address.
To undo these changes, delete the lines that you had pasted and restart network-manager:
$ /etc/init.d/network-manager restart
To set up a static IP address on your PC using Windows 10, you must first go to the Ethernet Settings menu. In order to reach the Ethernet Settings window, enter "change ethernet settings" in the Windows search field located next to Start in the bottom left corner of the screen and press Enter:
When in the Ethernet Settings window, click Change adapter options located under "Related settings":
When in the Network connections window, right-click on the Network connection associated with your Ethernet adapter and click Properties:
Next, click on Internet Protocol Version 4 (TCP/IPv4):
Check Use the following IP address and enter a static IP for your PC (e.g., 192.168.1.3); netmask - 255.255.255.0; gateway - 192.168.1.253:
To undo these changes, go back to the Internet Protocol Version 4 (TCP/IPv4) window a check Obtain an IP address automatically.
Testing your setup
If you followed all of the steps above, your VRRP setup should be complete and the only thing left is to test if it works. Disconnect your "Master" router from the internet. You can do this by removing the primary SIM card or disconnecting the WAN cable, depending on the WAN settings of the router. Or you can simply disconnect the power cable from that router (provided that your setup is based on the first example scheme from this guide(the one with the switch)). Wait up to a minute and check if your computer has an internet connection. Restore the internet connection to your "Master" router, wait a minute and disconnect the "Slave" router.
After you disconnect one of the routers, you should lose your internet connection for a short period of time before it gets restored. If that is the case - congratulations! Your setup works. If not, try to retrace the steps of this guide to find out if you have missed something.