Junos Basics – Virtual Router Redundancy Protocol (VRRP)

By | July 30, 2013

In my previous Junos Basics post I covered aggregating ethernet interfaces using LACP on a Juniper switch. In this post I’ll cover a simple VRRP configuration in Junos that provides first hop router redundancy for clients on a local LAN segment.

Here’s our network:

Junos VRRP

Note – all routers are running OSPF, with both interfaces on the Core router, and interface e1 on R1 and e1 on R2 all in OSPF area 0.

Objectives:

  • first hop redundancy for clients on LAN 192.168.1.0/24 out to the core router
  • clients on 192.168.1.0/24 use a default gateway of 192.168.1.3
  • R1 is the master router
  • R1 tracks the IP route to 10.0.0.4/30
  • R1’s priority drops below 100 if there is a loss of the route 10.0.0.4/30 causing R2 to take over forwarding packets for clients on the LAN
  • R1 becomes the master router again if it’s route to 10.0.0.4/30 comes back up

First of all lets just confirm that our OSPF is working and that R1 has learnt the route to 10.0.0.4/30:

root@R1# run show route protocol ospf

inet.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

10.0.0.4/30        *[OSPF/10] 00:48:20, metric 2
                    > to 10.0.0.1 via em1.0

We’ll start the config on R1, by creating the VRRP group and virtual address on the LAN interface:

[edit interfaces em0 unit 0 family inet address 192.168.1.1/24]

root@R1#
set vrrp-group 10 virtual-address 192.168.1.3

To make sure that R1 is the master router we’ll set it’s priority to 200:

set vrrp-group 10 priority 200

Next, we tell R1 to track the route to 10.0.0.4/30, and to decrease its priority to 99 if the route drops out of R1’s routing table:

set vrrp-group 10 track route 10.0.0.4/30 routing-instance default priority-cost 101

Then we use the preempt command to make sure R1 resumes the master role once the route reappears in the routing table:

set vrrp-group 10 preempt

Now, onto R2. As this router is not the Master, the configuration is very simple – all we need to do is create the VRRP group and set the virtual address on the LAN interface. We don’t even need to set the priority to 100 to make the route tracking mechanism on R1 cause a fail over, as 100 is the default value:

[edit interfaces em0 unit 0 family inet address 192.168.1.2/24]
root@R2# show | display set
set interfaces em0 unit 0 family inet address 192.168.1.2/24 vrrp-group 10 virtual-address 192.168.1.3

That’s it for our simple VRRP config, and now clients on the local LAN have a redundant default gateway to get traffic out to the core router, with automatic fail over from R1 to R2 in the event of R1 losing it’s route to the core.

I hope this has been a useful explanation.  In my next Junos Basics post I’ll cover single area OSPF routing.

Thanks for reading.

Rich

Follow Rich on Twitter

5 thoughts on “Junos Basics – Virtual Router Redundancy Protocol (VRRP)

  1. Pranawesh

    Hi Bibby,
    Can we enabled preempt in both the router with same delay….

    Reply
  2. Johan

    Why track the route to R2’s link to the core router and not interface tracking of e1 on R1?

    Couldn’t the route to that network segment be lost by other causes and cause a failover when it isn’t needed?

    Reply
    1. Hien

      The route to the core router has been learned by direct route. This should be confirmed that the route to the backup router is still reachable so that both master and backup routers can communicate each others.

      Reply
  3. Ankush Kaul

    For me when the route comes up, the Priority hold time doesn’t run and the priority still remains lowered keeping R1 as backup.

    Reply
  4. Basem Shalabi

    Thank you for your job
    I have enabled vrrp on IRB interfaces on two switches but the state is down ? How can solve that .

    Thank u
    Basem

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *