Configuring VRRP

This chapter contains the following sections:

About VRRP

VRRP allows for a transparent failover at the first-hop IP router by configuring a group of routers to share a virtual IP address. VRRP selects an allowed router in that group to handle all packets for the virtual IP address. The remaining routers are in standby and take over if the allowed router fails.

VRRP Operation

A LAN client can determine which router should be the first hop to a particular remote destination by using a dynamic process or static configuration. Examples of dynamic router discovery are as follows:

Proxy ARP—The client uses Address Resolution Protocol (ARP) to get the destination it wants to reach, and a router responds to the ARP request with its own MAC address.

Routing protocol—The client listens to dynamic routing protocol updates.

The disadvantage to dynamic discovery protocols is that they incur some configuration and processing overhead on the LAN client. Also, if a router fails, the process of switching to another router can be slow.

An alternative to dynamic discovery protocols is to statically configure a default router on the client. Although this approach simplifies client configuration and processing, it creates a single point of failure. If the default gateway fails, the LAN client is limited to communicating only on the local IP network segment and is cut off from the rest of the network.

VRRP can solve the static configuration problem by enabling a group of routers (a VRRP group) to share a single virtual IP address. You can then configure the LAN clients with the virtual IP address as their default gateway.

The following figure shows a basic VLAN topology. In this example, Routers A, B, and C form a VRRP group. The IP address of the group is the same address that was configured for the Ethernet interface of Router A (10.0.0.1).

Figure 1. Basic VRRP Topology

Because the virtual IP address uses the IP address of the physical Ethernet interface of Router A, Router A is the primary (also known as the IP address owner). As the primary, Router A owns the virtual IP address of the VRRP group and forwards packets sent to this IP address. Clients 1 through 3 are configured with the default gateway IP address of 10.0.0.1.

Routers B and C function as backups. If the primary fails, the backup router with the highest priority becomes the primary and takes over the virtual IP address to provide uninterrupted service for the LAN hosts. When Router A recovers, it becomes the primary again.


Note

Packets received on a routed port destined for the VRRP virtual IP address terminate on the local router, regardless of whether that router is the primary VRRP router or a backup VRRP router. These packets include ping and Telnet traffic. Packets received on a Layer 2 (VLAN) interface destined for the VRRP virtual IP address terminate on the primary router.


VRRP Benefits

The benefits of VRRP are as follows:

  • Redundancy—Enables you to configure multiple routers as the default gateway router, which reduces the possibility of a single point of failure in a network.

  • Load sharing—Allows traffic to and from LAN clients to be shared by multiple routers. The traffic load is shared more equitably among available routers.

  • Multiple VRRP groups—Supports multiple VRRP groups on a router physical interface if the platform supports multiple MAC addresses. Multiple VRRP groups enable you to implement redundancy and load sharing in your LAN topology.

  • Multiple IP addresses—Allows you to manage multiple IP addresses, including secondary IP addresses. If you have multiple subnets that are configured on an Ethernet interface, you can configure VRRP on each subnet.

  • Preemption—Enables you to preempt a backup router that has taken over for a failing primary with a higher priority backup router that has become available.

  • Advertisement protocol—Uses a dedicated Internet Assigned Numbers Authority (IANA) standard multicast address (224.0.0.18) for VRRP advertisements. This addressing scheme minimizes the number of routers that must service the multicasts and allows test equipment to accurately identify VRRP packets on a segment. IANA has assigned the IP protocol number 112 to VRRP.

  • VRRP tracking—Ensures that the best VRRP router is the primary for the group by altering VRRP priorities based on interface states.

Multiple VRRP Groups

You can configure multiple VRRP groups on a physical interface. For the number of supported VRRP groups, see the Cisco Nexus® 3550-T Verified Scalability Guide.

The number of VRRP groups that a router interface can support depends on the following factors:

  • Router processing capability

  • Router memory capability

In a topology where multiple VRRP groups are configured on a router interface, the interface can act as a primary for one VRRP group and as a backup for one or more other VRRP groups.

