🔹 CCNP-ENCOR V1.1 350-401 | Chapter 11: Border Gateway Protocol (BGP) 🔹

Chapter 11 dives deep into Border Gateway Protocol (BGP), the protocol that powers the internet by managing how packets are routed between autonomous systems (AS). BGP is an Exterior Gateway Protocol (EGP) that uses path attributes to determine the best path for routing traffic. In this chapter, we cover BGP fundamentals, session types, path attributes, configuration steps, and advanced topics such as route aggregation, multiprotocol BGP for IPv6, and summarization techniques.


🌐 Autonomous System Numbers (ASNs)

Autonomous Systems (AS) are collections of IP networks managed by a single entity that has its own routing policies. Each AS is assigned a unique Autonomous System Number (ASN), which identifies it on the internet. BGP relies on ASNs to facilitate inter-domain routing and maintain a loop-free environment, it uses TCP 179

  • Private ASNs: Ranges from 64512 to 65535, used within organizations and not advertised publicly.
  • Public ASNs: Assigned by regional internet registries (RIRs) and used for global routing.

To configure a BGP router with a specific ASN:

  • Router(config)# router bgp <asn>

For example, configuring a router in ASN 65001:

  • Router(config)# router bgp 65001

📜 BGP Path Attributes

BGP uses path attributes (PAs) associated with each network path. The PAs provide BGP with granularity and control of routing policies within BGP. The BGP prefix PAs are classified as follows:

  • Well-known mandatory
  • Well-known discretionary
  • Optional transitive
  • Optional non-transitive

BGP makes routing decisions based on path attributes, which include information about the route, such as AS path, origin, and next hop. Here are the key BGP path attributes:

  1. AS_Path: Lists all ASNs a route has traversed. Shorter paths are preferred.(Prevent loops)
  2. Next_Hop: Indicates the next hop IP address to reach a destination. BGP routers must have a route to the next hop to consider the path valid.
  3. Origin: Specifies the origin of the route (IGP, EGP, or incomplete), helping BGP determine the preferred path.
  4. Local Preference: Determines the preferred path for outgoing traffic in an AS. Higher values are preferred.
  5. Multi-Exit Discriminator (MED): Suggests the preferred path into an AS for incoming traffic. Lower values are preferred.

To adjust the Local Preference for a specific route:

  • Router(config-router)# bgp default local-preference <value>

Path Selection: BGP evaluates path attributes in a specific order to select the best route. Local Preference and AS_Path are among the highest priorities in the decision-making process.

BGP Packet Types

  • OPEN: Sets up and establishes BGP adjacency
  • UPDATE: Advertises, updates, or withdraws routes
  • NOTIFICATION: Indicates an error condition to a BGP neighbor
  • KEEPALIVE: Ensures that BGP neighbors are still alive

BGP Neighbor States

BGP forms a TCP session with neighbor routers called peers. BGP uses the finite-state machine (FSM) to maintain a table of all BGP peers and their operational status. The BGP session may report the following states:

  • Idle
  • Connect : If TCP started
  • Active : Try one more time to establish the TCP if fail back to Connect
  • OpenSent: check BGP version, neighbor IP command , AS number , RID, passowrd and TTL
  • OpenConfirm: BGP wait for keepalive or notificiation
  • Established

📝 BGP Attribute AS_Path

The AS_Path attribute is a critical component for loop prevention in BGP. Each time a route traverses an AS, the ASN is added to the AS_Path. Routers avoid routing loops by discarding routes containing their own ASN in the AS_Path list.

To manipulate the AS_Path for policy-based routing, you can use AS_Path Prepending to make a path less desirable:

  • Router(config-router)# neighbor <ip_address> route-map <map_name> out

For example, to prepend ASN 65001 three times to a route:

  • Router(config-route-map)# set as-path prepend 65001 65001 65001

📂 Address Family Databases and Configuration

BGP supports multiple address families for routing different types of traffic, such as IPv4, IPv6, and VPNv4. Address Family Identifier (AFI) and Subsequent Address Family Identifier (SAFI) are used to specify these traffic types. To configure BGP with address families, use the following steps:

  1. Enter BGP configuration mode:
    • Router(config)# router bgp <asn>
  2. Enable IPv4 or IPv6 address family:
    • Router(config-router)# address-family ipv4 unicast
    • Router(config-router)# address-family ipv6 unicast
  3. Configure BGP neighbors under the address family:
    • Router(config-router-af)# neighbor <ip_address> activate

For example, to enable IPv6 BGP sessions:

  • Router(config-router)# address-family ipv6 unicast
  • Router(config-router-af)# neighbor 2001:db8::2 activate

Note: BGP sessions must be activated for each address family to exchange routes.


🔄 BGP Inter-Router Communication and Session Types

