Maximum Prefixes

Maximum Prefixes

The BGP Maximum-Prefix feature allows you to control how many prefixes can be received from a neighbor. By default, this feature allows a router to bring down a peer when the number of received prefixes from that peer exceeds the configured Maximum-Prefix limit.

The Maximum-Prefix feature is useful when, at a change of outbound policy at the remote peering site, a router starts to receive more routes than the router memory can take. If this same router is peering with BGP and also performs critical routing functions within a network, this overhead could turn out bad. A BGP problem could disrupt internal network connectivity.

By default, a BGP peer holds all the routes advertised by the peering router. The number of routes can be filtered either on the inbound of the local router or on the outbound of the peering router. But there can still be instances where the number of routes are more than what a router anticipates or can handle. To prevent such situations, use the BGP maximum-prefix feature.

This feature helps scale and prevent the network from an excess number of routes and thus should be carefully configured. The BGP maximum-prefix feature can be enabled in the following situations:

  • Know how many BGP routes are anticipated from the peer
  • What actions should be taken if the number of routes exceeded the specified value. Should the BGP connection be reset or should a warning message be logged?

To limit the number of prefixes, use the command neighbor ip-address maximum-prefix maximum [threshold] [restart restart-interval | warning-only] for each neighbor.

An important point to remember is that when the restart option is configured with the maximum-prefix command, the only other way apart from waiting for the restart-interval timer to expire, to re-establish the BGP connection, is to perform a manual reset of the peer using the clear bgp afi safi ip-address command.

Options Description
maximum Defines the maximum prefix limit.
threshold Defines the threshold percentage at which a warning is generated.
restart restart-interval Default behavior. Resets the BGP connection after the specified prefix limit is exceeded.
The restart-interval is configured in minutes.
BGP tries to reestablish the peering after the specified time interval is passed.
warning-only Only gives a warning message when the specified limit is exceeded.
discard-extra-paths Only supported on IOS XR.
When configured, BGP drops all excess prefixes received from the neighbor after it reaches the maximum limit value.


					// IOS
router bgp 300
 address-family ipv4 unicast
  neighbor maximum-prefix 2 warning-only
  neighbor maximum-prefix 2 restart 2

router bgp 100
 vrf ABC
   address-family ipv4 unicast
    maximum-prefix 2 discard-extra-paths

// NX-OS
router bgp 100
  address-family ipv4 unicast
   maximum-prefix 4 warning-only

The maximum-prefix command takes immediate effect. Based on the action set, either the warning message is logged or the BGP session is reset. There is no control over which prefix is dropped or removed from the BGP table.


Leave a Reply

Related Post