Problem
You want to aggregate some of the routes in the routing table to reduce the size of the tables and to minimize the amount of routing-information advertisements between routers.
Solution
Configure an aggregate route that covers the specific routes beneath it:
[edit routing-options] aviva@router1# set aggregate route 10.20.8.0/21
Discussion
In this recipe, the routing table contains prefixes for 10.20.13.0/24 and 10.20.15.0/24, which aggregate as 10.20.8.0/21. Unlike static routes, you do not specify a next hop in the set aggregate route command, because aggregate routes are not "real" routes but rather are just route summaries. The default next hop is reject. Aggregate routes become active if a more specific route beneath them becomes active. For example, if 10.20.13.0/24 becomes active, the aggregate 10.20.8.0/21 also becomes active, and you then see it in the routing table:
aviva@RouterJ> show route inet.0: 11 destinations, 11 routes (11 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 10.20.8.0/21 *[Aggregate/130] 00:00:03 Reject 10.20.13.0/24 *[Direct/0] 00:01:30 > via fe-1/0/1.0 10.20.13.1/32 *[Local/0] 00:01:30 Local via fe-1/0/1.0 10.20.15.0/24 *[Direct/0] 00:01:30 > via fe-1/0/0.0 10.20.15.1/32 *[Local/0] 00:01:30 Local via fe-1/0/0.0 172.19.121.0/24 *[Direct/0] 1d 21:12:45 > via fe-0/0/0.0 172.19.121.117/32 *[Local/0] 1d 21:12:45 Local via fe-0/0/0.0 192.168.17.1/32 *[Direct/0] 00:01:30 > via lo0.0
This output shows that the aggregate route has a default next hop of Reject, which drops any traffic addressed to it and sends an ICMP unreachable message back to the sender. If you are concerned about malicious hackers using the ICMP messages to gain information about your network and routers, change the next hop to discard so that no ICMP unreachable messages are sent:
[edit routing-options] aviva@router1# set aggregate route 10.20.8.0/21 discard
Use the show route command to verify the change:
aviva@RouterJ> show route protocol aggregate inet.0: 11 destinations, 11 routes (11 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 10.20.8.0/21 *[Aggregate/130] 00:01:45 Discard
When the aggregate route is active, it is installed in the forwarding table as a discard route:
aviva@RouterJ> show route forwarding-table matching 10.20.8.0/21 Routing table: inet Internet: Destination Type RtRef Next hop Type Index NhRef Netif 10.20.8.0/21 user 0 dscd 12 1 10.20.13.0/24 intf 0 rslv 338 1 fe-1/0/1.0 10.20.13.0/32 dest 0 10.20.13.0 recv 336 1 fe-1/0/1.0 10.20.13.1/32 intf 0 10.20.13.1 locl 337 2 10.20.13.1/32 dest 0 10.20.13.1 locl 337 2 10.20.13.255/32 dest 0 10.20.13.255 bcst 335 1 fe-1/0/1.0 10.20.15.0/24 intf 0 rslv 334 1 fe-1/0/0.0 10.20.15.0/32 dest 0 10.20.15.0 recv 332 1 fe-1/0/0.0 10.20.15.1/32 intf 0 10.20.15.1 locl 333 2 10.20.15.1/32 dest 0 10.20.15.1 locl 333 2 10.20.15.255/32 dest 0 10.20.15.255 bcst 327 1 fe-1/0/0.0
Router Configuration and File Management
Basic Router Security and Access Control
IPSec
SNMP
Logging
NTP
Router Interfaces
IP Routing
Routing Policy and Firewall Filters
RIP
IS-IS
OSPF
BGP
MPLS
VPNs
IP Multicast