BGP Prefix Matching and Prefix List Explained

BGP Prefix Matching and Prefix lists provide another method of identifying networks in a routing protocol. A prefix list identifies a specific IP address, network, or network range and allows for the selection of multiple networks with a variety of prefix lengths by using a prefix match specification. Many network engineers prefer this over the ACL network selection method. A prefix match specification contains two parts: a high-order bit pattern and a high-order bit count, which determines the high-order bits in the bit pattern that are to be matched. Some documentation refers to the high-order bit pattern as the address or network and the high-order bit count as the length or mask length. In the figure below, BGP matching prefix specification has the high-order bit pattern and the high-order bit count 16. The high-order bit pattern has been converted to binary to demonstrate where the high-order bit count lies. Because there are no additional Matching prefix length parameters included, the high-order bit count is an exact match.


bgp prefix

Basic BGP Prefix Match Pattern

At this point, the prefix match specification logic looks identical to the functionality of an access list. The true power and flexibility come in using matching length parameters to identify multiple networks with specific prefix lengths with one statement. The matching length parameter options are

  • le: Less than or equal to, <=
  • ge: Greater than or equal to, >=


Prefix Match Pattern with Matching Length Parameters

The prefix does not meet the matching length parameter because the prefix length is less than the minimum of 24 bits, whereas the prefix does meet the matching length parameter. The prefix qualifies because the first 13 bits match the high-order bit pattern, and the prefix length is within the matching length parameter. The prefix does not qualify because the high-order bit pattern does not match within the high-order bit count.

The figure below demonstrates a prefix match specification with the high-order bit pattern, high-order bit count 8, and matching lengths between 22 and 26.


 Prefix Match with Ineligible Matched Prefixes

The prefix does not match because the prefix length is too short. The network qualifies because the bit pattern matches and the prefix length is between 22 and 26. The prefix does not match because the bit pattern is too long. Any prefix that starts with 10 in the first octet and has a prefix length between 22 and 26 will match.

Download our Free CCNA Study Guide PDF for complete notes on all the CCNA 200-301 exam topics in one book.

We recommend the Cisco CCNA Gold Bootcamp as your main CCNA training course. It’s the highest rated Cisco course online with an average rating of 4.8 from over 30,000 public reviews and is the gold standard in CCNA training: