Introduction to BGP Routing Tables

Facebooktwitterredditpinterestlinkedinmail

Routers running the BGP protocol use 3 types of routing tables for different purposes:

1) BGP Neighbor Table – table containing information about BGP neighbors.

2) BGP Table (also known as BGP topology table, BGP RIB) contains the network layer reachability information (NLRI) learned in compliance with BGP and NLRI attributes (path attribute, PA) corresponding to these path. Essentially, NLRI is a prefix and its length. BGP table contains all the routes from all the neighbors, several routes to the same network with different attributes.

3) BGP Routing Table – the main IP routing tables that contains only the best routes from BGP Table. After BGP has selected the best path to a network, that path is added to the main IP routing table.

BGP routes do not have outgoing interface in the routing table, but only the Next-Hop IP (the IP is known through NEXT_HOP attribute). A recursive lookup will be done in the routing table.

recursive lookup

 


!!!BGP advertises only the best routes to the neighbors!!!

 

Building BGP table

Technically, BGP does not announce routes as such. It announces the prefix, prefix’s length and PA.

Prefix can be added to the local BGP table via network command during BGP configuration.

The network command specifies for the BGP process to do the following:

Review current routing table (RIB), find the exact match of the route, specified in the command, and add the appropriate NLRI in the local BGP table.

Following this logic, all the connected, static and IGP routes, will be taken from the RIB table, and added to the BGP table for further announcement. If the router removes the route from RIB table, the corresponding NLRI is removed from the BGP table and BGP neighbor is notified that the NLRI is withdrawn.

The network command has the following structure:

network {network-number [mask network-mask]} [route-map map-tag]

Features of this command:

  • If a mask is not specified – classful mask is used.
  • no auto-summary configuration – the route from the RIB table must be a complete match to the one, specified in the command.
  • NEXT-HOP for NLRI is added according to the route in the RIB.
  • Maximum number of subnets that can be added with this command is limited by NVRAM and RAM of the router.
  • The purpose of route-map is to enable manual attributes (PA) manipulation, as well as, prefixes filtration.

Unlike some other routing protocols, BGP does not require periodic refresh of the entire RIB. Instead, BGP routers store the latest version of the routing table of each equal neighbor. Although BGP keeps the routes of all possible paths to any particular network, it advertises only best (optimal) routes in its update messages.

 

BGP network command

Network command works in a completely different way in BGP than it does in the IGP protocols.

It specifies what network to announce, rather than what interfaces to run the protocol on (as in IGP). This network (this prefix) is taken from the local RIB.

Therefore, BGP stability is very dependent on routing tables and consequently, on the IGP.

Example:

- R1 (config-router) #network 172.16.0.0 [mask 255.255.0.0] [route-map]

 

1) Auto-summary is disabled (by default from IOS 12.3 #no auto-summary)

“Look for a route in the router’s current IP routing table that exactly matches the parameters of the network command”. The route will appear in the local BGP table if the network prefix and prefix length (mask) in configuration command will match those in the routing table.

It can be configured with a mask and without it. When configured without mask, routes will be added in the BGP table only in compliance with class boundary. The prefix length for classful networks is not shown in the BGP table.

BGP table

2) If Auto-summary is enabled (by default below IOS 12.3 # auto-summary) and configuration is accomplished without a mask, then a classful route will appear in BGP table in 2 cases:

– If the exact same route is present the RIB (it does not matter if the auto-summary is enabled or disabled).

– If the RIB contains subnets belonging to this classful network (this is the only difference).

rib

Best practice is to use network command with a mask and to disable auto-summary.

 

Redistribution

Just like in IGP, routing protocol redistribution (for instance OSPF to BGP) will involve: 1) routes from the RIB, brought by routing protocol (OSPF). 2) connected networks from the RIB, which are running this routing protocol through the network command. Connected networks can be filtered through a route-map if necessary.

To advertise a single route in BGP:

1) Use the IGP summarization followed by advertisement of a single summary prefix to BGP.

2) Configure a static route to Null0 interface and add it to the BGP through network command.

3) Use the BGP route summarization:

R1 (config) #router bgp 65000
R1 (config-router) # aggregate-addresses 192.168.4.0 255.255.252.0 [summary-only] [...]

Without summary-only option, aggregate prefix and all of its more-specific prefixes will be announced. For the aggregated prefix announcement, it is necessary to have at least one more specific route in the RIB.

[…] – Other options, namely:

   as-set – allows inclusion of AS numbers in the AS_PATH attribute of the aggregate prefixes (for protection against Black Hole).

Given that AS number will be repeated in the AS_PATH, BGP will not install such a summary route in its table (BGP Loop Prevention).

  advertise-map –  to perform AS_PATH filtering for a summary route (configurable via Route-map).

  suppress-map – to perform filtering of more specific routes (configurable via Route-map).

  attribute-map – to set the attributes for the summary route (configurable via Route-map).

When using BGP route summarization, an aggregate BGP route to Null0 interface will appear in the RIB.

During redistribution, IGP protocol metric translates into the MED attribute (translation can also be accomplished by specifying network via network command, if this network is brought by IGP and present in the routing table), and if more preferable attributes are not involved (for example, if ISP applies a more preferable LOCAL_PREFERENCE on his side, the whole idea will fall apart), ISP or another autonomous system will route to us through the path with lesser MED (which is logical).

Facebooktwitterredditpinterestlinkedinmail

Leave a Reply

Your email address will not be published. Required fields are marked

Your Name

Your email