You are on page 1of 7

Why we use BGP?

 BGP is a standardized exterior gateway protocol designed to exchange routing and reachability
information among autonomous systems (AS) on the Internet(Different ISP with AS)
 The protocol is classified as a path vector protocol.
 Works on Layer 4
 The Border Gateway Protocol makes routing decisions based on paths, network policies, or rule-sets
configured by a network administrator and is involved in making core routing decisions.
 BGP may be used for routing within an autonomous system. In this application it is referred to as Interior
Border Gateway Protocol, Internal BGP, or iBGP.
 The main purpose of BGP is to exchange routing updates like other routing protocols, but BGP typically
does not exchange individual network routes (but it technically can), it exchanges summaries of network
routes. This is because the typical use of BGP is over very large networks including the Internet.
 The AS-PATH attribute is used to prevent BGP routing loops. When receiving an BGP advertisement, the
router checks the AS-PATH attribute, if it see it’s own AS number in the AS-Path then it is a routing loop so
the router will not install this route in its BGP table.
 Local preference is an indication to the AS about which path has preference to exit the AS in order to
reach a certain network. A path with a higher local preference is preferred more. The default value for
local preference is 100.Unlike the weight attribute, which is only relevant to the local router, local
preference is an attribute that routers exchange in the same AS. The local preference is set with the “bgp
default local-preference value” command.
 Aggregate-Address command: When the aggregate-address command is used within BGP routing, the
aggregated address is advertised, along with the more specific routes. The exception to this rule is
through the use of the summary-only command. The “summary-only” keyword suppresses the more
specific routes and announces only the summarized route.
 The weight attribute is a special Cisco attribute that is used in the path selection process when there is
more than one route to the same destination. The higher the weight value, the better the path. The
default weight is 0.The weight attribute is local to the router and not propagated to other routers.
 BGP Autonomous Systems are assigned an Autonomous System Number(ASN), which is a 16-bit number
ranging from 1 – 65535. A specific subset of this range, 64512 – 65535, has been reserved for private (or
internal) use.
 A Cisco router running BGP can belong to only one AS. The IOS will only allow one BGP process to run on a
router.

 The Administrative Distance for routes learned outside the Autonomous System (eBGP routes) is 20, while
the AD for iBGP and locally-originated routes is 200.
 By default, BGP assumes that eBGP peers are a maximum of one hop away.This restriction can be
bypassed using the ebgp-multihop option with the neighbor command.
 Path Information: BGP advertisement also include path information, along with the reachable destination
and next destination pair.
 Policy Support: BGP can implement policies that can be configured by the administrator. For ex:- a router
running BGP can be configured to distinguish between the routes that are known within the AS and that
which are known from outside the AS.
 update-source is typically used on iBGP sessions, that are generally multihop and between router’s
loopback addresses. I often see people configuring update-source on directly connected eBGP session but
this is by no mean needed. For eBGP multihop session, it might be needed if you have multiple paths to
destination.
 BGP doesn’t require the neighbors should be in same subnet, where it uses TCP connection to pass BGP
messages.
 Runs Over TCP Port 179
 BGP conserve network Bandwidth.
 BGP supports CIDR.
 Now using BGP Version 4
 BGP – One hop away
 iBGP – no hop restriction
 AD for EBGP – 20 and for iBGP – 200

There are several requirements for forming BGP neighbors:-

The BGP router ID of the two routers must not be the same.

Each router must be part of a TCP connection.

Authentication must be passing if it’s configured

Layer 2 down preventing us from reaching the other side.

Layer 3 issue: wrong IP address on one of the routers.

Access-list blocking TCP port 179 (BGP).

Wrong IP address configured for BGP neighbor router.

BGP Version must be same

BGP Table

1) BGP Neighbor Table – table containing information about BGP neighbors.

2) BGP Table (also known as BGP topology table, BGP RIB) contains the network layer reachability information
(NLRI) learned in compliance with BGP and NLRI attributes (path attribute, PA) corresponding to these path.
Essentially, NLRI is a prefix and its length. BGP table contains all the routes from all the neighbors, several
routes to the same network with different attributes.

3) BGP Routing Table – the main IP routing tables that contains only the best routes from BGP Table. After BGP
has selected the best path to a network, that path is added to the main IP routing table.

BGP routes do not have outgoing interface in the routing table, but only the Next-Hop IP (the IP is known
through NEXT_HOP attribute). A recursive lookup will be done in the routing table.

BGP Route Information Management Functions:


 Route Storage:
Each BGP stores information about how to reach other networks.
 Route Update:
In this task, Special techniques are used to determine when and how to use the information received from
peers to properly update the routes.
 Route Selection:
Each BGP uses the information in its route databases to select good routes to each network on the internet
network.
 Route advertisement:
Each BGP speaker regularly tells its peer what is knows about various networks and methods to reach them.

There are two types of BGP neighbor relationships:

• iBGP Peers – BGP neighbors within the same autonomous system.

• eBGP Peers – BGP neighbors connecting separate autonomous systems.

BGP Messages:

1. BGP forms its peer relationships through a series of messages. First, an OPEN message is sent between
peers to initiate the session. The OPEN message contains several parameters:
• BGP Version – must be the same between BGP peers
• Local AS Number
• BGP Router ID
2. KEEPALIVE messages are sent periodically (every 60 seconds by default) to ensure that the remote peer is
still available. If a router does not receive a KEEPALIVE from a peer for a Hold-time period (by default, 180
seconds), the router declares that peer dead.
3. UPDATE messages are used to exchange routes between peers.
4. NOTIFICATION messages are sent when there is a fatal error condition. If a NOTIFICATION message is sent,
the BGP peer session is torn down and reset.

BGP States

As a BGP peer session is forming, it will pass through several states. This process is known as the BGP
Finite-State Machine (FSM):

• Idle – the initial BGP state

• Connect - BGP waits for a TCP connection with the remote peer. If successful, an OPEN message is sent.
If unsuccessful, the session is placed in an Active state.

• Active – BGP attempts to initiate a TCP connection with the remote peer. If successful, an OPEN
message is sent. If unsuccessful, BGP will wait for a ConnectRetry timer to expire, and place the session
back in a Connect State.

• OpenSent – BGP has both established the TCP connection and sent an OPEN Message, and is awaiting a
reply OPEN Message. Once it receives a reply OPEN Message, the BGP peer will send a KEEPALIVE
message.

• OpenConfirm – BGP listens for a reply KEEPALIVE message.

• Established – the BGP peer session is fully established. UPDATE messages containing routing information
will now be sent.

Note: If a peer session is stuck in an Active state, potential problems can include: no IP connectivity (no route to
host), an incorrect neighbor statement, or an access-list filtering TCP port 179.

BGP Synchronization

BGP follows a synchronization rule that states that all routers in a transit AS, including non-BGP routers, must learn
of a route before BGP can advertise it to an external peer.
BGP synchronization can be disabled under two circumstances:

• The local AS is not a transit between two other AS’s

• All routers in the transit AS run iBGP, and are fully meshed.

Originating Prefixes in BGP

There are three ways to originate a prefix (in other words, advertise a network) into BGP:

• By using network statements

• By using aggregate-address statements (explained later in this guide)

• By redistributing an IGP into BGP

Using the network statement informs BGP which networks to advertise to eBGP peers, not which interfaces to run
BGP on. The network command can be used to inject any network from the local AS into BGP, include dynamic
routes learned from an IGP, and not just the routes directly connected to the router

The route must be in the routing table before BGP will advertise the network to an eBGP peer. This is a
fundamental BGP rule.

Next Hop

A network in the BGP table with a next hop address of 0.0.0.0 means that the network is locally originated via
redistribution of Interior Gateway Protocol (IGP) into BGP, or via a network or aggregate command in the BGP
configuration.

Route Reflector

In BGP there is rule called Split Horizon Rule as per the rule that any route received from an iBGP neighbor must
not be advertised to any other iBGP neighbor.

Recall that BGP requires all iBGP peers to be fully meshed. Route-Reflectors allow us to bypass this restriction.
Fewer neighbor connections will result in less bandwidth and CPU usage.

Route reflector is BGP router that is allowed to break the iBGP loop avoidance rule. Route reflectors can advertise
updates received from an iBGP peer to another iBGP peer under specific conditions.
By breaking the rules, route reflectors are used to eliminate the full mesh requirement and allow for building iBGP
networks that scale easily and cleanly.

In BGP, route learned from an iBGP neighbor will not be advertised to another iBGP neighbor. To overcome this
situation route reflector is used. It acts as a route reflector server and makes IBGP neighbors as route reflector
clients enabling route advertisements between them.

Confederations

A fully meshed iBGP network becomes complex as the number of iBGP peers grows. You can reduce the iBGP mesh
by dividing the autonomous system into multiple subautonomous systems and grouping them into a single
confederation. A confederation is a group of iBGP peers that use the same autonomous system number to
communicate to external networks. Each subautonomous system is fully meshed within itself and has a few
connections to other subautonomous systems in the same confederation.
BGP Peer-Groups

Peer-groups simplify configuration of groups of neighbors, assuming those neighbors share identical settings.
Additionally, peer-groups conserve processor/memory resources by sending updates to all peer-group members
simultaneously, as opposed to sending individual updates to each neighbor.

