Table of Contents
Basic BGP configuration
The basic configuration flow for BGP is as follows
- Enabling the BGP routing process
- Configuring the Neighbor
- Generating BGP routes
Enabling the BGP routing process
In BGP configuration, first enable the BGP routing process. In global configuration mode, enter the following command.
(config)#router bgp <AS>
(config-router)#
<AS> : AS number
Only one BGP routing process can be enabled.
Configuring the Neighbor
Next, configure BGP neighbors to exchange route information with BGP. unlike OSPF and other IGPs, BGP explicitly configures the neighbors manually. enter the following command in BGP’s configuration mode.
(config)#router bgp <AS1>
(config-router)#neighbor <ip-address> remote-as <AS2>
<AS1> : Own AS number
<ip-address> : neighbor IP address
<AS2> : neighbor AS number
EBGP and IBGP neighbors are determined by the AS number of the router bgp command and the AS number of the neighbor remote-as command.
- EBGP neighbor
- router bgp AS number ≠ neighbor remote-as AS number
- IBGP neighbor
- router bgp AS number = neighbor remote-as AS number
The BGP neighbor must be configured with matching recognition on both routers that establish the neighbor. In order to establish a neighbor, the source IP address and AS number of the received BGP OPEN message must match the neighbor’s IP address and AS number specified in the neighbor remote-as command. The following figure illustrates this.
The destination IP address of the BGP message is the IP address specified by the neighbor remote-as command. The source IP address is the IP address of the output interface. if you are an IBGP neighbor, you may need to change the interface used as the source IP address for BGP messages. To change the interface used as the source IP address, use the neighbor update-source command.
Generating BGP routes
If you configure a BGP neighbor, you can receive BGP routes from that neighbor. You can then further advertise BGP routes to other BGP neighbors.
In addition to advertising routes received from other ASes, there are three ways to generate the route information of the network in your AS as a BGP route.
- network command
- redistribute from IGPs within AS
- aggregate-address command
You can use any of these, or a combination of them, to advertise a route in your AS to another AS in BGP. A route can only be advertised to the best path on the BGP table. In other words, advertising a route in your AS by BGP can be rephrased as putting the route information you want to advertise in the BGP table and making it the best path.
network command
The network command is a command to generate route information to be advertised in BGP. enter it in BGP configuration mode as follows.
(config)#router bgp <AS>
(config-router)#network <address> [mask <subnetmask>]
<address> : Network address
<subnetmask> : subnet mask
The network command places the specified route information on the BGP table as the best path. the mask option is required for subnetting or aggregation. The mask option is not required for classful network addresses.
For the network command of BGP described above to work, there is a condition. That is, the route information must exist in the routing table that exactly matches the route information specified by the network command. The source of the route information can be anything: it can be an IGP such as OSPF or EIGRP, a static route, or a directly connected. Note that you need the route information to be an “exact” match.
As long as it’s in the routing table, you can generate a BGP route, even if it’s a network that’s not directly connected to that router. In the figure below, R1 is not directly connected to the 100.0.0.0/8 network. However, if 100.0.0.0.0/8 is registered in the routing table of R1, the network command can generate 100.0.0.0/8 route information as a BGP route.
IGP such as OSPF, RIP, and EIGRP also use the network command, but note that the network command is completely different from the BGP network command, which is used to specify the interface on which the routing protocol works. is. Therefore, it specifies the network address that is directly connected to the router. On the other hand, BGP is a command for specifying the route information you want to advertise with BGP. You do not need to specify the network address directly connected to the router.
The path attribute of the Well known Mandatory is added to the BGP route information generated by the network command. The default path attribute of the Well known Mandatory is as follows.
- ORIGIN attribute: “i (IGP)”
- NEXT_HOP attribute: “0.0.0.0”or the next hop of an IGP route in the routing table.
- AS_PATH attribute : blanks
redistribute from IGPs within AS
The network command must be configured to generate BGP routes one by one. If there are 100 BGP routes to be created, then the network command must also be configured for 100 routes. This is a lot of work. To generate BGP routes in batches, redistribute from the IGP within AS is done by using the redistribute command in the BGP configuration mode.
(config)#router bgp <AS>
(config-router)#redistribute <protocol> route-map <route-map-name>
<AS> : AS number
<protocol> : redistribute source
<route-map-name> : Name of the route map to apply
R1 in the figure below is an example of 10 OSPF routes (100.1.1.0/24 to 100.1.10.0/24) that have been registered as a batch of BGP routes in the BGP table.
The following is the path attribute of the Well known Mandatory that is added to the BGP route generated by the redistribute command.
- ORIGIN attribute : “? (Incomplete)”
- NEXT_HOP attribute : “0.0.0.0”or the next hop of an IGP route in the routing table.
- AS_PATH attribute : Blanks
Note that ORIGIN is “? (Incomplete)”, it is not desirable to advertise a BGP route to other ASes with the ORIGIN of “?”. It is common to apply a route map on redistribute to change the ORIGIN of the BGP route from “?” to “i”. Also, not all IGP routes are redistributed to BGP . When redistributing, filter the routes with a route map and use only the routes you want to generate as BGP routes.
aggregate-address command
The aggregate-address command is used to generate a BGP aggregate route. You can generate a BGP route that aggregates multiple BGP routes. use the following command in BGP configuration mode.
(config)#router bgp <AS>
(config-router)#aggregate-address <network-address> <subnet-mask>
<AS> : AS number
<network-address> : network address of the aggregate route
<subnet-mask> : subnet mask
The route specified by the aggregate-address command is placed in the BGP table and becomes the best path and is advertised to other BGP neighbors. However, the condition for using the aggregate-address command is that at least one BGP route in the BGP table that is in the range of the aggregate route.
Verify BGP configuration
To verify BGP configurations, use the show command as follows
- show ip protocols
- show ip bgp summary
- show ip bgp
- show ip route bgp
show ip protocols
The show ip protocols command is a command that allows you to see a general overview of the routing protocols configured on the router. you can see the following information as an overview of BGP.
- AS number
- Configured neighbors
- Filters applied to the neighbors
Router#show ip protocols Routing Protocol is "bgp 8127" Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set IGP synchronization is disabled Automatic route summarization is disabled Neighbor(s): Address FiltIn FiltOut DistIn DistOut Weight RouteMap 161.8.17.2 192.10.32.254 1 WEIGHT 212.12.8.254 Maximum path: 1 Routing Information Sources: Gateway Distance Last Update 192.10.32.254 20 01:46:22 212.12.8.254 20 00:26:17 161.8.17.2 200 00:18:58 Distance: external 20 internal 200 local 200
show ip bgp summary
The show ip bgp summary command displays a summary of the BGP table. You can verify the status of the BGP neighbor at the end of that display.
R1#show ip bgp summary BGP router identifier 203.8.1.1, local AS number 8127 BGP table version is 87, main routing table version 87 41 network entries using 4141 bytes of memory 70 path entries using 3360 bytes of memory 10 BGP path attribute entries using 600 bytes of memory 1 BGP rrinfo entries using 24 bytes of memory 5 BGP AS-PATH entries using 120 bytes of memory 1 BGP community entries using 24 bytes of memory 0 BGP route-map cache entries using 0 bytes of memory 4 BGP filter-list cache entries using 48 bytes of memory BGP using 8317 total bytes of memory BGP activity 77/36 prefixes, 107/37 paths, scan interval 60 secs Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd 161.8.17.2 4 8127 188 180 87 0 0 01:49:03 10 192.10.32.254 4 1 179 161 87 0 0 01:48:46 29 212.12.8.254 4 1 49 50 87 0 0 00:26:19 30
To see if the BGP neighbor is operating normally, look at the “State/PfxRcd” on the right side of the display. If this part is a number, the BGP neighbor is in an established state. The number is the number of BGP routes received from the corresponding neighbor.
Note that show ip bgp summary only gives you an overview of the BGP neighbor. use the show ip bgp neighbor command if you want to see detailed information about the BGP neighbor.
show ip bgp
The show ip bgp command is used to verify the BGP table. all route information received from and advertised to BGP neighbors is stored in the BGP table.
R1#show ip bgp BGP table version is 87, local router ID is 203.8.1.1 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path * 2.0.0.0 212.12.8.254 0 0 1 200 i *> 192.10.32.254 0 250 1 200 i *> 3.0.0.0 212.12.8.254 0 0 1 500 400 300 i * 4.0.0.0 212.12.8.254 0 0 1 i *> 192.10.32.254 0 250 1 i * 5.0.0.0 212.12.8.254 0 0 1 i *> 192.10.32.254 0 250 1 i * 6.0.0.0/23 212.12.8.254 0 0 1 i *> 192.10.32.254 0 250 1 i
A path attribute is appended to the BGP route information. you can use the show ip bgp command to see the following path attributes for each BGP route information.
- NEXT_HOP attribute(Next hop column)
- MED attribute (Metric column)
- LOCAL_PREFERENCE attribute (LocPrf column)
- WEIGHT attribute (Weight column)
- AS_PATH attribute (Path column)
- ORIGIN attribute (right-most character in Path)
Also, the best path is represented by “>”. For example, for the network address 2.0.0.0/8 in the example output above, there are two route information
Attributes | Route information 1 | Route information 1 |
NEXT_HOP | 212.12.8.254 | 192.10.32.254 |
MED | 0 | 0 |
LOCAL_PREFERENCE | None | None |
WEIGHT | 0 | 250 |
AS_PATH | 1 200 | 1 200 |
ORIGIN | i | i |
Of the two route information for 2.0.0.0/8, route information 2 was chosen as the best path. In this example, the best path is determined by the WEIGHT attribute, which is a Cisco proprietary attribute.
If you want to see all the path attributes attached to each route information, use the show ip bgp command to specify the individual route information.
The show ip bgp command displays the entire BGP table. To extract only the BGP routes that have been sent and received to and from a specific neighbor from here, use the show command: show ip bgp
- show ip bgp neighbor <ip-address> advertised-routes
- Display only BGP route information advertised to a specified BGP neighbor.
- show ip bgp neighbor <ip-address> routes
- Display only the BGP route information received from the specified BGP neighbor.
show ip route bgp
The show ip route bgp command allows you to display only route information in the routing table that has been learned by BGP. route information in BGP is represented by the code “B”. The administrative distance for BGP is 20 for EBGP routes and 200 for IBGP routes.
How the BGP works
- BGP Basic Configuration and Verification Commands
- BGP Neighbor Status
- BGP Neighbor Authentication
- BGP Well Known Mandatory Attributes
- Illustration: BGP Best Path Selection
- BGP KEEPALIVE timer/Hold time Configuration
- BGP Route Minimum Advertisement Interval Configuration
- BGP Route Dampening
- BGP Route Filter Overview
- BGP Route Filter : distribute-list
- BGP Route Filter : distribute-list Configuration Example
- BGP Route Filter : prefix-list
- BGP Route Filter : prefix-list Configuration Example
- BGP Route Filter : filter-list(AS_PATH ACL)-
- BGP Route Filter : filter-list(AS_PATH ACL) Configuration Example
- BGP Route Filter : Route-map
- BGP Route Filter : route-map Configuration Example
- BGP neighbor allowas-in command
- BGP neighbor as-override command
- BGP Route RIB Failure
- BGP Route Administrative Distance Adjustment
- BGP Route Load Balancing
- BGP Auto Summary
- BGP Route Summary : network command
- BGP Route Summarization : network command configuration example
- BGP Route Summary aggregate-address command
- aggregte-address command : summary-only opiton
- aggregte-address command : attribute-map opiton
- aggregte-address command : as-set opiton
- aggregte-address command : advertise-map opiton
- BGP Selective Aggregation Overview
- BGP Selective Aggregation : suppress-map
- BGP Selective Aggregation : unsuppress-map
- BGP local-as
- BGP neighbor remove-private-AS
- bgp fast-external-fallover
- BGP Prefix Limitation