Reducing the Size of the Received Routing Table
Problem
You want to summarize the incoming routing information to reduce the size of your routing table.
Solution
One of the easiest ways to reduce your routing table size is to filter out most of the external routes and replace them with a default. To do this, you first create a static default route pointing to some known remote network. If this remote network is up, then you can safely assume that your ISP is working properly. Then you simply filter out all of the remaining uninteresting routes:
Router1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router1(config)#ip route 0.0.0.0 0.0.0.0 192.168.101.0 1
Router1(config)#ip route 0.0.0.0 0.0.0.0 192.168.102.0 2
Router1(config)#ip prefix-list CREATE-DEFAULT seq 10 permit 192.168.101.0/24
Router1(config)#ip prefix-list CREATE-DEFAULT seq 20 permit 192.168.102.0/24
Router1(config)#router bgp 65500
Router1(config-router)#neighbor 192.168.1.5 remote-as 65520
Router1(config-router)#neighbor 192.168.1.5 prefix-list CREATE-DEFAULT in
Router1(config-router)#exit
Router1(config)#end
Router1#
Discussion
For most typical Internet connections, you will need to drastically reduce the amount of routing information that you receive. A typical Internet backbone router needs to support BGP routes for well over 100,000 prefixes. So unless you are operating the ISP and need to support a large fraction of the public address space, it is a good idea to cut out as much as possible. It is important to remember that removing routing information means that some of your routing decisions will not be as good as they might otherwise be, however. There is always a tradeoff involved in filtering routing information.
This recipe shows a good way to drastically reduce the size of your Internet routing table. It looks for two different remote networks on the Internet, 192.168.101.0/24 and 192.168.102.0/24, and points a default route to each of them. This way, if either route happens to fail because of some normal (but hopefully rare) network problem, you will still have a default route. Then we created a prefix list that allows only these two routes, and applied it to all routes that we received from the peer router at our ISP. Please refer to Recipe 9.6 for more information on prefix lists.
The result is a very small Internet routing table that consists of only these two routes and a default route with two destinations. In practice, you will probably want to use more than two routes, however. Just to guard against the possibility that the remote networks you picked happen to be down at the same time for some reason, it is a good idea to pick a wide variety of different remote networks, some very far away and some relatively close. Avoid picking all of them in the same country, so you won't lose your default just because of a telecom disaster in that country. You could even pick a dozen or so remote routes like this, giving excellent fault tolerance, while still providing a tiny Internet routing table.
Notice the two static routes in the example have different administrative distances:
Router1(config)#ip route 0.0.0.0 0.0.0.0 192.168.101.0 1
Router1(config)#ip route 0.0.0.0 0.0.0.0 192.168.102.0 2
We did this to prevent load balancing between the default routes. If you have more than one ISP, it is quite likely that the best routes for these prefixes will be through different providers. You can allow load balancing, if you prefer, by simply giving all of these static routes the same administrative distance. But bear in mind that this will balance among routes, not among ISP connections.
If you have only one ISP, on the other hand, load balancing between these default routes accomplishes nothing useful.
If you then want to pass this default route information along to other routers by using BGP, the best way to do so is to use the default-originate option on the neighbor command, and include a route map to specify the prefixes that you want to associate with your default route:
Router1(config)#ip prefix-list CREATE-DEFAULT seq 10 permit 192.168.101.0/24
Router1(config)#ip prefix-list CREATE-DEFAULT seq 20 permit 192.168.102.0/24
Router1(config)#route-map DEFAULT-ROUTE permit 10
Router1(config-route-map)#match ip address prefix-list CREATE-DEFAULT
Router1(config-route-map)#exit
Router1(config)#router bgp 65500
Router1(config-router)#neighbor 172.18.5.3 default-origniate route-map DEFAULT-ROUTE
Router1(config-router)#exit
This is a dangerous thing to do, though, because BGP will now start to distribute default routing information to this peer, which may then start to distribute the default route out to the Internet. So it is a good idea to explicitly suppress the default route for any peers that should not receive it, and do this on all of your BGP routers:
Router1(config)#ip prefix-list BLOCK-DEFAULT permit 0.0.0.0/0 ge 1
Router1(config)#router bgp 65500
Router1(config-router)#neighbor 192.168.1.5 prefix-list BLOCK-DEFAULT out
Another popular way to reduce the size of the Internet routing table is to simply refuse to accept any routes /24 prefixes. Over 50 percent of the routes appearing on the Internet backbone are for /24 prefixes. So eliminating them will cut the memory requirements in half:
Router1(config)#ip prefix-list BLOCK-24 permit 0.0.0.0/0 le 23
Router1(config)#router bgp 65500
Router1(config-router)#neighbor 192.168.1.5 prefix-list BLOCK-24 in
However, if you do this, you should also use a default static route method discussed earlier. This is because some of the /24 prefixes in the Internet routing tables may not be included in other prefixes or summary routes.
We note in passing that the fraction of routes appearing on the backbone with a /24 prefix is steadily dropping over time. In early 2001, almost 59 percent of all prefixes were /24 networks, while over two years later in 2003, the number had dropped to roughly 55 percent. We expect this trend to continue over time, as ISPs improve their route summarization.