Article title: Introduction to VRRP in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
This article describes how to implement VRRP (Virtual Router Redundancy Protocol) in Linux ). I personally summarized the VRRP process and introduced some basic concepts and principles of VRRP and how to implement VRRP in Linux,
It includes the following parts:
1. VRRP introduction
2. VRRP components in Linux
3. install Keepalived.
1. VRRP introduction
When we create a network, dynamic routing protocols such as OSPF and RIP are often used to ensure stable and uninterrupted operation of the network, these routing protocols can automatically bypass many network faults, such as the router DOWN. However, in many cases, we may not be able to use these high-end routing protocols:
(1) because sometimes it is a client, the configuration of OSPF, RIP, and other protocols must be supported by upstream ISP vendors, but many ISP vendors do not provide such services, they only provide static routes. (Sometimes the objective of using OSPF, RIP, and other protocols is to back up links and routes. VRRP can completely replace them)
(2) We have more than two Internet lines, and we need to back up load balancing, routing lines, and routers for them (VRRP is also designed mainly for this requirement)
To ensure uninterrupted and stable network operation, VRRP is the best choice. VRRP is short for the Virtual Router Redundancy Protocol, which is described in more detail in RFC2338.
2. VRRP concept
VRRP has many concepts. we will introduce them one by one:
(1) in the figure, the router RA is the master router of vrovrvrid 1, which is in charge of the Gateway of "intranet 1" and the backup router of vrovrvrid 2, when VRID 2's primary router RB is unavailable, it takes over the work of RB.
(2) the router RB is the master router of vrovrvrid 2, which is in charge of the Gateway of "intranet 2" and a backup router of vrovrvrid 1, when VRID 1's primary router RA is unavailable, it takes over RA's work.
3. VRRP terminology:
(1), Virtual Router: Virtual Router. In our figure, it is a router mirror consisting of the actual router RA and RB using VRRP protocol.
(2) Vitual Router ID: VRID for short. it is the unique ID of the Virtual Router in the network and is a number.
(3), VRRP Instance: VRRP entity. VRRP Instance can be understood as a program running on an actual vro. it is responsible for the information required by VRRP. For example, it indicates whether the actual vro is the master router, the backup router, and the VRID of the vro.
(4) Virtual Router IP: a Virtual Router has an IP address. Normally, the master Router in the Vritual Router is in charge, when the primary Router fails, the backup Router in the Virtual Router is in charge.
(5) Master: The Master router. Whether a vro is a master router is generally described in its VRRP Instance.
(6), Backup: back up the router. Whether a vro is a backup router is generally described in its VRRP Instance.
(7), Priority: Priority. In VRRP Instance, a priority is defined for each actual router, which is a number ranging from 1 to 254 (0 and 254 are retained in RFC definition). when the primary router is unavailable, the backup router determines who takes over the work of the primary router based on its priority. The larger the number, the larger the weight.
(8), Owner: Owner of the Virtual Router IP address.
(9), Authentication: verification. The actual vrouters in the same VRID need to communicate with each other, and the communication between them needs to be verified. Password verification is generally used. In addition, you must note that the multicast address 224.0.0.18 is used for the actual vro communication in the same VRID.
4. VRRP data packet structure:
For more information, see RFC2338 VRRP.
5. VRRP components in Linux
In Linux, you can implement a very beautiful and stable VRRP function. The software implementing this function is keepalived (http://www.keepalived.org), keepalived was initially designed for LVS (LinuxVirtualServer www.linuxvirtualserver.org server load balancer system under Linux), is dedicated to monitoring the server status. Later, the VRRP function was added. The VRRP function of Keepalived comes from VRRPD in Linux: http://www.off.net /~ Jme/vrrpd/index.html.
6. install Keepalived
To install Keepalived, you must first install the following two components:
Openssl (www.openssl.org)
Http://www.gnu.org/directory/libs/popt.html (popt)
(1) openssl installation. if your system already has an openssl system and the/usr/include directory contains an openssl directory, you do not need to install openssl, if not, you need to install it.
Tar zxvf openssl-0.9.7d.tar.gz
Cd openssl-0.9.7d
Configure
Make
Make test
Make install
Then copy the include directory of openssl to/usr/include.
Cp? R/usr/local/ssl/include/openssl/usr/include
(2), tar zxvf popt-1.7.tar.gz
Cd popt-1.7
./Configure
Make
Make install
(3) before installing keepalived, you may need to re-compile the Linux kernel and compile the options of Netlink, Linux Virtual Server, and Multicast into the new kernel:
(4) keepalived installation
Tar zxvf keepalived-1.1.7.tar.gz
Cd keepalived-1.1.7
./Configure? Prefix =/usr/local/keepalived
Make
Make install
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.