Virtual Router Redundancy Protocol (VRRP)

Source: Internet
Author: User

Virtual Router Redundancy Protocol ( VRRP )

5.1 VRRP protocol Principle

The VRRP protocol (virtual Router redundancy Protocol), similar to HSRP, can improve network stability and reliability, defined by the IETF standard RFC2338. Because VRRP is similar to the HSRP principle, there are only slight differences in terminology and functionality, so this section briefly describes the principles of VRRP.

1 and how VRRP works

As shown in 5.1, the VRRP protocol uses two or more routers on a LAN segment as a "virtual" router, providing services externally through the same virtual IP address and virtual MAC address. If one fails, the other can take over and continue to complete the routing function.

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image003 "border=" 0 "alt=" clip_image003 "src=" http://s3.51cto.com/wyfs02/M00/77/88/ Wkiol1zpd9fjgssqaaaezmzv4hu184.jpg "" 244 "height="/>

Figure 5.1 VRRP has created a MAC Address and IP address of the virtual router

The VRRP protocol group consists of a primary router, a backup router, and a virtual router. The active router in the VRRP protocol is called the primary router, which forwards packets sent to the virtual router. The routers in the other VRRP groups are in a backup state. A virtual router is a router that represents an end user that can work continuously.

VRRP and HSRP are the same according to the priority size of the primary router, the same VRRP group of the highest priority router becomes the primary router, the state is master. The other routers in the group are in a backup state and detect the status of the primary router. The primary router sends a VRRP notification every once in a while, informing it that it is working properly. If the backup router in the VRRP group does not receive a notification from the primary router for a long time, it changes itself to the master state. There may be multiple backup routers in the VRRP group that are considered to be primary routers at the same time, and each primary router compares the size of the priority and local priority in the received VRRP advertisement. If the local priority is less than the priority of the VRRP advertisement, the self-router state is the backup state, otherwise the master state is the same. Finally, the router with the highest priority in a VRRP group becomes the new primary router.

2 , virtual MAC address

The MAC address format of the virtual router in the VRRP group is 0000.5e00.01xx, where xx is the VRRP group number.

For example: VRRP Group 47, the MAC address of the virtual router is 0000.5e00.012f.

3 , VRRP notice

The VRRP protocol defines only one message, the VRRP notification, which uses the IP protocol number 112 and the destination address is the multicast address 224.0.0.18.

4 , the state of VRRP

The VRRP protocol defines a total of three states: Master (Master State), backup (back up state), Initialize (initial state).

N Initial state: All routers start from the initial state, which is entered when the process is started.

N Backup Status: Receives the VRRP multicast advertisement sent by the primary router to determine the status of the primary router, discards packets sent to the virtual router's MAC address and IP address, and does not respond to ARP requests for virtual IP addresses.

N Master state: periodically sends VRRP multicast notifications, responds to ARP requests for virtual IP addresses, and sends free ARP packets to enable the host in the network to know the corresponding relationship between the virtual IP address and the virtual MAC address; the forwarding destination address is the IP packet of the virtual MAC address.

VRRP The conversion relationship between three states, as shown in 5.2.

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image005 "border=" 0 "alt=" clip_image005 "src=" http://s3.51cto.com/wyfs02/M00/77/88/ Wkiol1zpd9fxoez5aaan_wsto_4907.jpg "" 244 "height="/>

Figure 5.2 Conversion relationship between the three states VRRP

In the initial state, if a startup message is received and the priority is 255 (priority range 0~255), the router state is converted to the primary state, and if the priority is less than 255, the router state reverts to the backup state.

In the backup state if the interface receives the shutdown message, the router status reverts to the initial state, and if the master_down_interval time expires, the router goes to the primary state.

In the master state, if the interface receives a shutdown message, the router state reverts to the initial state, and if the received VRRP multicast advertisement has a priority greater than the local priority, the router state is converted to the backup state.

650) this.width=650; "Style=" margin:0px; Display:inline "title=" clip_image001 "alt=" clip_image001 "src=" http://s3.51cto.com/wyfs02/M02/77/8A/ Wkiom1zpd9fsds0eaaadikeburm244.gif "" "height="/> Name Explanation:

1, master_down_interval equivalent to the hold time in HSRP, that is, the backup router does not receive the VRRP notification of the primary router for a period of time, it is considered the primary router exception, itself becomes the primary router.

