In this section we will talk about static routing and specifically juniper static routing concepts. First, we’ll go through some routing concepts as a whole, and then pay attention to some concepts and terminologies specific to Juniper devices.
This section is dedicated to the theoretical concepts of static routing, and in the next section we will start to implement these concepts in juniper devices.
First, I must emphasize that I am assuming that students taking this course already have a reasonable understanding of the Cisco CCNA course, and I will only review the concepts.
How Routing Works?
We will start with the concept of routing.
To better understand it, let’s review and compare the operation of switches and routers.
As you know, switches that usually route traffic based on destination MAC address, look up MAC address in MAC table to find outgoing interface and if there is no route in MAC table , traffic is still forwarded or flooded to all interfaces.
In other words, computers connected to switches can always communicate to each other even if there is no route in any switches.
Unlike switches, routers, which forward traffic based on destination IP address, must find the outgoing interface and next-hop IP address in the routing tables, otherwise the traffic is discarded.
In other words, computer and network cannot communicate with each other through any router until the route to those networks is already configured in the router.
For example, in this figure, router R1 needs to know that the route to destination 172.16.2.1 is via router R2 with address or next-hop address 10.10.10.2.
Router R2 also needs to know that the route to destination 172.16.1.1 is via next-hop IP address 10.10.10.1.
otherwise these two networks (172.16.1.0/24 and 172.16.2.0/24) cannot communicate with each other.
Dynamic and Static Routing
Routes to destinations can be statically configured in the routers or they can be created dynamically using routing protocols such as OSPF and BGP.
The problem with static routing is that it is not scalable in in the large networks you have configure many routes in different routers.
Worse, every time there is a topology change in the network, we have to manually update the routes in the routers, otherwise the communication will be disrupted.
These are the benefits of dynamic routing. First, even in large networks, it dynamically creates routes in the routers. and when there are topology changes, the routes are updated dynamically and as quickly as possible.
in our example, the path from R1 to 172.16.2.1 is through the primary link with router R2 with next-hop IP address 10.10.10.2. But when the link fails, the path must be changed to the secondary link with router R2 and with IP address 126.96.36.199.
in static routing, routing table must be changed manually but in dynamic routing, it will be updated dynamically and through routing protocols.
In this course, we will talk a little about dynamic routing but they are mostly discussed in juniper enterprise routing and switching courses.
Most-Specific Route (Longest prefix Match)
There is a very basic and very important rule in routing that every network engineer must know it.
If the destination address of incoming traffic on a router matches with more than one route in the routing table, which path is selected to forwarded the traffic?
In the example, you can see that a traffic with destination address 172.16.2.1 must be forwarded through router R1. In router R1, there are two routes matching the traffic.
All traffic with the destination address in the subnet 172.16.2.0/24 is forwarded using the above link with the next-hop address 10.10.10.2.
And all traffic with single destination address 172.16.2.1/32 is forwarded via the link below with next-hop address 188.8.131.52.
Traffic with destination address 172.16.2.1 is matched with both routes in the routing table and now the question is, which path will be selected to forward the traffic.
The keyword “most specific route” or the route with longest prefix match or the route with the largest subnet mask length matching destination address is answer of this question. In other words the route with longest match will be selected to forward the traffic.
in the example, the link below is selected to forward the traffic because all 32 bits of the destination IP are matched with the route pointing to 184.108.40.206 as the next-hop address.
This rule can be useful to reduce the number of routes in the routing table since we don’t need to add a route for each destination in the network.
The most practical application of the longest prefix match rule is the default route, which is our next discussion.
Once special route in routing table is default route matching with any destination address or 0.0.0.0/0.
The default route has the lowest priority because the subnet mask length is zero and it is the shortest possible subnet mask length.
The default route is primarily used to route internet traffic. Instead of writing a route for each destination on the Internet, traffic to any Internet destination is matched against the default route.
Route Preference (Administrative Distance)
Another concept in routing is route preference or administrative distance.
When multiple route for exact the same destination is created in routing table through static or dynamic routing protocols. then you cannot choose the route based on longest prefix match rule since they are exactly the same.
In the example, the route to destination 192.168.2.0/24 is learned using both static and OSPF routing protocols, but using a different path. which route must be selected to forward the traffic to destinations in subnet 192.168.2.0/24.
Every route has an attribute which is called route preference or administrative distance. In such a situation, the route with lowest preference or administrative distance value will be selected to forward the traffic.
Every protocol has a default route preference value as it is shown in the table but it can be changed manually. By default connected and static routes have the lowest preference or the highest priority compare to the routes learned by other routing protocols.
one of the beautiful application of route preference is static route redundancy. it are called “floating static” in cisco terminology and “qualified next-hop” in juniper terminology that we will discuss in continue.
Juniper Static Routing Concepts
There are some routing concepts in Juniper that are somehow different with cisco or at least the terminology is different.
Now we are going to discuss some of these concepts.
As we have already discussed, one of the application of route preference is static route redundancy.
That means we can have two static routes for the same destination but with different route preference values.
Then the route with lower route preference value is used to route traffic to that destination as the primary path. and if that fails, the second route with the higher route preference value is used as the backup path for that destination.
This concept can also be used in juniper devices with one difference. In juniper you can not use two different preferences for the same destination even the next-hop is different. Instead in juniper you have to use the keyword “qualified next-hop”, instead of next-hop for secondary routes.
We will implement this scenario in the next section.
Juniper Routing Table versus Forwarding Table
In juniper devices like cisco devices, we have the terminologies routing table and forwarding table.
In Cisco, only the best routes are kept in the routing table, and a copy of the routing table with a few changes, which is out of the current discussion, is also kept in the forwarding table. Finally, the forwarding table is used to forward the traffic at the data plane.
But what’s different is that in Juniper is that all routing information, whether it’s best or not, is stored in the Juniper devices’ routing table.
In other words, in juniper, routing table is routing information database and unlike cisco devices that only best routes of different routing protocols are kept in routing table, in juniper devices, all routing information are kept in routing table.
As an example, in cisco device when two static routes with different preferences and exactly for the same destination are configured, only one of them with lower preference value is appeared in routing table but in juniper devices you can see both of them in the routing table.
In the next section I will show you practically Juniper routing table and forwarding table.