The following image shows a LAN topology in which VRRP is configured so that Routers A and B share the traffic to and from clients 1 through 4. Routers A and B act as backups to each other if either router fails.

Figure 2. Load Sharing and Redundancy VRRP Topology

This topology contains two virtual IP addresses for two VRRP groups that overlap. For VRRP group 1, Router A is the owner of IP address 10.0.0.1 and is the primary. Router B is the backup to Router A. Clients 1 and 2 are configured with the default gateway IP address of 10.0.0.1.

For VRRP group 2, Router B is the owner of IP address 10.0.0.2 and is the primary. Router A is the backup to router B. Clients 3 and 4 are configured with the default gateway IP address of 10.0.0.2.

VRRP Router Priority and Preemption

An important aspect of the VRRP redundancy scheme is the VRRP router priority because the priority determines the role that each VRRP router plays and what happens if the primary router fails.

If a VRRP router owns the virtual IP address and the IP address of the physical interface, this router functions as the primary. The priority of the primary is 255.

The priority also determines if a VRRP router functions as a backup router and the order of ascendancy to becoming a primary if the primary fails.

For example, if Router A, the primary in a LAN topology, fails, VRRP must determine if backups B or C should take over. If you configure Router B with priority 101 and Router C with the default priority of 100, VRRP selects Router B to become the primary because it has the higher priority. If you configure Routers B and C with the default priority of 100, VRRP selects the backup with the higher IP address to become the primary.

VRRP uses preemption to determine what happens after a VRRP backup router becomes the primary. With preemption enabled by default, VRRP switches to a backup if that backup comes online with a priority higher than the new primary. For example, if Router A is the primary and fails, VRRP selects Router B (next in order of priority). If Router C comes online with a higher priority than Router B, VRRP selects Router C as the new primary, even though Router B has not failed.

If you disable preemption, VRRP switches only if the original primary recovers or the new primary fails.

VRRP Advertisements

The VRRP primary sends VRRP advertisements to other VRRP routers in the same group. The advertisements communicate the priority and state of the primary. Cisco NX-OS encapsulates the VRRP advertisements in IP packets and sends them to the IP multicast address assigned to the VRRP group. Cisco NX-OS sends the advertisements once every second by default, but you can configure a different advertisement interval.

VRRP Authentication

VRRP supports the following authentication functions:

  • No authentication

  • Plain text authentication

VRRP rejects packets in any of the following cases:

  • The authentication schemes differ on the router and in the incoming packet.

  • Text authentication strings differ on the router and in the incoming packet.

VRRP Tracking

VRRP supports the following options for tracking:

  • Native interface tracking—Tracks the state of an interface and uses that state to determine the priority of the VRRP router in a VRRP group. The tracked state is down if the interface is down or if the interface does not have a primary IP address.

  • Object tracking—Tracks the state of a configured object and uses that state to determine the priority of the VRRP router in a VRRP group. See the Configuring Object Tracking section, for more information on object tracking.

If the tracked state (interface or object) goes down, VRRP updates the priority based on what you configure the new priority to be for the tracked state. When the tracked state comes up, VRRP restores the original priority for the virtual router group.

For example, you might want to lower the priority of a VRRP group member if its uplink to the network goes down so another group member can take over as primary for the VRRP group. See the Configuring VRRP Interface State Tracking section for more information.


Note

VRRP does not support Layer 2 interface tracking.


High Availability

VRRP supports high availability through stateful restarts and stateful switchovers. A stateful restart occurs when the VRRP process fails and is restarted. A stateful switchover occurs when the active supervisor switches to the standby supervisor. Cisco NX-OS applies the run-time configuration after the switchover.

Virtualization Support

VRRP supports virtual routing and forwarding (VRF) instances.

Guidelines and Limitations for VRRP

