Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

VRRP virtual IP drift

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

Brief introduction

VRRP is the abbreviation of Virtual Router Redundancy Protocol, that is, virtual routing redundancy protocol.

Original address: https://linux-network-programming.readthedocs.io

QQ communication group: Linux network programming, group number: 183196643

Welcome to follow our official account: easy to learn programming (coding-fan).

VRRP was originally designed to address the high availability of gateways:

We know that when computers communicate on the network, they need gateways to transmit network messages. Each machine can only be configured with one gateway address, so the reliability of the gateway is very important. If the gateway fails unfortunately, then all machines using the gateway will be affected-the network will be cut off!

The idea of solving the gateway single point problem is very straightforward-deploy a backup gateway and switch over if the primary gateway fails.

However, because the machine can only be configured with one gateway address, the configuration needs to be modified each time the gateway is switched. This solution is not automated and not elegant.

At this time, VRRP came into being! Next, give a simple example of how VRRP works:

Here's the thing.

This network deploys two routes for mutual backup, and other machines in this network use these two routes as gateways for network communication. The IP addresses of the two routes are 192.168.1.1 and 192.168.1.2, respectively. However, instead of providing forwarding services directly through these addresses, the route uses a virtual address of 192.168.1.253. Other computers, such as 192.168.1.3, configure the gateway address to 192.168.1.253.

Through VRRP, the two routes perform health checks on each other. When both routes are healthy, only the primary route provides the ARP response of the virtual address. At this point, traffic destined for the virtual address 192.168.1.253 is handled by the primary route.

When the primary route fails, the backup route is detected. At this point, the backup route begins to advertise through the ARP protocol: I am the MAC address corresponding to the virtual address 192.168.1.253, and I have taken over!

Next, traffic destined for the virtual address 192.168.1.253 is processed by an alternate route. At this point, the virtual address 192.168.1.253 looks as if it were drifting to an alternate route. In other words, the gateway was successfully switched, and there is no need to modify the gateway configuration of other machines!

After the primary route is restored, the processing right of the traffic will be regained by similar means. This part will not be repeated.

The complete process is as follows:

The two routes check each other's health; the primary route responds to the ARP request of the virtual address and advertises its MAC address; the virtual address network traffic is handled by the primary route; the backup route discovers the primary route failure and begins to respond to the ARP request of the virtual address and advertise its MAC address; the virtual address network traffic is handled by the backup route; the primary route resumes, re-responds to the ARP request and reclaims the traffic Backup route discovers that the primary route is restored, stops responding to ARP requests, and releases traffic processing rights

To sum up, VRRP does two main things:

Virtual IP drift is realized by ARP responding to MAC address; virtual IP drift is determined by health check; application scenario

In essence, VRRP is used to achieve high availability, regardless of the gateway.

We can apply it to the high availability of some network services, such as Web services:

There are many scenarios where services are highly available, and VRRP is especially suitable for the following scenarios:

Services can only be presented as a single IP; only one instance is allowed to serve at a time

In addition, VRRP can also be used to achieve high availability of load balancing facilities. The high availability of applications is solved through load balancing facilities, so how can load balancing facilities achieve high availability? The answer is-- VRRP!

Here is a very typical example:

Limitation

Because VRRP relies on ARP for IP drift, the related machines must be in the same network and cannot cross network segments.

Subscribe to updates for more learning materials, please follow our Wechat official account:

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report