Core Issue
Optimal routing of network traffic and reducing memory consumption are essentially conflicting requirements. For optimal routing to take place, specific routes should be known. That involves learning all the specific prefixes, which requires a large amount of memory, especially in routers running Border Gateway Protocol (BGP). Using default routes and suppressing specific prefixes would result in reduced memory consumption, but it might also cause sub-optimal routing to take place.
Resolution
A high degree of optimal routing with a reduction in memory requirements can be achieved by accepting routes that only originated from the neighboring Autonomous System (AS). For further destinations, routing is based on default routes. Filtering updates to permit routes originating from the neighboring AS can be achieved only with the AS-Path Access Control List (ACL).
To resolve this issue, perform these steps:
- Create a regular expression that allows routes that originated from the neighboring AS and its directly connected AS only. For example, if the neighboring AS is 24357, the regular expression ^24357_[0-9]*$ matches routes originated in AS 24357 and its neighboring ASs.
- Create an AS-Path ACL with this regular expression. To define a BGP AS-Path ACL, issue the ip as-path access-list command in global configuration mode.
- Use this AS-Path ACL to filter routing updates by using filter lists or route maps.
- To create a route map, issue the route-map command in global configuration mode and the match as-path command in route-map configuration mode.
- To apply a route map to incoming or outgoing routes, issue the neighbor route-map command in router configuration mode.
- To set up a BGP filter, issue the neighbor filter-list command in router configuration mode.
For more information, refer to Achieve Optimal Routing and Reduce BGP Memory Consumption.
For more information on configuring BGP regular expressions, refer to Using Regular Expressions in BGP.