VRRP has the following configuration guidelines and limitations:

  • You cannot configure VRRP on the management interface.

  • When VRRP is enabled, you should replicate the VRRP configuration across devices in your network.

  • We recommend that you do not configure more than one first-hop redundancy protocol on the same interface.

  • You must configure an IP address for the interface on which you configure VRRP and enable that interface before VRRP becomes active.

  • Cisco NX-OS removes all Layer 3 configurations on an interface when you change the interface VRF membership or the port channel membership or when you change the port mode to Layer 2.

  • When you configure VRRP to track a Layer 2 interface, you must shut down the Layer 2 interface and reenable the interface to update the VRRP priority to reflect the state of the Layer 2 interface.

Default Settings for VRRP Parameters

The following table lists the default settings for VRRP parameters.

Table 1. Default VRRP Parameters
Parameters Default

VRRP

Disabled

Advertisement interval

1 second

Authentication

No authentication

Preemption

Enabled

Priority

100

Configuring VRRP


Note

If you are familiar with the Cisco IOS CLI, be aware that the Cisco NX-OS commands for this feature might differ from the Cisco IOS commands that you would use.


Enabling VRRP

You must globally enable VRRP before you configure and enable any VRRP groups.

Procedure

  Command or Action Purpose
Step 1

configure terminal

Example:

switch# configure terminal
switch(config)#

Enters global configuration mode.

Step 2

[no] feature vrrp

Example:

switch(config)# feature vrrp

Enables VRRP. Use the no form of this command to disable VRRP.

Step 3

(Optional) copy running-config startup-config

Example:

switch(config)# copy running-config startup-config
(Optional)

Copies the running configuration to the startup configuration.

Configuring VRRP Groups

You can create a VRRP group, assign the virtual IP address, and enable the group.

You can configure one virtual IPv4 address for a VRRP group. By default, the primary VRRP router drops the packets addressed directly to the virtual IP address because the VRRP primary is intended only as a next-hop router to forward packets. Some applications require that Cisco NX-OS accept packets that are addressed to the virtual router IP address. Use the secondary option to the virtual IP address to accept these packets when the local router is the VRRP primary.

Once you have configured the VRRP group, you must explicitly enable the group before it becomes active.

Before you begin

Ensure that you have configured an IP address on the interface. See Configuring IPv4 Addressing.

Procedure

  Command or Action Purpose
Step 1

configure terminal

Example:

switch# configure terminal
switch(config)#

Enters global configuration mode.

Step 2

interface interface-type slot/port

Example:

switch(config)# interface ethernet 1/1
switch(config-if)# 

Enters interface configuration mode.

Step 3

vrrp number

Example:

switch(config-if)# vrrp 250
switch(config-if-vrrp)#

Creates a virtual router group. The range is 1–255.

Step 4

address ip-address [secondary]

Example:

switch(config-if-vrrp)# address 192.0.2.8

Configures the virtual IPv4 address for the specified VRRP group. This address should be in the same subnet as the IPv4 address of the interface.

Use the secondary option only if applications require that VRRP routers accept the packets sent to the virtual router's IP address and deliver to applications.

Step 5

no shutdown

Example:

switch(config-if-vrrp)# no shutdown

Enables the VRRP group, which is disabled by default.

Step 6

(Optional) show vrrp

Example:

switch(config-if-vrrp)# show vrrp
(Optional)

Displays a summary of VRRP information.

Step 7

(Optional) copy running-config startup-config

Example:

switch(config-if-vrrp)# copy running-config startup-config
(Optional)

Copies the running configuration to the startup configuration.

Configuring VRRP Priority

The valid priority range for a virtual router is from 1 to 254 (1 is the lowest priority and 254 is the highest). The default priority value for backups is 100. For devices whose interface IP address is the same as the primary virtual IP address (the primary), the default value is 255.

Before you begin

Ensure that you have configured an IP address on the interface. See Configuring IPv4 Addressing.

Ensure that you have enabled VRRP. (see the Configuring VRRP section).

Procedure

  Command or Action Purpose
Step 1

configure terminal

Example:

switch# configure terminal
switch(config)#

Enters global configuration mode.

Step 2

interface interface-type slot/port

Example:

switch(config)# interface ethernet 1/1
switch(config-if)# 

Enters interface configuration mode.

Step 3