2, the VRRP priority is the same as the HSRP priority, the range is 0~255, the range can be configured is 1~254, the default is 100. If the VRRP configured virtual IP address and the actual physical interface address of the router are the same as this VRRP router is called the IP address owner, this router's VRRP priority is 255.

5 , VRRP timer

VRRP notification send time by default to 1s, and master_down_interval time is 3 times times the main router VRRP notification send time plus an offset time, the specific calculation formula is described in RFC2338.

6 , VRRP certification

The VRRP protocol provides three authentication methods (no authentication, simple word authentication, and MD5 authentication) that can be used in different authentication modes depending on the network environment. No authentication can be used in a secure network, and MD5 authentication can be used in a very insecure network.

5.2 VRRP related configuration of the Protocol

The principle of the VRRP protocol is briefly explained in the preceding section, which describes the configuration of the VRRP protocol.

5.2.1 VRRP the configuration command

1 , configure the router as a member of the VRRP group

Configure the router or layer three switch as a member of the VRRP group and specify the virtual IP address:

Switch (config-if) #vrrp group-number IP virtual-ip-address

which

N Group-number: Represents the VRRP group to which the port belongs. The configurable range is 1~255.

N virtual-ip-address: Represents the IP address of the virtual VRRP router, which is the gateway address of the network segment. If the virtual IP address and interface have the same physical IP address, the local router in this VRRP group has a priority of 255.

2 , configuring VRRP priority

The user can specify the priority of the port within the group. This allows the user the flexibility to specify the port order in the event of a failure. A high priority value becomes the primary router, and the following command is used to specify the priority:

Switch (config-if) #vrrp group-number priority Priority-value

Where the Priority-value range is 0~255, the configurable range is 1~254, and the default value is 100.

It is important to note that if the router is an IP address owner then the priority is 255 and the priority cannot be configured.

3 , configure preemptive rights

The preemptive right has the same meaning as HSRP, but the preemptive right in the VRRP agreement is turned on by default.

The command to close the VRRP preemptive right is:

Switch (config-if) #no VRRP group-number preempt

You can use the VRRP group-number preempt command to turn on VRRP preemptive rights.

4 , configuring the VRRP timer

The command to configure the VRRP notification send time for the VRRP router is:

Switch (config-if) #vrrp 1 timers Advertise [msec] interval

Where the msec parameter is configured with a time interval of milliseconds, a range of 50~999, and a time interval of not configured with the msec parameter parameter is seconds, and the range is 1~255.

The command VRRP group-number Timers Learn to learn the VRRP notification interval from the primary router, thus calculating the master_down_interval time.

5 , configuring VRRP authentication

VRRP the commands for configuring clear-text authentication are:

Switch (config-if) #vrrp 1 authentication word

VRRP the commands for configuring MD5 authentication are:

Switch (config-if) #vrrp 1 authentication md5 key-string word

6 , configuring VRRP port tracking

VRRP Configure Port tracking in a slightly different way than HSRP. VRRP Configuring port tracing, first, you need to define the port command for the trace as follows:

Switch (config-if) #track number interface type Mod/mun line-protocol

Where number is numbered and the range 1~500;line-protocol represents the interface link layer state.

Then, configure the VRRP port trace in interface mode with the following command:

Switch (config-if) #vrrp group-number track number decrement interface-priority

which

n group-number: The VRRP group number of the port with tracking function;

N Number: tracks the port defined by track number;

n interface-priority: The value of the router's hot-backup priority will be lowered when the port fails, and the priority of the router will be added when the port becomes available.

To turn off the port tracking feature, you can use the No standby group-number track command.

Note that if the router is the IP address owner then the priority is 255 and the port trace cannot be configured.

7 , view VRRP router status

To display the status of the VRRP router, enter the following command in privileged mode:

Switch#show VRRP [interface type Mod/mun] [group group-number] [brief]

which

N interface type Mod/mun: The port type and serial number to display;

N Group Group-number: The specific VRRP group to be displayed;

N Brief: Displays summary information, each backup group summary displays a row of output;

If these optional port parameters are not specified, the show VRRP command can display VRRP information for all ports.

The output of using the show VRRP Brief command is as follows:

Sw1#show VRRP Brief

Interface Grp Pri Time Own Pre State Master addr Group Addr

