JunOS Aggregate and Generate Routes

JunOS Aggregate and Generate Routes

Summary Routes

We all know the importance of summarization. It helps keep the routing tables in our networks small and efficient. There are several ways this could be done.

Imagine that we have these networks:

  • 172.16.1.0 /24
  • 172.16.2.0 /24
  • 172.16.3.0 /24
  • 172.16.4.0 /24
  • 172.16.5.0 /24

 

One option available to us is to create a static route for 172.16.0.0 /21, and set the next-hop to either ‘reject’ or ‘discard’. This is like using null0 on a Cisco router.

Now, rather than advertising five small networks to our neighbours, we have the option of only advertising the summary network.

Unfortunately, there’s a problem. What happens if we lose these five routes? The summary route is static, so it will stay in the routing table, and may still be advertised to our neighbours.

The result of this is ‘black-holing’ traffic.

 

The good news is that we have better options, called Aggregate and Generate routes.

 

Aggregate Routes

An aggregate route is similar to the summary route we just discussed. As before, it summarizes more specific routes, and has a next-hop of ‘discard’ or ‘reject’.

Each of the more specific routes are called contributing routes. In our example, 172.16.1.0 /24 would be a contributing route.

If a packet arrives at our router, and it matches the aggregate, but not one of the contributing routes, the packet will drop.

the advantage of the aggregate route is that if all the contributing routes are lost, the aggregate will be removed from the routing table, and will not be advertised to any neighbours.

 

Creating an aggregate is a simple process:

routing-options {
  aggregate {
    route 172.16.0.0/21;
  }
}

 

Optionally, we can change defaults, like whether discard or reject is used as the next hop. This can be done under the route itself, or we can change the defaults globally:

routing-options {
  aggregate {
    defaults {
      discard;
      preference 20;
    }
  }
}

 

Please note through, that aggregate routes do not decrease the size of the routing table on the local router. In fact, it makes it slightly bigger.

What it does, is limit the routes sent to neighbours, which helps keep their routing tables small.

 

Generate Routes

‘Generate’ routes are very similar. In fact, they are a type of aggregate route.

The key difference is that we don’t need to use reject or discard as a next-hop. So traffic that doesn’t match a contributing route will not be dropped by default.

Instead, any traffic that matches the generate route, but not one of the contributing routes will be forwarded to the next-hop of the first contributing route.

How is the first contributing route decided? First the router will look at the route with the lowest protocol preference. For example, static routes will be preferred before OSPF routes.

As a tie-breaker, the route with the lowest IP is used. For example, 10.0.0.0 /24 is preferred to 172.16.0.0 /30.

 

Fortunately, these are really easy to configure.

routing-options {
  generate {
    route 172.16.0.0/24;
  }
}

 

But when would you use a generate route? First, these would typically be used with a routing policy, which lists the routes which may be considered as contributing routes.

Second, they are typically used with default routes. The policy will include upstream routes. This allows the router to advertise the default route to neighbours, and forward traffic accordingly, while still monitoring if the connection is up.

 

 


References

Network Enhancers – Difference Between Static, Aggregate and Generate Routes in JUNOS

Network Fun Times – JunOS: Aggregate Routes vs Generate Routes

Juniper Tech Library – Understanding Route Aggregation

 

Leave a Reply