vrrp number

Example:

switch(config-if)# vrrp 250
switch(config-if-vrrp)#

Creates a virtual router group.

Step 4

shutdown

Example:

switch(config-if-vrrp)# shutdown

Disables the VRRP group.

Step 5

priority level [forwarding-threshold lower lower-value upper upper-value]

Example:

switch(config-if-vrrp)# priority 60 forwarding-threshold lower 40 upper 50

Sets the priority level used to select the active router in a VRRP group. The level range is 1–254. The default is 100 for backups and 255 for a primary that has an interface IP address equal to the virtual IP address.

Step 6

no shutdown

Example:

switch(config-if-vrrp)# no shutdown

Enables the VRRP group.

Step 7

(Optional) show vrrp

Example:

switch(config-if-vrrp)# show vrrp
(Optional)

Displays a summary of VRRP information.

Step 8

(Optional) copy running-config startup-config

Example:

switch(config-if-vrrp)# copy running-config startup-config
(Optional)

Copies the running configuration to the startup configuration.

Configuring VRRP Authentication

You can configure simple text authentication for a VRRP group.

Before you begin

Ensure that you have configured an IP address on the interface (see Configuring IPv4 Addressing).

Ensure that you have enabled VRRP (see the Configuring VRRP section).

Ensure that the authentication configuration is identical for all VRRP devices in the network.

Procedure

  Command or Action Purpose
Step 1

configure terminal

Example:

switch# configure terminal
switch(config)#

Enters global configuration mode.

Step 2

interface interface-type slot/port

Example:

switch(config)# interface ethernet 1/1
switch(config-if)# 

Enters interface configuration mode.

Step 3

vrrp number

Example:

switch(config-if)# vrrp 250
switch(config-if-vrrp)#

Creates a virtual router group.

Step 4

shutdown

Example:

switch(config-if-vrrp)# shutdown

Disables the VRRP group.

Step 5

authentication text password

Example:

switch(config-if-vrrp)# authentication text aPassword
Assigns the simple text authentication option and specifies the keyname password. The keyname range is from 1 to 255 characters. We recommend that you use at least 16 characters. The text password is up to eight alphanumeric characters.
Step 6

no shutdown

Example:

switch(config-if-vrrp)# no shutdown

Enables the VRRP group, which is disabled by default.

Step 7

(Optional) show vrrp

Example:

switch(config-if-vrrp)# show vrrp
(Optional)

Displays a summary of VRRP information.

Step 8

(Optional) copy running-config startup-config

Example:

switch(config-if-vrrp)# copy running-config startup-config
(Optional)

Copies the running configuration to the startup configuration.

Configuring Time Intervals for Advertisement Packets

You can configure the time intervals for advertisement packets.

Before you begin

Ensure that you have configured an IP address on the interface (see Configuring IPv4 Addressing).

Ensure that you have enabled VRRP (see the Configuring VRRP section).

Procedure

  Command or Action Purpose
Step 1

configure terminal

Example:

switch# configure terminal
switch(config)#

Enters global configuration mode.

Step 2

interface interface-type slot/port

Example:

switch(config)# interface ethernet 1/1
switch(config-if)# 

Enters interface configuration mode.

Step 3

vrrp number

Example:

switch(config-if)# vrrp 250
switch(config-if-vrrp)#

Creates a virtual router group.

Step 4

shutdown

Example:

switch(config-if-vrrp)# shutdown

Disables the VRRP group.

Step 5

advertisement interval seconds

Example:

switch(config-if-vrrp)# advertisement-interval 15
Sets the interval time in seconds between sending advertisement frames. The range is from 1 to 255. The default is 1 second.
Step 6

no shutdown

Example:

switch(config-if-vrrp)# no shutdown

Enables the VRRP group.

Step 7

(Optional) show vrrp

Example:

switch(config-if-vrrp)# show vrrp
(Optional)

Displays a summary of VRRP information.

Step 8

(Optional) copy running-config startup-config

Example:

switch(config-if-vrrp)# copy running-config startup-config
(Optional)

