Understanding Route Preference Values on Juniper (Administrative Distance)

We continue our journey with the routing topic on Juniper, and now I want to speak about the Route Preference. If you come from the Cisco world, it is called Administrative distance.

What does it mean the route preference. Every routing protocol, whether static or dynamic, has a route preference which is a value (a number). This plays a major role when for example you are running 2 routing protocols on the same network and both take you to the destination that you wish to reach. Then the router will check which one has a lowest route preference and will choose its routing protocol to reach to the destination network.

I am still on the LAB where I have configured static routes, and I would like to show you where the route preference is shown:

root@R2> show route

inet.0: 4 destinations, 4 routes (4 active, 0 holddown, 0 hidden)

+ = Active Route, – = Last Active, * = Both

 

0.0.0.0/0          *[Static/5] 00:25:39

> to 192.168.12.1 via ge-0/0/2.0

2.2.2.2/32         *[Direct/0] 00:35:33

> via lo0.0

192.168.12.0/24    *[Direct/0] 00:35:33

> via ge-0/0/2.0

192.168.12.2/32    *[Local/0] 00:35:33

Local via ge-0/0/2.0

root@R2>

As you see, in the routing table at each entry it shows the value of the preference depending on what routing protocol you are using. For example, static has a preference of 5, Direct of 0, Local of 0, and so on.

Let’s do an example and see if you guess which of the routing protocol will be used in case we have 2 routing protocols enabled on the same network taking to the same destination:

In this scenario, 1.1.1.1 can reach 2.2.2.2 using RIP having a path R1, R2

And

  • can reach 2.2.2.2 using OSPF having a path R1, R3, R2.

Do you think, which path will R1 choose? The answer is simple. As R1 have 2 different paths to reach the destination network using 2 different routing protocols (RIP and OSPF), he will check which of the 2 routing protocols has the lower preference.

On Juniper, RIP and OSPF have the following preference value:

  • RIP: 100
  • OSPF: 10

I bet that you have guessed, it will take the way that OSPF is configured because it has a lowest preference.

The last thing that I want to show you in that you can change the default preference on a routing entry and make it lower or higher, meaning that if I want that R1 takes the path where the RIP is configured, I can make RIP preference lower than OSPF, this way it will take the path of RIP.

Let me show you how you can change the preference of a static route (same applies for any other type of routes).

root@R2> show route

inet.0: 4 destinations, 4 routes (4 active, 0 holddown, 0 hidden)

+ = Active Route, – = Last Active, * = Both

0.0.0.0/0          *[Static/5] 00:25:39

> to 192.168.12.1 via ge-0/0/2.0

2.2.2.2/32         *[Direct/0] 00:35:33

> via lo0.0

192.168.12.0/24    *[Direct/0] 00:35:33

> via ge-0/0/2.0

192.168.12.2/32    *[Local/0] 00:35:33

Local via ge-0/0/2.0

We have the default static route on R2 having a preference of 5. Let’s change it and make it 3 for example:

[edit routing-options]

root@R2# set static route 0.0.0.0/0 next-hop 192.168.12.1 preference 3

[edit routing-options]

root@R2# show

static {

route 0.0.0.0/0 {

next-hop 192.168.12.1;

preference 3;

}

}

[edit routing-options]

root@R2#

Let’s commit and see if it has changed on the routing table:

root@R2# commit and-quit

commit complete

Exiting configuration mode

root@R2> show route

inet.0: 4 destinations, 4 routes (4 active, 0 holddown, 0 hidden)

+ = Active Route, – = Last Active, * = Both

0.0.0.0/0          *[Static/3] 00:01:07

> to 192.168.12.1 via ge-0/0/2.0

2.2.2.2/32         *[Direct/0] 00:53:38

> via lo0.0

192.168.12.0/24    *[Direct/0] 00:53:38

> via ge-0/0/2.0

192.168.12.2/32    *[Local/0] 00:53:38

Local via ge-0/0/2.0

root@R2>

Indeed, this has benn changed 😊 – this way you can play with the preference.

This is all what I wanted to show you in this lesson, hope you enjoyed it and see you in the upcoming one.

Course Content

0 Comments

Submit a Comment

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


The reCAPTCHA verification period has expired. Please reload the page.

About