BGP routers establish sessions to exchange routing information. Sessions can be Internal (iBGP) within the same AS or External (eBGP) between different ASes.

  • iBGP: Connects routers within the same AS. iBGP does not modify the AS_Path attribute.
  • eBGP: Connects routers in different ASes. eBGP routers prepend their ASN to the AS_Path for loop prevention.(TTL is 1 by default) Multihop command needed

Configuring iBGP and eBGP Sessions:

  • Router(config-router)# neighbor <ip_address> remote-as <asn>

For example, to configure an eBGP session with neighbor 192.168.1.2 in ASN 65002:

  • Router(config-router)# neighbor 192.168.1.2 remote-as 65002

🔧 Basic BGP Configuration

To set up BGP on a router, configure the following basic settings:

  1. Enable BGP with the ASN:
    • Router(config)# router bgp <asn>
  2. Define BGP Neighbors:
    • Router(config-router)# neighbor <ip_address> remote-as <asn>
  3. Advertise Networks:
    • Router(config-router)# network <network_address> mask <subnet_mask>

For example, to advertise network 172.16.0.0/16:

  • Router(config-router)# network 172.16.0.0 mask 255.255.0.0

Note: Ensure the network you advertise is in the routing table. BGP won’t advertise networks that aren’t reachable.


✅ Verification of BGP Sessions

To verify the status of BGP sessions, use the following commands:

  • Check BGP Neighbor Status:
    • show ip bgp summary
  • Display Detailed BGP Neighbor Information:
    • show ip bgp neighbors
  • View BGP Routing Table:
    • show ip bgp

These commands help troubleshoot and verify BGP connections, allowing you to monitor peer states and routing table entries.

BGP uses three tables for maintaining the network prefix and path attributes (PAs) for a route:

  • Adj-RIB-In: Contains the routes in original form (that is, from before inbound route policies are processed). To save memory, the table is purged after all route policies are processed.
  • Loc-RIB: Contains all the routes that originated locally or were received from other BGP peers. After the routes pass the validity and next-hop reachability check, the BGP best-path algorithm selects the best route for a specific prefix. The Loc-RIB, also known as the BGP table, is used for presenting routes to the IP routing table (RIB).
  • Adj-RIB-Out: Contains the routes after outbound route policies have been processed.

📦 Prefix Advertisement and Aggregation

BGP can advertise routes individually or aggregate them to reduce routing table size. Route aggregation is used to combine multiple routes into a single prefix.

Basic Route Aggregation:

  • Router(config-router)# aggregate-address <prefix> <mask>

For example, to aggregate 10.1.0.0/16 and 10.2.0.0/16:

  • Router(config-router)# aggregate-address 10.0.0.0 255.0.0.0

To prevent the advertisement of specific routes within the aggregated range, use the summary-only option:

  • Router(config-router)# aggregate-address <prefix> <mask> summary-only

🌍 Multiprotocol BGP for IPv6

Multiprotocol BGP supports IPv6 by enabling BGP to handle both IPv4 and IPv6 routing. To configure IPv6 in BGP, specify the IPv6 address family and activate it for specific neighbors.

IPv6 Configuration:

  1. Enter BGP configuration mode:
    • Router(config)# router bgp <asn>
  2. Specify the IPv6 address family:
    • Router(config-router)# address-family ipv6 unicast
  3. Activate IPv6 on the neighbor:
    • Router(config-router-af)# neighbor <ipv6_address> activate

🔄 BGP Summarization Techniques

BGP supports several methods for route summarization, which helps reduce the routing table size and improves efficiency. The aggregate-address command can be used for summarization, and AS_SET can be used to retain the AS path information.

Route Aggregation with AS_SET:

  • Router(config-router)# aggregate-address <prefix> <mask> as-set

This command includes the list of ASNs contributing to the aggregate route, preserving information about the original AS paths.

Atomic Aggregate:

Use the atomic aggregate attribute to inform other BGP routers that some AS information has been suppressed.

  • Router(config-router)# aggregate-address <prefix> <mask> atomic-aggregate

📋 Summary

Chapter 11 covered the essentials of BGP, including session types, path attributes, address families, and route aggregation. Here’s a quick recap:

  • Autonomous System Numbers (ASNs): Identify separate administrative domains.
  • Path Attributes: BGP uses AS_Path, Next_Hop, Local Preference, and MED to make routing decisions.
  • Session Types: eBGP for inter-AS communication and iBGP for intra-AS routing.
  • BGP Configuration: Establish neighbors, advertise networks, and verify sessions with show commands.
  • Prefix Advertisement: Aggregate routes to simplify the routing table and improve network efficiency.
  • IPv6 Support: Configure multiprotocol BGP for dual-stack environments using address families.
  • Summarization Techniques: Use AS_SET and atomic aggregate for efficient and optimized route summarization.

This concludes our detailed exploration of BGP. In the next chapter, we’ll dive into advanced BGP concepts and policy controls for fine-tuning BGP behavior in complex networks. Stay tuned!

Leave a Comment

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

Scroll to Top