Copies the running configuration to the startup configuration.

Disabling Preemption

You can disable preemption for a VRRP group member. If you disable preemption, a higher-priority backup router does not take over for a lower-priority primary router. Preemption is enabled by default.

Before you begin

Ensure that you have configured an IP address on the interface. See Configuring IPv4 Addressing.

Ensure that you have enabled VRRP. See the Configuring VRRP section.

Procedure

  Command or Action Purpose
Step 1

configure terminal

Example:

switch# configure terminal
				switch(config)#
			

Enters global configuration mode.

Step 2

interface interface-type slot/port

Example:

switch(config)# interface ethernet 1/1
				switch(config-if)# 

Enters interface configuration mode.

Step 3

vrrp number

Example:

switch(config-if)# vrrp 250
				switch(config-if-vrrp)#

Creates a virtual router group.

Step 4

shutdown

Example:

switch(config-if-vrrp)# shutdown
			

Disables the VRRP group.

Step 5

no preempt

Example:

switch(config-if-vrrp)# no preempt
Disables the preempt option and allows the primary to remain when a higher-priority backup appears.
Step 6

no shutdown

Example:

switch(config-if-vrrp)# no shutdown
			

Enables the VRRP group.

Step 7

(Optional) show vrrp

Example:

switch(config-if-vrrp)# show vrrp
(Optional)

Displays a summary of VRRP information.

Step 8

(Optional) copy running-config startup-config

Example:

switch(config-if-vrrp)# copy running-config startup-config
			
(Optional)

Copies the running configuration to the startup configuration.

Configuring VRRP Interface State Tracking

Interface state tracking changes the priority of the virtual router based on the state of another interface in the device. When the tracked interface goes down or the IP address is removed, Cisco NX-OS assigns the tracking priority value to the virtual router. When the tracked interface comes up and an IP address is configured on this interface, Cisco NX-OS restores the configured priority to the virtual router (see the Configuring VRRP Priority section).


Note

VRRP does not support Layer 2 interface tracking.


Before you begin

Ensure that you have configured an IP address on the interface (see Configuring IPv4 Addressing).

Ensure that you have enabled VRRP (see the Configuring VRRP section).

Ensure that you have enabled the virtual router (see the Configuring VRRP Groups section).

Ensure that you have enabled preemption on the interface.

Procedure

  Command or Action Purpose
Step 1

configure terminal

Example:

switch# configure terminal
switch(config)#

Enters global configuration mode.

Step 2

interface interface-type slot/port

Example:

switch(config)# interface ethernet 1/1
switch(config-if)# 

Enters interface configuration mode.

Step 3

vrrp number

Example:

switch(config-if)# vrrp 250
switch(config-if-vrrp)#

Creates a virtual router group.

Step 4

shutdown

Example:

switch(config-if-vrrp)# shutdown

Disables the VRRP group.

Step 5

track interface type slot/port priority value

Example:

switch(config-if-vrrp)# track interface ethernet 1/10 priority 254
Enables interface priority tracking for a VRRP group. The priority range is from 1 to 254.
Step 6

no shutdown

Example:

switch(config-if-vrrp)# no shutdown

Enables the VRRP group.

Step 7

(Optional) show vrrp

Example:

switch(config-if-vrrp)# show vrrp
(Optional)

Displays a summary of VRRP information.

Step 8

(Optional) copy running-config startup-config

Example:

switch(config-if-vrrp)# copy running-config startup-config
(Optional)

Copies the running configuration to the startup configuration.

Configuring VRRP Object Tracking

You can track an IPv4 object using VRRP.

Before you begin

Make sure that VRRP is enabled.

Configure object tracking using the commands in the Configuring Object Tracking section.

Procedure

  Command or Action Purpose
Step 1

configure terminal

Example:

switch# configure terminal
switch(config)#

Enters global configuration mode.

Step 2

interface type number

Example:

switch(config)#
switch(config-if)# interface ethernet 1/1
switch(config-if)# 

Specifies an interface and enters interface configuration mode.

Step 3

