An Interdomain Routing Protocol (IDRP), also known as exterior gateway protocol (EGP)
- EBGP – External Border Gateway Protocol – Between Autonomous Systems (AD = 20)
- IBGP – Internal Border Gateway Protocol – Inside the same AS (AD = 200)
- BGP is a policy based routing (PBR) protocol that allows Autonomous Systems to manipulate traffic flow using multiple BGP path attributes, known as metrics.
- BGP is categorized as a distance vector protocol with enhancements:
- Reliable Updates (No need for periodic updates or route info refresh, just keepalives to verify TCP)
- Triggered Updates Only
- Rich Metrics (Called Path Attributes)
- BGP establishes a TCP session on port 179 between the “peer routers” or “neighbors” (no auto-detection of neighbors via broadcast or hello packets like EIGRP, OSPF, IS-IS)
- Only one instance of BGP can be configured on the router at any single time
- Networks must be present in the routing table before they can be advertised by BGP
- the network command does not start BGP on specific interfaces, but indicates which networks it should originate from this router. NVRAM/RAM is limiting factor
- Without the mask option, this command announces only the classful network number. At least one subnet of the specified major network must be present in the IP routing table to allow BGP to start announcing the classful network as a BGP route. However, if the mask option is specified, an exact match to the network (address and mask) must exist in the routing table. Before BGP announces a route, it checks to see whether it can reach it.
- If the exact route is not in the table, you can add a static route to Null0 so that the route can be announced. For instance if the route is not directly connected.
- After a connection is made, BGP peers exchange complete routing tables. However, because the connection is reliable, BGP peers send only changes (incremental, or triggered, updates). Reliable links do not require periodic updates, therefore, routers use triggered updates instead. BGP sends keepalive messages (every 60 seconds)
- BGP does not accept unsolicited updates; it must be aware of every neighboring router and have a neighbor statement for it
Next-Hop is the address that is used to reach the next AS. next-hop address is not always the router that is directly connected to this router. It is sometimes necessary to override the next-hop behavior of a router and force it to advertise itself as the nest-hop for routes that are sent to a neighboring router. The neighbor next-hop-self command forces BGP to use the source IP address of the update as the next-hop address for each advertised network.
Four BGP message types:
- Open – Version, AS, hold time, BGP router ID, Optional parameters
- Keepalive – consists of only a message header (every 60 seconds)
- Update – Withdrawn routes, Path attributes, Network-layer reachability
- Notifications – BGP session us closed, Error condition is detected.
A router running BGP keeps it’s own tables to store info that it received from and send to other routers, including:
- Neighbor Table
- BGP Table
- IP routing Table
Four types of BGP routers
- BGP Speaker – Any router that runs BGP. limited number of neighbors which it peers with and forms a TCP relationship.
- BGP router –
- BGP neighbor
- BGP peer – BGP speaker that is configured to form a neighbor relationship with another speaker to directly exchange BGP routing information. BGP peers are also known as BGP neighbors and can be external or internal to the AS.
External neighbors are directly connected. A network this is assigned to the link between neighbors, as well as the next-hop IP address, must be reachable for routing purposes. By default, routers that are running EBGP are directly connected to each other and establish a TCP session before exchanging BGP updates.
Requirements for EBGP:
- Different AS numbers – otherwise it’s IBGP
- Defined neighbors – TCP session must be established before exchanging BGP routing updates.
- Reachability – must be directly connected and IP on that link must be reachable inside each AS
- IBGP runs within an AS to exchange BGP info so that all BGP speakers have the same BGP routing info about an outside autonomous system.
- IBGP is typically established between CE routers inside the enterprise network AS, as well as, between the routers inside each ISP.
Requirements for IBGP neighbor relationship:
- Same AS number
- Defined neighbors
update-source Loopback 0: Use a loopback interface when there are multiple paths between IBGP neighbors. Otherwise if the BGP router is using a neighbor address that is assigned to a specific interface on another router, and that interface goes down, the router that is pointing to this address loses it’s BGP session with that neighbor. Also make sure both routers are announcing their loopback addresses into their local routing protocol.
Troubleshooting BGP – sessions can be stuck-in-active or idle state. The most common reason for a router to enter the idle state is that the neighbor is not announcing the IP address or the network toward which the neighbor statement of the router is pointing.
Another common problem that is associated with the active state occurs when a BGP router attempts to peer with another BGP router that does not have a neighbor statement peering back to the first router, or when the other router is peering with the wrong IP address on the first router.
If the state toggles between Idle/Active, one of the most common problems is the AS number is misconfiguration.
- Idle – searching the routing table to see whether a route exists to reach the neighbor
- Active – actively trying to connect, troubleshot if it does not move to established.
- Connect – Found a route to the neighbor and has completed TCP (3-way handshake)
- Open Sent – sends parameters for the BGP session – active state if no response in 5 sec
- Open Confirm – receives an agreement on the parameters for establishing a session
- Established – Peering is established, routing begins
sh ip bgp:
- “>” signifies the best route
- “*” means the next-hop address is valid
- “s” suppressed – only the summary route is being sent
- “r” RIB-failure – route was not installed into the RIB. sh ip bgp rib-failure
- “i” (first one) indicates that IBGP neighbor advertised this path
- “i” (last one) originating router probably used a network statement to introduce into BGP
- 0.0.0.0 – this router is the originator of the route
- “?” signifies that BGP cannot absolutely verify the availability of this network because it is redistributed from an IGP into BGP
Clearing the BGP Session:
When policies change, the change takes effect immediately. The next time that a prefix or path is advertised or received the new policy is used. This can take a long time for all networks. You must trigger an update for immediate action.
- Hard reset
- Soft reset
- Route refresh
BGP can potentially process huge volumes of routing info. When a policy configuration change occurs, the router cannot go through the huge table of BGP info and recalculate which entry is no longer valid in the local table; also, the router cannot determine which route or routes, already advertised, should be withdrawn from a neighbor.
- clear ip bgp * – resets all BGP connections, the entire forwarding table is discarded
- clear ip bgp 10.1.1.2 – resets a single neighbor – less impact!
- clear ip bgp 10.1.1.2 soft out
- clear ip bgp 10.1.1.2 soft in – requires soft-reconfiguration inbound to be configured
- clear ip bgp soft in – Route refresh – does not require preconfiguration.
Route Selection Decision Process:
- Highest weight (local to router – default is 0 – Cisco proprietary )
- Highest local preference (global within AS – default is 100)
- Route originated by local router (next-hop = 0.0.0.0)
- Shortest AS path – most common reason for path selection without manipulation.
- Lowest origin code (IGP<EGP<incomplete)
- Lowest MED (exchanged between autonomous systems)
- EBGP over IBGP
- Path through closest IGP neighbor
- Oldest route for EBGP paths
- lowest neighbor BGP router ID
- lowest neighbor IP address
- Without route manipulation, the most common reason for path selection is Step 4 – prefer the shortest AS path.
- Weight – this attribute applies when one router is used with multiple exit points out of an AS, as opposed to the local preference, which is used when two or more routers provide multiple exit points.
- The local preference is an attribute that is configured on a router and exchanged among routers within the same AS only. It can only be used within a single AS to influence route selection.
- Routes with a higher weight are preferred when multiple routes exist to the same destination.
- Route maps can set the weight or completely filter out routes.
- The benefit of manipulating AS paths to influence route selection is that the configuration needed is done in the AS that is requesting a desired return path.
- The MED is an indication to EBGP neighbors about the preferred path into an AS. unlike local preference, MED is exchanged between autonomous systems.
- MED influences inbound traffic to an AS, local preference influences outbound traffic from an AS
- MED attribute means that BGP is the only protocol that can affect how routes are sent into an AS.
- To apply a route-map to filter incoming or outgoing BGP routes, use the neighbor route-map command in router configuration mode.
- As an option, filter lists, prefix lists, and route maps can be applied on either incoming or outgoing information, or in any combination in BGP.
Local preference can be set when:
- Processing incoming route updates
- Doing redistribution
- Sending outgoing route updates
- debug ip bgp ipv4 unicast
- show ip bgp – Displays the entire BGP forwarding table.
- show ip bgp summary
- sh ip bgp neighbors
- sh ip route bgp