This article explains how to configure an aggregated route and export it to the BGP neighbor (ISP).
Consider the following topology with three subnets:
10.10.16.0/24 10.10.32.0/24 10.10.48.0/24 10.10.16.0/24 Static 10.10.48.0/24 >static R1 ------------------ R2 <10.20.1.1>------------------<10.20.1.2> R3 (ISP) 10.10.32.0/24 aggregate route 10.10.0.0/17 to BGP (ISP)
The three subnets are learnt via different protocols on R2 and are connected to the ISP. We will aggregate this routing information into a single route, which will reduce the amount of information the BGP has to share with its neighbor.
lab:R1# show |display set |no-more set logical-systems R1 interfaces ge-3/3/9 unit 10 vlan-id 10 set logical-systems R1 interfaces ge-3/3/9 unit 10 family inet address 10.1.1.1/30 set logical-systems R1 interfaces lo0 unit 1 family inet address 192.168.0.1/32 set logical-systems R1 protocols ospf export static-to-ospf set logical-systems R1 protocols ospf area 0.0.0.0 interface ge-3/3/9.10 set logical-systems R1 protocols ospf area 0.0.0.0 interface lo0.1 set logical-systems R1 policy-options policy-statement static-to-ospf from protocol static set logical-systems R1 policy-options policy-statement static-to-ospf then accept set logical-systems R1 routing-options static route 10.10.16.0/24 receive set logical-systems R1 routing-options static route 10.10.32.0/24 receive set logical-systems R1 routing-options static route 0.0.0.0/0 next-hop 10.1.1.2 set logical-systems R1 routing-options autonomous-system 100
lab:R2# show |display set |no-more set logical-systems R2 interfaces ge-3/3/8 unit 10 vlan-id 10 set logical-systems R2 interfaces ge-3/3/8 unit 10 family inet address 10.1.1.2/30 set logical-systems R2 interfaces ge-3/3/9 unit 20 vlan-id 20 set logical-systems R2 interfaces ge-3/3/9 unit 20 family inet address 10.20.1.1/30 set logical-systems R2 interfaces lo0 unit 2 family inet address 192.168.0.2/32 set logical-systems R2 protocols bgp group Y type external set logical-systems R2 protocols bgp group Y export aggregate set logical-systems R2 protocols bgp group Y neighbor 10.20.1.2 peer-as 200 set logical-systems R2 protocols bgp group INT type internal set logical-systems R2 protocols bgp group INT neighbor 192.168.0.1 local-address 192.168.0.2 set logical-systems R2 protocols ospf export static-to-ospf set logical-systems R2 protocols ospf area 0.0.0.0 interface ge-3/3/8.10 set logical-systems R2 protocols ospf area 0.0.0.0 interface lo0.2 set logical-systems R2 policy-options policy-statement aggregate from protocol aggregate set logical-systems R2 policy-options policy-statement aggregate then accept set logical-systems R2 policy-options policy-statement static-to-ospf from protocol static set logical-systems R2 policy-options policy-statement static-to-ospf then accept set logical-systems R2 routing-options static route 10.10.48.0/24 receive set logical-systems R2 routing-options aggregate route 10.10.0.0/17 <<<<<<<<< for aggregated route** set logical-systems R2 routing-options generate route 10.10.0.0/17 <<<<<<<<< for generated route** set logical-systems R2 routing-options autonomous-system 100
lab:R3# show |display set |no-more set logical-systems R3 interfaces ge-3/3/8 unit 20 vlan-id 20 set logical-systems R3 interfaces ge-3/3/8 unit 20 family inet address 10.20.1.2/30 set logical-systems R3 interfaces lo0 unit 3 family inet address 192.168.0.3/32 set logical-systems R3 protocols bgp group X type external set logical-systems R3 protocols bgp group X neighbor 10.20.1.1 peer-as 100 set logical-systems R3 routing-options autonomous-system 200
lab:R1> show route inet.0: 9 destinations, 9 routes (9 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 0.0.0.0/0 *[Static/5] 00:13:53 <<<<<<<<<<<<<<< default route in order to reach ISP /**** > to 10.1.1.2 via ge-3/3/9.10 192.168.0.1/32 *[Direct/0] 00:57:47 > via lo0.1 192.168.0.2/32 *[OSPF/10] 00:56:57, metric 1 > to 10.1.1.2 via ge-3/3/9.10 10.1.1.0/30 *[Direct/0] 00:57:47 > via ge-3/3/9.10 10.1.1.1/32 *[Local/0] 00:57:47 Local via ge-3/3/9.10 10.10.16.0/24 *[Static/5] 00:57:47 <<<<<<<<<<< injected static and exported via OSPF to R2 Receive 10.10.32.0/24 *[Static/5] 00:57:47 <<<<<<<<<< injected static and exported via OSPF to R2 Receive 10.10.48.0/24 *[OSPF/150] 00:56:57, metric 0, tag 0 <<<<<<<< Static learnt via OSPF from R2 (see topology) > to 10.1.1.2 via ge-3/3/9.10 224.0.0.5/32 *[OSPF/10] 00:57:47, metric 1 MultiRecv
lab:R2> show route inet.0: 12 destinations, 12 routes (12 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 0.0.0.0/0 *[OSPF/150] 00:15:40, metric 0, tag 0 > to 10.1.1.1 via ge-3/3/8.10 192.168.0.1/32 *[OSPF/10] 00:58:44, metric 1 > to 10.1.1.1 via ge-3/3/8.10 192.168.0.2/32 *[Direct/0] 00:59:34 > via lo0.2 10.1.1.0/30 *[Direct/0] 00:59:34 > via ge-3/3/8.10 10.1.1.2/32 *[Local/0] 00:59:34 Local via ge-3/3/8.10 10.10.0.0/17 *[Aggregate/130] 00:10:29 *** <<<< Aggregate route from internal N/w and exported to ISP i.e. (eBGP 10.20.1.2 ) Reject 10.10.16.0/24 *[OSPF/150] 00:58:44, metric 0, tag 0 <<<< Static learnt via OSPF from R1 (see topology) > to 10.1.1.1 via ge-3/3/8.10 10.10.32.0/24 *[OSPF/150] 00:58:44, metric 0, tag 0 <<<< Static learnt via OSPF from R1 (see topology) > to 10.1.1.1 via ge-3/3/8.10 10.10.48.0/24 *[Static/5] 00:59:34 <<<< injected static and exported via OSPF to R1 Receive 10.20.1.0/30 *[Direct/0] 00:59:34 > via ge-3/3/9.20 10.20.1.1/32 *[Local/0] 00:59:34 Local via ge-3/3/9.20 224.0.0.5/32 *[OSPF/10] 00:59:34, metric 1 MultiRecv lab:R2> show route protocol aggregate detail inet.0: 12 destinations, 12 routes (12 active, 0 holddown, 0 hidden) 10.10.0.0/17 (1 entry, 1 announced) *Aggregate Preference: 130 Next hop type: Reject Address: 0x9049064 Next-hop reference count: 2 State: <Active Int Ext> Local AS: 100 Age: 12:32 Validation State: unverified Task: Aggregate Announcement bits (2): 3-KRT 5-BGP_RT_Background AS path: I (LocalAgg) Flags: Depth: 0 Active AS path list: AS path: I Refcount: 3 Contributing Routes (3): 10.10.48.0/24 proto Static *** 10.10.16.0/24 proto OSPF *** 10.10.32.0/24 proto OSPF **** lab:R2> show route advertising-protocol bgp 10.20.1.2 detail <<<< advertising to BGP inet.0: 12 destinations, 12 routes (12 active, 0 holddown, 0 hidden) * 10.10.0.0/17 (1 entry, 1 announced) BGP group Y type External Nexthop: Self AS path: [100] I (LocalAgg)
lab:R3> show route inet.0: 4 destinations, 4 routes (4 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 192.168.0.3/32 *[Direct/0] 01:03:10 > via lo0.3 10.10.0.0/17 *[BGP/170] 00:14:05, localpref 100 <<<<<<<< learnt via BGP AS path: 100 I, validation-state: unverified > to 10.20.1.1 via ge-3/3/8.20 10.20.1.0/30 *[Direct/0] 01:03:10 > via ge-3/3/8.20 10.20.1.2/32 *[Local/0] 01:03:10 Local via ge-3/3/8.20 lab:R3> show route 10.10.0.0 detail inet.0: 4 destinations, 4 routes (4 active, 0 holddown, 0 hidden) 10.10.0.0/17 (1 entry, 1 announced) *BGP Preference: 170/-101 Next hop type: Router, Next hop index: 783 Address: 0x92e01d8 Next-hop reference count: 2 Source: 10.20.1.1 Next hop: 10.20.1.1 via ge-3/3/8.20, selected Session Id: 0x180001 State: <Active Ext> Local AS: 200 Peer AS: 100 Age: 14:43 Validation State: unverified Task: BGP_100.10.20.1.1+179 Announcement bits (1): 0-KRT AS path: 100 I Aggregator: 100 192.168.0.2 Accepted Localpref: 100 Router ID: 192.168.0.2 lab:R3> ping 10.10.16.1 PING 10.10.16.1 (10.10.16.1): 56 data bytes 64 bytes from 10.1.1.1: icmp_seq=0 ttl=63 time=0.475 ms ^C
After removing aggregate route from configuration, we have the following:Note : Next-hop values of discard or reject on a route makes the route ineligible to contribute.**
discard
reject
lab:R2# run show route 10.10/17 inet.0: 11 destinations, 11 routes (11 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 10.10.16.0/24 *[OSPF/150] 00:01:41, metric 0, tag 0 > to 10.1.1.1 via ge-3/3/8.10 10.10.32.0/24 *[OSPF/150] 00:01:41, metric 0, tag 0 > to 10.1.1.1 via ge-3/3/8.10 10.10.48.0/24 *[Static/5] 00:02:31 Receive lab:R2# set routing-options generate route 10.10.0.0/17 lab:R2# run show route 10.10/17 inet.0: 12 destinations, 12 routes (12 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 10.10.0.0/17 *[Aggregate/130] 00:00:03 <<<<<< generated ... > to 10.1.1.1 via ge-3/3/8.10 10.10.16.0/24 *[OSPF/150] 00:02:11, metric 0, tag 0 > to 10.1.1.1 via ge-3/3/8.10 10.10.32.0/24 *[OSPF/150] 00:02:11, metric 0, tag 0 > to 10.1.1.1 via ge-3/3/8.10 10.10.48.0/24 *[Static/5] 00:03:01 Receive lab:R2# run show route protocol aggregate detail inet.0: 12 destinations, 12 routes (12 active, 0 holddown, 0 hidden) 10.10.0.0/17 (1 entry, 1 announced) *Aggregate Preference: 130 Next hop type: Router, Next hop index: 791 Address: 0x92643ec Next-hop reference count: 10 Next hop: 10.1.1.1 via ge-3/3/8.10, selected Session Id: 0x100001 State: <Active Int Ext> Local AS: 100 Age: 59 Validation State: unverified Task: Aggregate Announcement bits (2): 3-KRT 5-BGP_RT_Background AS path: I Flags: Generate Depth: 0 Active Contributing Routes (2): 10.10.16.0/24 proto OSPF <<< This route is the contributor with the numerically smallest prefix. 10.10.32.0/24 proto OSPF
The static route of 10.10.48.0/24 did not contribute to the generated route. Its current next hop is "receive". Since this is a dummy route, there is no valid next hop.