Border Gateway Protocol (BGP) is one of the most crucial protocols in modern networking. As an exterior gateway protocol, it is responsible for exchanging routing information between different Autonomous Systems (ASes) on the internet.
Understanding BGP, its attributes, and its operations is vital for network engineers and architects working with large-scale networks.
This article contains BGP interview questions and answers for freshers to experienced candidates. We have covered basic to advanced interview questions on BGP.
Whether you are preparing for a job interview, looking to improve your BGP knowledge, or seeking to fine-tune your understanding, these BGP interview questions cover a range of topics—from path selection and attributes to troubleshooting techniques and optimization strategies.
Further enrolling in our networking course will help you understand BGP states and master important concepts for BGP interviews.
These are some common beginner-level BGP interview questions and answers that are frequently asked in job interviews.
Poison Reverse is a loop prevention mechanism used in Interior Gateway Protocols (IGPs) like RIP, but in BGP, the loop prevention is primarily handled through the AS Path attribute. In the context of BGP, poison reverse is not directly applicable. However, loop prevention in BGP can be achieved via the AS Path mechanism, where a router will reject a route if it detects its own AS number in the AS Path (this prevents loops). Poison reverse in RIP means that a router advertises a route with an unreachable metric (usually 16 for RIP) if it has learned that the route is no longer valid, effectively "poisoning" the reverse path.
Split Horizon is a routing technique where a router does not advertise a route back to the router from which it originally learned the route. In BGP, the split horizon rule is enforced within iBGP (internal BGP) to prevent routing loops. In simple terms, a BGP router will not advertise routes learned from an iBGP peer to other iBGP peers.
Example:
Router A advertises route `192.168.1.0/24` to Router B.
Router B learns the route `192.168.1.0/24` from Router A.
According to the split horizon rule, Router B will not advertise this same route back to Router A, even if it has a better path, to prevent a potential routing loop.
The main difference between iBGP and eBGP lies in the relationship between the routers involved and how the routing information is exchanged:
iBGP (Internal BGP):
● Used within a single Autonomous System (AS).
● Routers using iBGP maintain full mesh peering or use route reflectors to share routing information.
● iBGP does not modify the AS Path attribute.
● iBGP routes are not advertised to other iBGP peers unless specifically configured (e.g., via route reflectors).
eBGP (External BGP):
● Used to exchange routing information between different Autonomous Systems (ASes).
● Routers using eBGP typically have a direct connection to peers in other ASes.
● The AS Path attribute is updated when a route is advertised between different ASes, which is crucial for loop prevention.
● eBGP peers are generally connected directly over a public or private network.
Routing Information Protocol (RIP) is one of the oldest Interior Gateway Protocols (IGPs) used for routing within an Autonomous System. RIP is a distance-vector protocol that uses hop count as its metric to determine the best path. RIP has a maximum hop count of 15, meaning if a route requires more than 15 hops, it is considered unreachable. RIP works by periodically sending full routing updates to all neighboring routers. The two main versions are RIP v1 (classful) and RIP v2 (classless, supporting CIDR). RIP is considered simple but less scalable compared to more modern routing protocols like OSPF or EIGRP.
Yes, it is possible to run multiple BGP processes on the same router, but they must be configured for different Autonomous Systems (ASes). This is typically done in scenarios like BGP route reflectors or BGP confederations, where the router is handling different BGP sessions for different parts of the network. Each BGP process will have its own BGP table and neighbor configurations. However, it's important to note that running multiple BGP processes adds complexity and is generally used in more advanced scenarios.
Yes, routers on different subnets can become BGP neighbors. In BGP, the peer relationship is established based on IP addresses, so the routers do not have to be on the same subnet to communicate. As long as the BGP TCP session can be established (via the appropriate port, typically 179), the routers can establish a neighbor relationship regardless of their subnet configuration. For example, Router A might have an IP address in subnet 10.0.0.0/24, and Router B might have an IP in 192.168.1.0/24, but they can still become BGP neighbors as long as they can reach each other via IP routing.
BGP uses TCP port 179 for establishing and maintaining BGP sessions between peers. This port is used by BGP routers to send and receive BGP messages (OPEN, UPDATE, NOTIFICATION, and KEEPALIVE). The use of TCP ensures that BGP can reliably exchange routing information, as TCP provides mechanisms for error recovery, session persistence, and flow control, all of which are important for maintaining a stable routing environment in inter-domain routing.
BGP (Border Gateway Protocol) is a path vector protocol used for inter-domain routing. Its main purpose is to exchange routing information between different autonomous systems (ASes) over the internet. BGP helps in determining the best path for data transmission across multiple networks.
BGP Neighbor Adjacency states represent the different stages of establishing a BGP session between two peers:
● Idle: Initial state before BGP session starts.
● Connect: BGP is attempting to establish a TCP connection.
● Active: BGP is waiting for the TCP connection.
● OpenSent: BGP has sent an OPEN message and is awaiting an OPEN message from the peer.
● OpenConfirm: BGP has received an OPEN message and is awaiting a KEEPALIVE message.
● Established: The BGP session is fully established and routes can be exchanged.
The Next Hop attribute in BGP specifies the next IP address to which a BGP router should send the traffic. It is used to identify the next router on the path to a destination. The next hop is usually the IP address of the router that advertises the route to its BGP peers.
Here are some intermediate-level interview questions on BGP, that can be asked to candidates with 1- 3 years of experience.
The Multi-Exit Discriminator (MED) is an optional, non-transitive BGP attribute used by eBGP peers to influence the inbound traffic direction to the advertising AS. The MED helps to signal which exit point from an AS should be preferred when multiple exit points exist. A lower MED value is preferred, meaning the route with the lower MED will be chosen. It is used to suggest the "preferred" path into an AS but only between BGP neighbors in different ASes. The MED value is not considered by iBGP peers.
The AS Path attribute is a well-known mandatory attribute in BGP that records the sequence of ASes that a route has traversed. It is used primarily for loop prevention and path selection. When a BGP router receives a route advertisement, it checks if its own AS number appears in the AS Path. If it does, the route is discarded to prevent a loop. Additionally, the shortest AS Path is generally preferred when selecting the best route, as fewer AS hops typically represent a more efficient path.
The Next Hop attribute specifies the IP address of the router to reach the destination network. For eBGP routes, the Next Hop is updated to the IP address of the eBGP peer that advertises the route. However, in iBGP, the Next Hop attribute is carried unchanged across the network, so if a route is received from one iBGP peer and advertised to another, the Next Hop remains the same unless modified manually.
Example: If Router A advertises a route to Router B via eBGP, Router B will update the Next Hop to its own IP address for that route. If Router B advertises the same route to Router C via iBGP, the Next Hop remains unchanged and is still Router A's IP.
iBGP (Internal BGP):
● The Next Hop attribute is not changed when advertising routes to other iBGP peers.
● Routes learned from iBGP peers are not advertised to other iBGP peers unless configured via route reflectors or confederations.
● The AS Path is not modified in iBGP route advertisements.
eBGP (External BGP):
● The Next Hop is updated to reflect the IP address of the advertising eBGP peer.
● The AS Path is modified to include the AS number of the advertising eBGP router.
● eBGP routes are advertised to both iBGP and eBGP peers.
The Local Preference attribute is a well-known discretionary attribute used within an AS to prefer one exit path over another when multiple exit paths to the same destination exist. The Local Preference value is higher for the preferred route. It is used only within an AS, so it is not advertised to eBGP peers. The default value is typically 100, and routes with higher Local Preference values are preferred for outbound traffic.
Example: If Router A has two iBGP routes to a destination, one with Local Preference 150 and the other with 90, Router A will prefer the route with Local Preference 150 to exit the AS.
BGP Route Reflectors (RRs) are used in iBGP networks to reduce the need for a full mesh of iBGP peerings. Without route reflectors, every iBGP router needs to establish a connection to every other iBGP router. A route reflector acts as an intermediary to reflect routing updates to non-client iBGP peers.
Impact on attributes:
● The Next Hop and AS Path attributes are typically preserved across route reflector updates.
● Local Preference and MED can be modified by the route reflector based on its configuration.
Example: If Router A (RR) learns a route from Router B (iBGP peer) and advertises it to Router C (another iBGP peer), Router C receives the route with the same Next Hop as Router B, and the AS Path remains unchanged.
The Atomic Aggregate is an optional, non-transitive BGP attribute used to indicate that a route has been aggregated, and some information might have been lost in the process. Specifically, it signals that the original paths from which the aggregate route was created may no longer be available, and the aggregated route might not contain full details (e.g., AS Path or Next Hop). When this attribute is set, other routers should treat the route with caution and might need to perform additional checks to ensure it is still valid.
BGP communities are optional attributes that allow routes to be tagged with a 32-bit value. Communities provide a mechanism for grouping routes and applying common policies to those groups. They help network operators manage routing policies across different routers and ASes.
BGP communities can be used to:
● Control route advertisements to specific peers or groups of peers.
● Filter or prioritize routes.
● Implement policies like NO_EXPORT, NO_ADVERTISE, or custom community values for specific routing actions.
Use case: A network administrator might use a community tag to prevent certain routes from being advertised to external peers, using the NO_EXPORT community to ensure that the routes do not leave the AS.
BGP uses a multi-step route selection process to determine the best route to a destination. The process evaluates several attributes in a specific order:
1. Highest Local Preference: If multiple routes exist to the same destination, the route with the highest Local Preference value is preferred.
2. Shortest AS Path: If Local Preferences are the same, BGP will prefer the route with the shortest AS Path (fewest AS hops).
3. Lowest MED: If AS Path lengths are equal, BGP prefers the route with the lowest MED (Multi-Exit Discriminator) value.
4. eBGP over iBGP: If still tied, routes learned from eBGP are preferred over routes learned from iBGP.
5. Oldest route: If all other criteria are equal, the route that was received first (older) is preferred.
When redistributing routes from other routing protocols into BGP, several things happen:
● AS Path: The AS Path is typically not populated if the route is coming from a non-BGP protocol (e.g., RIP or OSPF). The AS Path can be artificially created or marked as “Incomplete” in BGP, meaning the source of the route is not known or not traceable through ASes.
● MED: The MED attribute may be set to a default value or carried over from the source routing protocol, depending on how it is configured. However, when redistributing, MED is often ignored or reset to a default unless explicitly set.
● Route Filtering and Tagging: Route maps, prefix lists, or policy filters can be applied during redistribution to control which routes are redistributed and how attributes are modified.
Example: If OSPF routes are redistributed into BGP, the AS Path might be set as "incomplete," and no MED value would be carried over unless it was manually configured.
These intermediate-level questions dive deeper into BGP attributes and their usage, focusing on how they affect routing decisions and operations within networks.
If you want to learn BGP and understand it working in IT networking, join our CCNA training course. Contact learner Advisors now!
Here are 10 advanced BGP interview questions and answers that cover deeper aspects of BGP:
The Origin attribute is used to indicate the origin of a BGP route and helps to determine how a route was injected into BGP. There are three possible values for the Origin attribute:
● IGP (0): Indicates that the route was originated by an Interior Gateway Protocol (IGP), like OSPF or EIGRP, within the originating AS.
● EGP (1): Indicates that the route was learned via an Exterior Gateway Protocol (EGP).
● Incomplete (2): Indicates that the origin of the route is unknown, often used when the route was manually injected into BGP using network statements or redistributed from another routing protocol.
The Origin attribute helps in the BGP path selection process, where routes with IGP origin are preferred over those with EGP or Incomplete origin.
The Local Preference (LPref) attribute is a well-known discretionary attribute used to influence outbound routing decisions within an AS. A higher Local Preference value indicates a more preferred route. It is used primarily to control the preferred exit point from an AS when multiple paths exist to external destinations. The Local Preference attribute is not advertised to eBGP peers; it is only used within an AS to influence the routing decision of iBGP peers.
Example:
If you have two eBGP routes to reach the same destination, but you want one route to be preferred over the other, you can set a higher Local Preference value on the preferred route to influence the outbound traffic direction.
The Multi-Exit Discriminator (MED) is an optional, non-transitive attribute used by eBGP peers to suggest the preferred route when multiple paths exist between two ASes. The MED is typically used to influence the incoming traffic direction towards the advertising AS. A lower MED value is preferred, so the route with the lowest MED is chosen.
The MED is only considered when comparing routes from the same neighboring AS; it does not influence the selection of routes between different ASes. If no MED is specified, a default value (typically 0) is assumed.
Example:
If you have two exit points to reach a destination from an eBGP peer, one with a MED of 100 and the other with a MED of 200, the route with the MED of 100 will be preferred.
The AS Path attribute is a well-known mandatory attribute that contains a list of ASes that a route has traversed. It is used to prevent routing loops and to determine the shortest path. In BGP's path selection process, the AS Path is used as one of the criteria for selecting the best route:
BGP prefers routes with shorter AS Paths because they indicate fewer AS hops.
The AS Path is transitive, meaning it is passed along to other BGP routers.
Loop Prevention:
If a BGP router detects its own AS number in the AS Path of an incoming route advertisement, it will reject the route to prevent a loop.
The Next Hop attribute in BGP specifies the IP address of the next hop router to reach the destination network. In iBGP (Internal BGP), the Next Hop attribute may not change when the route is advertised from one iBGP router to another within the same AS. This is different from eBGP where the Next Hop is updated to reflect the IP address of the eBGP router advertising the route.
Next Hop in iBGP:
● The Next Hop is carried unchanged across iBGP updates unless modified explicitly (e.g., by a route map).
● Routers receiving iBGP routes must have a route to the Next Hop IP address, or else they will discard the route.
Example:
Router A advertises a route to Router B with a Next Hop of 10.1.1.1. If Router B advertises the same route to Router C, the Next Hop will remain 10.1.1.1, unless changed by configuration.
BGP Communities are a powerful mechanism to group routes and apply policy decisions to those groups across different routers in a BGP network. A community is a 32-bit value that can be attached to a route to signify a set of conditions or properties. Communities are often used to influence routing behavior across multiple ASes and enable simpler route filtering and management.
Types of Communities:
● Well-known communities (e.g., NO_EXPORT, NO_ADVERTISE, and NO_EXPORT_SUBCONFED).
● Custom or enterprise-specific communities can be defined for internal routing policy control.
Use Case:
A community might be used to advertise routes to certain peers with specific attributes or prevent advertisements of certain routes. For example, a community can mark routes to be not advertised to external peers using the `NO_EXPORT` community.
A BGP Soft Reset allows for the re-evaluation and re-advertisement of routes without resetting the BGP session. This means the router can update the BGP table and apply any changes in attributes such as MED or Local Preference without dropping the BGP session, which results in minimal disruption. Soft resets are commonly used when there's a need to refresh or change routing policies without interrupting service.
A BGP Hard Reset, on the other hand, involves tearing down the BGP session and re-establishing it, causing more disruption. After a hard reset, all BGP routes need to be recalculated, and any updates to attributes like MED or Local Preference are applied only after the session is re-established.
Example:
A soft reset may be used when changing Local Preference to prioritize certain routes, while a hard reset might be necessary if there is a fundamental change in the AS Path or Next Hop.
BGP route aggregation involves combining multiple specific prefixes into a broader prefix to reduce the size of the BGP routing table. During aggregation, some attributes like AS Path, Next Hop, and MED are handled in specific ways:
● AS Path: In aggregation, the AS Path of the aggregated route includes the AS Paths of the individual prefixes, but it does not get overly complicated as the aggregation combines these into a single entry.
● Next Hop: The Next Hop for the aggregated route is typically the Next Hop of the first advertised prefix or the first route in the aggregation.
● MED: The MED attribute is typically set to a default value (e.g., 0) for the aggregated route unless specified otherwise.
Route aggregation helps to reduce the size of the routing table and improve routing efficiency, especially in large-scale networks.
Both BGP Community and AS Path are used to apply routing policies, but they differ in their scope and usage:
AS Path:
The AS Path is a well-known mandatory attribute that records the sequence of ASes a route has passed through. It is primarily used to prevent loops and make routing decisions based on the length of the AS path. The AS Path is automatically included in route advertisements and is used globally to influence the selection of the best route.
Community:
The Community attribute is optional and transitive, meaning it can be passed along to other routers but is not required. It is used to group routes for easier policy management across different routers and ASes. Communities are flexible and can be customized (e.g., enterprise-specific communities) for specific routing actions, such as controlling the advertisement of routes or defining import/export policies.
Use Case Example:
AS Path can be used for loop prevention or selecting the shortest AS Path.
Community can be used to tag routes for specific routing actions, like preventing the advertisement of certain routes to external peers.
The Atomic Aggregate attribute is an optional, non-transitive attribute that is used in BGP to indicate that a route has been aggregated in a way that some of the
original route information may have been lost. This typically happens when multiple specific prefixes are aggregated into a larger prefix, and the details of the individual prefixes are not preserved in the aggregated route.
The Atomic Aggregate attribute is set to "True" when the router performs aggregation that does not preserve the path details of the individual routes. This tells the receiving router that the aggregated route may not have complete information about the original prefixes, and it may need to perform additional checks if necessary.
Use Case Example:
If a router aggregates multiple prefixes and loses some detail (like specific AS Path information), it will advertise the aggregated route with the Atomic Aggregate attribute to inform other routers of the loss of detail.
These advanced BGP questions focus on deeper concepts and the practical use of BGP attributes in large-scale networks
Preparing for a Border Gateway Protocol (BGP) interview requires a deep understanding of networking concepts, as BGP is a foundational protocol for managing internet routing. T
his guide has covered essential interview questions and answers to help you gain insights into BGP's functionality, troubleshooting techniques, and best practices.
By familiarizing yourself with these topics, you'll be well-equipped to handle technical discussions confidently and demonstrate your expertise.
He is a senior solution network architect and currently working with one of the largest financial company. He has an impressive academic and training background. He has completed his B.Tech and MBA, which makes him both technically and managerial proficient. He has also completed more than 450 online and offline training courses, both in India and ...
More... | Author`s Bog | Book a Meeting