BGP Attributes

BGP utilizes several attributes to determine the best path to a destination. Well-known attributes are supported by
all implementations of BGP, while optional attributes may not be supported by all BGP-speaking routers. Several
subcategories of attributes exist:

• Well-known Mandatory – Standard attributes supported by all BGP implementations, and always included in
every BGP update.

• Well-known Discretionary – Standard attributes supported by all BGP implementations, and are optionally
included BGP updates.

• Optional Transitive – Optional attribute that may not be supported by all implementations of BGP. Transitive
indicates that a noncompliant BGP router will forward the unsupported attribute unchanged, when sending
updates to peers.

• Optional Non-Transitive - Optional attribute that may not be supported by all implementations of BGP. Non-
Transitive indicates that a non-compliant BGP router will strip out the unsupported attribute, when sending
updates to peers.

Communities

BGP allows routes to be placed (or tagged) into certain Communities. BGP routers can make route policy decisions
based on a route’s community membership. BGP communities can be assigned using one of three 32-bit formats:

• Decimal (1000000)

• Hexadecimal (0x1A2B3C)

• AA:NN (100:20) The AA:NN format specifies a 16-bit AS number (the AA), and a 16-bit generic community
identifier (NN).

Additionally, there are four well-known communities that can be referenced by name:

• No-export – prevents the route from being advertised outside the local AS to eBGP peers.

• No-advertise – prevents the route from being advertised to either internal or external peers.

• Internet – allows the route to be advertised outside the local AS.

• Local-AS – prevents the route from being advertised outside the local AS to either eBGP or confederate peers.

Route dampening “suppresses” routes that are flapping, minimizing unnecessary convergence and updates. If a
route flaps (goes up and down), it is assigned a penalty (default is 1000). All routes start with a penalty of 0, and
the local router maintains a history of routes that have flapped. Once the penalty reaches a specific threshold, the
route is suppressed. When a route is suppressed, it is neither advertised nor used locally on the router.
Route dampening minimizes the impact of route flaps in downstream autonomous systems upon local and
upstream autonomous systems.

Route dampening affects only EBGP routes.

BACKDOOR

The term “backdoor” is a very controversial term when it comes to privacy and security. However, when it comes
to BGP, it is a well-known feature that is used to change the administrative distance of eBGP in order for an interior
gateway routing protocol (IGP) to take precedence over an eBGP route.

By default, external BGP (eBGP) has an administrative distance value of 20. Administrative distance is the first
criterion that a router uses to determine which routing protocol to use if two protocols provide route information
for the same destination. Administrative distance is a measure of the best path and reliability of the source of the
routing information. The smaller the administrative distance value, the more reliable the protocol/link.

Recursive route lookup

The router looks up the BGP route and the BGP next hop to reach a destination in the remote AS. Then the router
looks up the route to reach the BGP next hop using the IGP.

Soft Reset and Hard Reset

In case of hard reset the local router brings down the neighborship, brings down the underlying TCP connection
and all the BGP table entries learned from that neighbor are removed. #clear ip bgp *

In case of soft reset, the router does not bring down the BGP neighborship or the underlying TCP connection.
However, the local router resends outgoing Updates and reprocesses incoming Updates adjusting the BGP table
based on the current configuration. #clear ip bgp * soft command is used for soft reset.

If there are two service provider, how you will do the link load balancing in BGP?

In the multihomed environment load balancing is not an option because BGP select only one best path to
destination when the BGP routes are learned from different AS’s.To achieve this we need to setup a better metric
for the routers in the range 0.0.0.0 to 128.0.0.0 that are learned from ISP A and better metric for the rest of the
routes that are learned from ISP B so basically we will be doing the load sharing not the load balancing.

BGP Routing Table

There are three types of BGP Routing tables:

a) Adj-RIB-in

b) Adj-RIB-out

c) Loc-RIB

Adj-RIB-in stores the unprocessed information received from its peers. Here the best path selection occurs as per
BGP attributes and after conformation path is entered into the local bgp table i.e Loc-RIB. From the local RIB table
it conform the next-hop address if it reachable by IGP then the route is entered into the main routing table.

In BGP what is the use of cluster-id command?


The bgp cluster-id command is used to assign a cluster ID to a route reflector when the cluster has one or more
route reflectors. Multiple route reflectors are deployed in a cluster to increase redundancy and avoid a single point
of failure. When multiple route reflectors are configured in a cluster, the same cluster ID is assigned to all route
reflectors. This allows all route reflectors in the cluster to recognize updates from peers in the same cluster and
reduces the number of updates that need to be stored in BGP routing tables.

You might also like