Tutorial / Cram Notes
BGP is the backbone of the internet, allowing for the exchange of routing information between autonomous systems (AS). When deploying networks on Amazon Web Services (AWS) infrastructure — particularly in the context of the AWS Certified Advanced Networking – Specialty (ANS-C01) exam — understanding and effectively designing BGP routing with BGP attributes is critical. By manipulating these attributes, you can influence traffic flows to follow desired patterns such as load sharing and active/passive setups.
BGP Attributes and Traffic Influence
BGP attributes are pieces of information that BGP attaches to routes. These attributes can dictate how BGP routers choose the best path. Key attributes include:
- AS_PATH: The list of AS numbers a route has traversed.
- Next Hop: The next router to which packets should be forwarded.
- Local Preference (LOCAL_PREF): A value set within an AS to prioritize exit points from the AS.
- Multi Exit Discriminator (MED): Suggests to external neighbors the preferred path into an AS.
Load Sharing
Load sharing is the process of distributing traffic across multiple paths to optimize network resource utilization. Implementing load sharing with BGP involves tweaking attributes in such a way that traffic is balanced across multiple links.
- Equal-Cost Multi-Path (ECMP): BGP can be configured to allow multiple paths to a destination if they have the same cost. Enabling this feature is one way to share the load equally.
- Manipulating LOCAL_PREF: If two routes from within the AS go to the same destination but through different points, you can set the LOCAL_PREF to the same value for both paths, thus causing the router to see both paths as equally preferable.
- Adjusting MED: When you have multiple connections to another AS, setting the same MED for these links tells the external AS that it has multiple paths with the same preference to your AS.
Active/Passive
In an active/passive scenario, one path is preferred (active) under normal operations while another path is only used if the primary fails (passive). BGP attribute manipulation can ensure traffic follows this pattern:
- Higher LOCAL_PREF: The primary path is given a higher LOCAL_PREF value. This tells routers within the AS to prefer this path over others.
- Higher Weight: In Cisco routers, the weight attribute (which is Cisco-specific and not part of the standard BGP attributes) can be set higher on the primary path to make it more preferable.
- AS_PATH Prepending: By adding extra AS numbers to the AS_PATH attribute on announcements for the backup path, the AS_PATH becomes longer, making it less preferable and thus passive.
- Conditional Advertisement: In some cases, a backup route can be advertised only if the primary route fails using conditional BGP advertisements.
Examples
ECMP for Load Sharing:
router bgp 65001
bgp bestpath as-path multipath-relax
address-family ipv4
neighbor 192.0.2.2 remote-as 65002
neighbor 192.0.2.2 activate
maximum-paths 2
LOCAL_PREF for Active/Passive:
! Primary path configuration
route-map PREFER_PRIMARY permit 10
set local-preference 200
! Applying the route-map to the primary neighbor
router bgp 65001
neighbor 192.0.2.2 route-map PREFER_PRIMARY in
! Lower local-preference for backup
route-map PREFER_BACKUP permit 10
set local-preference 100
! Applying the route-map to the backup neighbor
router bgp 65001
neighbor 192.0.2.3 route-map PREFER_BACKUP in
Conclusion
Designing BGP routing with strategic use of BGP attributes is a potent method to control traffic patterns. The use of attributes like AS_PATH, LOCAL_PREF, MED, and others can establish load sharing for optimal resource utilization or determine active/passive routes for failover scenarios. Careful planning and implementation based on these BGP features can lead to robust and efficient network design, contributing to the knowledge needed for networking professionals aiming for the AWS Certified Advanced Networking – Specialty certification.
Practice Test with Explanation
True/False: When using BGP, the AS_PATH attribute is used to influence inbound traffic by prepending additional autonomous system numbers.
- Answer: True
Explanation: The AS_PATH attribute lists the AS numbers that a route has traversed. By artificially lengthening the AS_PATH through prepending, a network can appear less desirable, influencing others to prefer different paths for inbound traffic to that network.
True/False: The LOCAL_PREF BGP attribute is communicated between different Autonomous Systems to determine the best path selection.
- Answer: False
Explanation: LOCAL_PREF is an attribute used within a single Autonomous System (AS) to influence the best path selection. It is not communicated to other ASes.
Multiple Select: Which of the following attributes can influence outbound traffic flow? (Select all that apply)
- A) Weight
- B) LOCAL_PREF
- C) MED
- D) AS_PATH
Answer: A, C
Explanation: Weight and MED (Multi-Exit Discriminator) are used to influence the selection of outbound traffic from a local AS. The Weight attribute is Cisco-specific and not communicated to other routers, while MED can be communicated to neighboring ASes to suggest the preferred path for traffic entering the AS.
True/False: The WEIGHT attribute is a well-known, standardized BGP attribute that is exchanged between different BGP peers.
- Answer: False
Explanation: The WEIGHT attribute is a Cisco-specific attribute that is local to a router and not exchanged between BGP peers.
Single Select: What is the BGP attribute primarily used to influence the inbound traffic into your network from multiple entry points?
- A) MED
- B) LOCAL_PREF
- C) AS_PATH
- D) Community
Answer: C) AS_PATH
Explanation: The AS_PATH attribute is primarily used to influence inbound traffic by manipulating the path’s length to make routes appear less preferable.
True/False: Setting a lower MED value on a BGP route will make it more likely to be preferred by upstream neighbors.
- Answer: True
Explanation: The MED attribute, also known as the Multi-Exit Discriminator, is used to convey to upstream neighbors which path is preferred for inbound traffic. A lower MED value is more preferred.
Single Select: Which BGP attribute is used for influencing ingress traffic by representing “routing policies” that can be communicated to other BGP routers?
- A) Community
- B) AS_PATH
- C) LOCAL_PREF
- D) ORIGIN
Answer: A) Community
Explanation: BGP Communities are used to apply routing policies and can be communicated to other BGP routers to influence both ingress and egress traffic flows.
True/False: BGP Communities are only effective within the Autonomous System where they are applied.
- Answer: False
Explanation: BGP Communities can be carried across autonomous system boundaries, allowing them to influence routing decisions beyond the local AS.
True/False: An active/passive BGP design is achieved by setting the same local preference on all routes.
- Answer: False
Explanation: An active/passive BGP design typically involves setting a higher local preference for routes through the active path and a lower preference for the passive path, ensuring the active path is preferred.
Multiple Select: Which components could be used to design a load sharing architecture in BGP? (Select all that apply)
- A) Adjusting LOCAL_PREF values
- B) Equal cost multi-path (ECMP)
- C) Varying AS_PATH lengths
- D) Manipulating Community values
Answer: A, B, D
Explanation: Load sharing can be achieved by adjusting LOCAL_PREF values, enabling ECMP for multiple paths with the same cost, and applying Community values to influence the acceptance and preference of routes. Varying AS_PATH lengths typically influences traffic in an active/passive manner rather than load sharing.
True/False: The ORIGIN BGP attribute is the most significant attribute and takes precedence over AS_PATH and MED during the BGP best path selection process.
- Answer: False
Explanation: The ORIGIN attribute is less significant than AS_PATH and MED in the BGP best path selection process. It is one of the last attributes considered if all other attributes are equal.
Single Select: If two routes have the same AS_PATH length and origin type, which attribute will be used next to determine the preferred route in BGP?
- A) LOCAL_PREF
- B) MED
- C) Weight
- D) Neighbor IP address
Answer: B) MED
Explanation: If the AS_PATH lengths and the ORIGIN types are the same, the MED attribute will be used next to determine the preferred route, assuming all other more preferred attributes such as LOCAL_PREF and Weight (if a Cisco router) are equal. If MED is also the same or not present, other criteria, like eBGP over iBGP or the lowest IGP metric to the BGP next hop, comes into play before considering the neighbor IP address.
Interview Questions
What are the main BGP attributes you can manipulate to influence BGP path selection?
The main BGP attributes that can be manipulated include Local Preference, AS Path Prepending, Multi-Exit Discriminator (MED), and Community attributes. Local Preference determines outbound traffic preferences, AS Path Prepending artificially lengthens the AS Path to make a route less preferable, MED influences inbound traffic from the same neighboring AS, and Community attributes can be used to apply routing decisions across multiple routers.
How does changing the BGP Local Preference attribute affect traffic flow?
Changing the BGP Local Preference affects outbound traffic flow because it indicates to the BGP process which path is more preferred when multiple routes to the same destination exist. A higher Local Preference value is more preferred than a lower one. By setting a higher Local Preference on one path, traffic is influenced to exit through that path.
How can AS Path Prepending be used for load sharing?
AS Path Prepending can be used for load sharing by extending the AS Path length of one or more routes to influence incoming traffic to prefer shorter AS Paths. By prepending extra AS numbers to the path, that particular path becomes less desirable, causing traffic to be distributed over other available paths with shorter AS Paths, thus achieving a form of load sharing.
What is the role of the Multi-Exit Discriminator (MED) in controlling BGP traffic patterns?
The Multi-Exit Discriminator (MED) is used to signal to external neighbors the preferred path into an AS when multiple entry points exist. It is used for inbound traffic control. Lower MED values are more preferred, so by setting a lower MED on one entry point, traffic from the neighboring AS is more likely to take that path.
Can you explain the difference between Active/Passive and Load Sharing traffic patterns in BGP design?
Active/Passive traffic patterns involve having one primary path for traffic and a backup path that is only used if the primary fails, which is typically used for redundancy. Load Sharing, on the other hand, seeks to distribute traffic across multiple paths simultaneously to utilize available bandwidth more efficiently and avoid overloading a single link.
In what situation would you prefer to use BGP communities over other attributes?
You may prefer to use BGP communities when you need to apply consistent routing policies across multiple routers without changing the fundamental path attributes like AS Path or Local Preference. BGP communities can tag routes and signal to community-aware routers to take specific actions like accept, prefer, or suppress routes across a wide network region.
How can you implement an Active/Passive setup with BGP attributes to ensure redundant connectivity to your network?
To implement an Active/Passive setup, you can utilize a combination of attributes like AS Path Prepending, Local Preference, and MED. By setting a higher Local Preference and lower MED for the active path, and prepending additional AS numbers to the passive path, you ensure that the active path is always preferred under normal circumstances and the passive path is only used if the active path becomes unavailable.
What impact does setting a high Local Preference on all routers in an AS have when there are multiple exit points?
Setting a high Local Preference on all routers within the same AS will not help in determining which exit point routers should use since Local Preference is only significant within an AS. For influencing decision-making between multiple exit points, one would need to use attributes like MED or weight, which are evaluated at the border routers.
Why might you want to lower the Local Preference for a route, and what would be the result?
Lowering the Local Preference for a route may be desirable to make that route less preferred and thus influence the BGP process to choose a different path for outbound traffic. The result would be traffic avoiding the path with the lowered Local Preference when other more preferred paths are available.
What are the potential risks of using BGP AS Path Prepending excessively, and how might you mitigate them?
Excessive AS Path Prepending can lead to routing instability and sub-optimal paths. Long AS Paths can cause routers to drop updates due to policy restrictions or path size limitations. To mitigate these risks, ensure that prepending is done with a clear understanding of the routing policies of all intermediary ASes and limit the number of prepends to the minimum necessary to achieve the desired traffic pattern.
In AWS, how can you manipulate BGP attributes to prefer one Direct Connect connection over another for incoming or outgoing traffic?
In AWS, you can manipulate BGP attributes on Direct Connect connections by setting a lower MED to make one connection more preferable for incoming traffic from AWS. For outgoing traffic, you can set a higher Local Preference on the preferred path within your network to influence which Direct Connect connection is used.
How do you configure BGP to failover to another path when the primary path becomes congested, not just when it goes down?
BGP itself does not inherently detect or react to congestion; it makes decisions based on path attributes. To implement failover on congestion, you would need an additional mechanism, like Performance Routing (PfR) or Software-Defined WAN (SD-WAN) technologies, which can monitor live traffic conditions and adjust routing. These technologies can work with BGP, adjusting its attributes like Local Preference or MED when predefined thresholds are reached, to shift traffic away from congested paths.
Great blog post! Really helped me understand BGP attributes better.
Excellent explanation of load sharing using BGP attributes. Thanks!
Can someone explain how AS_PATH can be used to influence traffic flows?
Really loved the depth of the tutorial. I’m aiming for the ANS-C01 exam and this is gold!
How does BGP MED attribute work in AWS setups?
Not very useful. Could be more detailed.
How do you handle route aggregation in BGP for AWS?
Thanks for the valuable information!