vrrp number address-family ipv4

Example:

switch(config-if)# vrrp 5
address-family ipv4
switch(config-if-vrrp-group)#

Creates a VRRP group for IPv4 and enters VRRP vrrp number address-family ipv4 group configuration mode. The range is from 1 to 255.

Step 4

track object-number decrement number

Example:

switch(config-if-vrrp-group)# track 1
decrement 2

Creates a virtual router group. The range is from 1 to 255.

Step 5

(Optional) show running-config vrrp

Example:

switch(config-if-vrrp-group)# show
running-config vrrp
(Optional)

Displays the running configuration for VRRP.

Step 6

(Optional) copy running-config startup-config

Example:

switch(config-if-vrrp-group)# copy
running-config startup-config
(Optional)

Saves this configuration change.

Verifying the VRRP Configuration

To display VRRP configuration information, perform one of the following tasks:

Command

Purpose

show interface interface-type

Displays the virtual router configuration for an interface.

show fhrp interface-type interface-number

Displays First Hop Redundancy Protocol (FHRP) information.

show vrrp [group-number]

Displays the VRRP status for all groups or for a specific VRRP group.

Monitoring and Clearing VRRP Statistics

To display VRRP statistics, use the following commands:

Command

Purpose

show vrrp statistics

Displays the VRRP statistics.

Use the clear vrrp statistics command to clear the VRRP statistics for all interfaces on the device.

Configuration Examples for VRRP

In this example, Router A and Router B each belong to three VRRP groups. In the configuration, each group has the following properties:

  • Group 1:

    • Virtual IP address is 10.1.0.10.

    • Router A becomes the primary for this group with priority 120.

    • Advertising interval is 3 seconds.

    • Preemption is enabled.

  • Group 5:

    • Router B becomes the primary for this group with priority 200.

    • Advertising interval is 30 seconds.

    • Preemption is enabled.

  • Group 100:

    • Router A becomes the primary for this group first because it has a higher IP address (10.1.0.2).

    • Advertising interval is the default of 1 second.

    • Preemption is disabled.

Router A
switch (config)# interface ethernet 1/1
switch (config-if)# ip address 10.1.0.2/16   
switch (config-if)# no shutdown
switch (config-if)# vrrp 1  
switch (config-if-vrrp)# priority 120 
switch (config-if-vrrp)# authentication text cisco
switch (config-if-vrrp)# advertisement-interval 3
switch (config-if-vrrp)# address 10.1.0.10 
switch (config-if-vrrp)# no shutdown
switch (config-if-vrrp)# exit
switch (config-if)# vrrp 5  
switch (config-if-vrrp)# priority 100 
switch (config-if-vrrp)# advertisement-interval 30 
switch (config-if-vrrp)# address 10.1.0.50 
switch (config-if-vrrp)# no shutdown
switch (config-if-vrrp)# exit
switch (config-if)# vrrp 100  
switch (config-if-vrrp)# no preempt 
switch (config-if-vrrp)# address 10.1.0.100 
switch (config-if-vrrp)# no shutdown
Router B
switch (config)# interface ethernet 1/1
switch (config-if)# ip address 10.2.0.1/2 
switch (config-if)# no shutdown
switch (config-if)# vrrp 1  
switch (config-if-vrrp)# priority 100 
switch (config-if-vrrp)# authentication text cisco 
switch (config-if-vrrp)# advertisement-interval 3 
switch (config-if-vrrp)# address 10.2.0.10 
switch (config-if-vrrp)# no shutdown
switch (config-if-vrrp)# exit
switch (config-if)# vrrp 5 
switch (config-if-vrrp)# priority 200 
switch (config-if-vrrp)# advertisement-interval 30 
switch (config-if-vrrp)# address 10.2.0.50 
switch (config-if-vrrp)# no shutdown
switch (config-if-vrrp)# exit
switch (config-if)# vrrp 100  
switch (config-if-vrrp)# no preempt 
switch (config-if-vrrp)# address 10.2.0.100 
switch (config-if-vrrp)# no shutdown