BGP table-map is a feature that allows us to filter, or set properties of, the BGP routes marked for installation into the RIB.

One scenario where we could use table-map is a dedicated IPv4 RR that doesn't need to have all of the routes it receives in the RIB, but it still needs to propagate them to its clients.

We will test BGP Selective route download using the below simple topology.

RRC1 advertises 4 prefixes to RR. These prefixes are 110.0.[0-3].0/24 .
RRC2 also advertises 4 prefixes to RR. These prefixes are 120.0.[0-3].0/24 .

BGP config on our RR is very simple:

router bgp 1
 bgp log-neighbor-changes
 neighbor IBGP peer-group
 neighbor IBGP remote-as 1
 neighbor IBGP route-reflector-client
 neighbor 10.1.1.2 peer-group IBGP
 neighbor 10.1.1.6 peer-group IBGP

Below is the confirmation that we indeed received 4 prefixes from each of the RRCs.

RR#sh ip bgp sum | b Nei
Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
10.1.1.2        4            1      45      54       77    0    0 00:26:05        4
10.1.1.6        4            1      44      54       77    0    0 00:26:06        4

RR#sh ip bgp | b Network
     Network          Next Hop            Metric LocPrf Weight Path
 *>i 110.0.0.0/24     10.1.1.2                 0    100      0 ?
 *>i 110.0.1.0/24     10.1.1.2                 0    100      0 ?
 *>i 110.0.2.0/24     10.1.1.2                 0    100      0 ?
 *>i 110.0.3.0/24     10.1.1.2                 0    100      0 ?
 *>i 120.0.0.0/24     10.1.1.6                 0    100      0 ?
 *>i 120.0.1.0/24     10.1.1.6                 0    100      0 ?
 *>i 120.0.2.0/24     10.1.1.6                 0    100      0 ?
 *>i 120.0.3.0/24     10.1.1.6                 0    100      0 ?

We can also see that all of those routes made it to the RR's RIB:

RR#sh ip route | in B.*1[12]0\.
B        110.0.0.0 [200/0] via 10.1.1.2, 00:00:07
B        110.0.1.0 [200/0] via 10.1.1.2, 00:00:07
B        110.0.2.0 [200/0] via 10.1.1.2, 00:00:07
B        110.0.3.0 [200/0] via 10.1.1.2, 00:00:07
B        120.0.0.0 [200/0] via 10.1.1.6, 00:00:07
B        120.0.1.0 [200/0] via 10.1.1.6, 00:00:07
B        120.0.2.0 [200/0] via 10.1.1.6, 00:00:07
B        120.0.3.0 [200/0] via 10.1.1.6, 00:00:07

We will now configure a route-map to be used with the table-map feature. In this route-map we will filter all prefixes that have an odd numbered 3rd octet.

ip access-list standard AL_FILTER_ODD
 permit 0.0.1.0 255.255.254.255

route-map RM_TM_FILTER deny 10
 match ip address AL_FILTER_ODD
route-map RM_TM_FILTER permit 20

We use our newly defined route-map to configure table-map filter:

router bgp 1
 table-map RM_TM_FILTER filter

If you made modification to previously configured filter, you might have to refresh table-map configuration information:

RR#clear bgp ipv4 unicast table-map

After we made our change it's time to verify the results.

RR#sh ip bgp | b Network
     Network          Next Hop            Metric LocPrf Weight Path
 *>i 110.0.0.0/24     10.1.1.2                 0    100      0 ?
 *>i 110.0.1.0/24     10.1.1.2                 0    100      0 ?
 *>i 110.0.2.0/24     10.1.1.2                 0    100      0 ?
 *>i 110.0.3.0/24     10.1.1.2                 0    100      0 ?
 *>i 120.0.0.0/24     10.1.1.6                 0    100      0 ?
 *>i 120.0.1.0/24     10.1.1.6                 0    100      0 ?
 *>i 120.0.2.0/24     10.1.1.6                 0    100      0 ?
 *>i 120.0.3.0/24     10.1.1.6                 0    100      0 ?

RR#sh ip route | in B.*1[12]0\.
B        110.0.0.0 [200/0] via 10.1.1.2, 00:00:01
B        110.0.2.0 [200/0] via 10.1.1.2, 00:00:01
B        120.0.0.0 [200/0] via 10.1.1.6, 00:00:01
B        120.0.2.0 [200/0] via 10.1.1.6, 00:00:01

There, all of the routes are still in the BGP table but only prefixes with the even numbered 3rd octet made it to the RIB table.

For completeness we will check if all of the BGP prefixes are still propagated to the RRCs:

RRC1#sh ip bgp | in 120\.0
 *>i 120.0.0.0/24     10.1.1.6                 0    100      0 ?
 *>i 120.0.1.0/24     10.1.1.6                 0    100      0 ?
 *>i 120.0.2.0/24     10.1.1.6                 0    100      0 ?
 *>i 120.0.3.0/24     10.1.1.6                 0    100      0 ?

RRC2#sh ip bgp | in 110\.0
 *>i 110.0.0.0/24     10.1.1.2                 0    100      0 ?
 *>i 110.0.1.0/24     10.1.1.2                 0    100      0 ?
 *>i 110.0.2.0/24     10.1.1.2                 0    100      0 ?
 *>i 110.0.3.0/24     10.1.1.2                 0    100      0 ?

All is in order, RR is propagating routes as it should while at the same time installing only a subset of received BGP prefixes into its RIB.

Selective route download is a very powerful technique especially when our dedicated RR does not have resources to install the full Internet routing table for IPv4. We can allow only the necessary prefixes to be installed in the RR's RIB while allowing propagation of the prefixes to its clients.