Keeping your router table in check is something that any network administrator should be concerned with, especially with BGP. Accepting a full routing table from your ISP over BGP can put a good bit of stress on your router in terms of memory, etc. The fact is with no control, your router could be flooded with an extreme number of BGP routes. Controlling these routes allows for the best possible performance of the router and the most control over the network for you, the administrator.
An easy way to accomplish this is with prefix-lists. Here is a quick way to control what you are receiving from your ISP:
ip prefix-list default-route seq 10 permit 0.0.0.0/0
This creates the prefix-list and as you can see, has the standard 0.0.0.0/0 you would see with a default route. Now what you need to do is apply this to your BGP neighbors individually. The process of applying the prefix-list to a neighbor looks like this:
router bgp 65000
neighbor 188.8.131.52 prefix-list default-route in
With that statement, the routed coming from 184.108.40.206 (on an inbound basis) are filtered to allow only routes in the prefix-list, in this case called ‘default-route’, to be received.
This can also be done on an outbound basis as well. Say for instance you have multiple routers internally peered together sharing routes. You also connect to your ISP(s) with these routers. You do not want to share, nor will your ISP accept, all of your routes, especially internal routes. A prefix-list can make sure only your public class-c and larger networks of public subnets are shared with your ISP.
That could look like this:
ip prefix-list public-subnet seq 10 permit 220.127.116.11/24
Then you would need to apply this additional prefix to the neighbor just like the other, only this one would be on an outbound basis:
router bgp 65000
neighbor 18.104.22.168 prefix-list public-subnet out
Per that example, only the routes for subnet 22.214.171.124/24 would be shared out to our BGP neighbor 126.96.36.199. That is a basic example of how you can control the inbound and outbound sharing of BGP routes. Through some fine tuning, you can make your routing label hold specifically the routes you are wanting.
As always, if there are any questions, post below.