VL2 2 3414 Y Master 192.168.2.1 192.168.2.254

This output indicates that the VLAN2 port participates in the VRRP 2 group, the priority is 150, the preemptive right is enabled, not the IP address owner, the router is in the master State, The IP address of the primary router in the group 192.168.2.1,VRRP the virtual IP address of the group is 192.168.2.254.

Use show VRRP to view the details of the VRRP as follows:

Sw1#show VRRP

Vlan2-group 2//VRRP Group number

State is master//status is master

Virtual IP address is 192.168.2.254//VRRP Group

Virtual MAC address is 0000.5e00.0102//VRRP Group

Advertisement Interval is 1.000 SEC//VRRP notification Send time interval

Preemption enabled//Preemptive right is start state

Priority is 150//150

Track Object 1 State up decrement 100//port tracking, lower priority 100

Master Router is 192.168.2.1 (local), priority is 150//master router information

Master advertisement Interval is 1.000 sec//Master router VRRP notification interval

Master down Interval is 3.414 sec//Primary router down interval time

Vlan3-group 3

State is Backup

Virtual IP Address is 192.168.3.254

Virtual MAC Address is 0000.5e00.0103

Advertisement Interval is 1.000 sec

Preemption enabled

Priority is 100

Master Router is 192.168.3.2 150

Master advertisement Interval is 1.000 sec

Master down Interval are 3.609 sec (expires in 3.217 sec) learning

Learn the main router down interval time

5.2.2 VRRP the configuration instance

As with HSRP, the load balancing of network traffic needs to be implemented by configuring VRRP and spanning tree.

Below is a configuration example that shows how to configure load balancing for VRRP.

Benet Company set up network 5.3, requires the use of SW1 and SW2 use VRRP to enhance network stability, in order to make full use of network resources also requires the implementation of VLAN load balancing. The VRRP parameter planning is shown in Table 5.1.

Table 5.1 VRRP parameter planning table

VRRP parameters

Primary router

Backup router

Priority level

150

100

Preemptive right

Yes (default)

Yes (default)

Timer

Default

Default

Group number

Vlan-id

Note:

U for VLAN2:SW1 primary router, SW2 for backup router;

U for VLAN3:SW1 for backup router, SW2 primary router;

Other network planning is as follows:

N on SW1 switch VLAN virtual interface physical IP address:

L VLAN 2:192.168.2.1/24

L VLAN 3:192.168.3.1/24

N on SW2 switch VLAN virtual interface physical IP address:

L VLAN 2:192.168.2.2/24

L VLAN 3:192.168.3.2/24

n PC1 IP Address: 192.168.2.10/24, virtual gateway for 192.168.2.254/24;PC2 IP address: 192.168.3.10/24, virtual gateway for 192.168.3.254/24;

n SW1 and R1 connected addresses of 192.168.0.0/30;SW2 and R1 are 192.168.1.0/30;

N Configure the Loopback interface address of the R1 router 192.168.100.1/24 the analog extranet address;

N-Switch links are relay links, and use static routing to achieve network interoperability;

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image007 "border=" 0 "alt=" clip_image007 "src=" http://s3.51cto.com/wyfs02/M01/77/88/ Wkiol1zpd9jb9bszaaa3mzu5gzw292.jpg "" 228 "height=" 244 "/>

Figure 5.3 VRRP Case network topology diagram

Configure the network according to network planning.

1 , configuration device basic information (interface IP, VLAN, TRUNK, Routing and other configuration), configuration omitted;

The configuration requires that the three-layer switch enables routing, VLAN virtual ports need to be on, three-layer switch ports enable three-tier features, and the physical IP address of the interface configuration.

2 , configuration VRRP

Configure the VRRP on SW1 and SW2, respectively, as follows:

SW1 Configuration

SW1 (config) #track 1 interface FASTETHERNET0/1 Line-protocol//define the port of the trace

SW1 (config) #interface Vlan2

SW1 (config-if) #ip address 192.168.2.1 255.255.255.0

SW1 (config-if) #vrrp 2 IP 192.168.2.254//Configure virtual IP address

SW1 (config-if) #vrrp 2 Timers Learn

SW1 (CONFIG-IF) #vrrp 2 Priorities 150//configuration Priority 150

SW1 (CONFIG-IF) #vrrp 2 track 1 decrement 100//Configure Port Tracking

SW1 (config-if) #exit

SW1 (config) #interface Vlan3//priority using default configuration of 100 and no trace port required

SW1 (config-if) #ip address 192.168.3.1 255.255.255.0

SW1 (config-if) #vrrp 3 IP 192.168.3.254

SW1 (config-if) #vrrp 3 Timers Learn//Configure the VRRP notification time from the primary router

SW1 (config-if) #exit

SW2 Configuration

SW2 (config) #track 1 interface fastethernet0/1 Line-protocol

SW2 (config) #interface Vlan2

SW2 (config-if) #ip address 192.168.2.2 255.255.255.0

SW2 (config-if) #vrrp 2 IP 192.168.2.254

SW2 (config-if) #vrrp 2 Timers Learn

SW2 (config-if) #exit

SW2 (config) #interface Vlan3

SW2 (config-if) #ip address 192.168.3.2 255.255.255.0

SW2 (config-if) #vrrp 3 IP 192.168.3.254

SW2 (config-if) #vrrp 3 Timers Learn

SW2 (CONFIG-IF) #vrrp 3 Priority 150

SW2 (CONFIG-IF) #vrrp 3 track 1 decrement 100

SW2 (config-if) #exit

3 , configuring STP for VLAN load Balancing

The configuration information for the SW1 is as follows:

SW1 (config) #spanning-tree VLAN 2 Root Primary

SW1 (config) #spanning-tree VLAN 3 root Secondary

The configuration information for the SW2 is as follows:

SW2 (config) #spanning-tree VLAN 2 root Secondary

SW2 (config) #spanning-tree VLAN 3 Root Primary

This ensures that the ports that are blocked by the STP instance of the VLAN2 are one of the SW2 and SW3 connection ports, and that the port that the VLAN3 STP instance blocks is one of the SW1 and SW3 connections. This ensures that the links from the SW3 to the primary router are not blocked by different VLANs.

4 , verify VRRP

Use the show VRRP command to view the VRRP details as follows:

Sw1#show VRRP

Vlan2-group 2

State is Master

Virtual IP Address is 192.168.2.254

Virtual MAC Address is 0000.5e00.0102

Advertisement Interval is 1.000 sec

Preemption enabled

Priority is 150

Track Object 1 State up decrement 100

Master Router is 192.168.2.1 (local), priority is 150

Master advertisement Interval is 1.000 sec

Master down Interval is 3.414 sec

Vlan3-group 3

State is Backup

Virtual IP Address is 192.168.3.254

Virtual MAC Address is 0000.5e00.0103

Advertisement Interval is 1.000 sec

Preemption enabled

Priority is 100

Master Router is 192.168.3.2 150

Master advertisement Interval is 1.000 sec

Master down Interval are 3.609 sec (expires in 3.225 sec) learning

You can also use the show VRRP Brief command to view VRRP's brief information, as follows:

Sw1#show VRRP Brief

Interface Grp Pri Time Own Pre State Master addr Group Addr

VL2 2 3414 Y Master 192.168.2.1 192.168.2.254

Vl3 3 3609 Y Backup 192.168.3.2 192.168.3.254

Use the ping command on PC1 and PC2 (gateway as virtual IP address) to communicate with R1 (192.168.100.1), respectively.

Verify the hot backup, disconnect the SW1 switch and the R1 link, and then use the show VRRP Brief command to view the VRRP status on the switch as follows:

Sw1#show VRRP Brief

Interface Grp Pri Time Own Pre State Master addr Group Addr

VL2 2 3414 Y Backup 192.168.2.2 192.168.2.254

Vl3 3 3609 Y Backup 192.168.3.2 192.168.3.254

Sw2#show VRRP Brief

Interface Grp Pri Time Own Pre State Master addr Group Addr

VL2 2 3609 Y Master 192.168.2.2 192.168.2.254

Vl3 3 3414 Y Master 192.168.3.2 192.168.3.254

The primary switch has a reduced priority, the backup switch becomes the primary switch, and PC1 and PC2 communicate with the router R1 properly.

Then restore the SW1 switch and the R1 link, then disconnect the SW2 switch and SW3, and verify the hot backup. Similarly, the primary switch priority drops, the backup switch becomes the primary switch, and the PC1 and PC2 communicate with the router R1 properly.

Virtual Router Redundancy Protocol (VRRP)

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.