Border Gateway Protocol (BGP)
Border Gateway Protocol (BGP)
BGP is an inter-AS routing protocol, its primary function is to exchange network reachability information with other BGP systems.
BGP routing information carries a sequence of AS numbers identifying the Path (Path Vector). This information is used to prevent loops.
TCP is used as transport protocol, therefore assumes reliable delivery and IP connectivity.
Updates are incremental => improvement in CPU overhead and bandwidth.
BGP Messages:
To initiate connection and exchange
OPEN
capabilities.
_One AS path.
_A set of path of attributes.
UPDATE _A set of prefixes sharing the AS path
and path attributes,
_A set of withdrawn routes.
NOTIFICATION Used to signal errors.
KEEPALIVE Used to check liveness of peer.
OPEN message
Fields Info Size in Bytes
Version Current version is 4 1
My AS ASN of BGP speakers 2
Hold Time Maximum interval between KEEPALIVE and UPDATE 2
BGP ID Sanders’s BGP ID 4
Optional Parameter Length Length 1
Optional Parameter Use in BGP session Negotiation 7
Comments: All bytes in Marker will be set to 1.
UPDATE message
Fields Info Size in Bytes
WR length Length 2
Withdrawn Routes List of prefixes that are being withdrawn. Each prefix is Variable
Withdrawn Routes
composed of <length, prefix> <1,IP address>
Path Attributes PA length Length 2
Sequence of Path attributes present in every UPDATE message Variable
Path Attributes
except messages carrying only withdrawn routes. <type,length,value>
Att type Flags + Attribute type code
Att length Length
Att Value Value of attribute according to flags and code
Network Layer Reachability Information NLRI is the list of prefixes that are being advertized variable
NOTIFICATION message
Fields Info Size in Bytes
Error Code Identification of type of Notification 1
Error Subcode More specific info about error 1
Data Relevant data about the error (i.e. Bad header, illegal ASN) variable
KEEPALIVE message
19 bytes length. Sent at a specified interval (the default is 60 seconds). If a BGP peer misses three keepalives (180 seconds) all routes from
that peer are suppressed.
IBGP: Neighbor connection between two routers within the same AS.
EBGP: Neighbor connection between two routers in different AS.
TCP
CONNECTION
Physical vs Logical Connections.
BGP does not advertize routes learned from an IBGP peer to another BGP
IBGP peer.
It is important to maintain full mesh (IBGP mesh) with an AS
If that is not possible, then route reflectors and confederations have
SESSION
to be used.
Synchronization within an AS
In the example traffic is dropped because BGP and IGP are not
synchronized, to avoid the problem of injecting the AS info into the AS
in order to synchronize and send the routes to EBGP.
Backdoor links offer an alternative IGP path that can be used instead of the Protocol Distance
external BGP path. Directly Connected 0
Static 1
IGP routes that can be reached over the backdoor link are backdoor routes. EBGP 20
The administrative distance is used to decide the preference of each protocol, it OSPF 110
is only relative to locally configured router and it is not communicated.
RIP 120
EGP 140
IBGP 200
Unknown 255
Prefix characteristics:
Well known mandatory Must be recognized Included in every UPDATE
Well known discretionary Must be recognized May or may not in UPDATE
Optional transitive Not required Should be passed along if BGP speaker does not support it.
Optional No transitive Not required Quietly ignore and don´t pass along if unrecognized.
ORIGIN
Type Description Types Info
Well IGP (0) NLRI internal to originating AS (via network command)
Defines the origin of the BGP prefers the lowest
known EGP (1) NLRI learned via EGP (via EGP)
path information ORIGIN value.
mandatory Incomplete (2) NLRI learned by other means (via redistribute)
AS_PATH
Type Description Info
Well known mandatory Contains a sequence of AS_PATH segment. BGP prefers the shortest AS_PATH value.
Act of adding the ASN to the beginning of the list when sending routes to external BGP peers (not to internal peers).
Prepending
Serves for Loop detection.
NEXT_HOP
Type Description Forms
EBGP sessions IP address of the neighbor that announced the route
Defined IP address of the
Locally originated routes: IP address of the peer that announced the route
Well router that should be used
IBGP sessions Routes learned from external: IP address of the external peer from which the route
known as the next hop to the
was learned.
mandatory destination listed in the
NLRI. Route on multi- IP address of the interface of the router connected to the medium that originated
access medium. the route.
MED
Type Description Info
Optional nontransitive Used on external links to discriminate among multiple links to the same neighboring AS. BGP prefers the lowest MED.
MED received from external peers must not be propagated to other neighboring ASes
The MED attribute received in an AS does not leave the AS, when BGP parses the update to another AS, the MED is reset to 0 (unless explicitly
changed to other value)
LOCAL-PREF
Type Description Info
Well known Used as local policy to set degree of preference of routes when announcing to other BGP prefers the higher LOCAL-
discretionary internal peers. PREF.
It is used locally within the AS, manipulations will affect only the outbound traffic.
COMMUNITY
Type Description Forms
Other Extensions
Name Description
Multiprotocol extension for BGP-4 Enables support routing of other network layer protocols
Route Refresh Capability To dynamically request for readvertisement of routes from peers
TCP MD5 Signature Option Provides a mechanism for TCP to carry a digest message in each TCP segment.
1. If next hop accessible, ignore route. 4. Prefer shortest AS_PATH. 7. Prefer EBGP to IBGP.
2. Prefer route with highest weight (Cisco) 5. Prefer lowest ORIGIN type (IGP, EGP, incomplete) 8. Shortest internal path BGP next-hop
3. Prefer largest LOCAL_PREF value. 6. Prefer lowest MED value (if from same AS) 9. Prefer route from first BGP router ID
Demilitarized Zone
It defines a shared network between ASes. IGP must be able to reach the next-hop address received in the update message. Two
possibilities: 1.Advertise the DMZ subnet inside the AS (to IGP) 2. Override the next-hop address using next-hop-self
When there is a need to have a public ASN, in order to conserve AS_PATH is often manipulated to affect interdomain routing behavior.
the ASN pool, there is a ASN range (64512 to 65535) for internal Because BGP prefers a shorter AS_PATH, network administrators are
use. It happens when customers are single-homed or multi-homed often tempted to change the path information by including dummy
to 1 provider. The private ASN is not announced to the internet. AS_PATH entries to influence traffic, this is called prepending.
Redundancy is achieved by providing alternative paths for the traffic, usually by having multiple connections to one or more ASes.
Symmetry means having traffic that leaves the AS from a certainpoint and returns through the same point.
Load Balancing is the capability to divide traffic optimally over multiple links.
Redundancy Multiple paths for the traffic (primary and backup link) Symmetry
Default Routes Dynamically learned defaults Statically set defaults Problematic to achieve when having
It is a route in the IP The default route (0/0) can be Many operators choose redundancy, in practice it is not a
forwarding table that is used exchanged as a dynamic advertisement to filter dynamically problem to have asymmetric traffic.
if a routing entry for a between routers. Any system learned defaults. The
destination does not exist. advertising this route represents itself manually set default can
Represented by 0/0 or as 0/0 to other routes. Can be learned point to the next-hop, a
0.0.0.0/0.0.0.0 or “gateway via BGP (local pref can be set for the router int, a network
of last resort” default) or IGP. number.
Load Balancing
It is the capability to divide the data over multiple links. It does Applying Attributes to outbound routing announcements will affect incoming traffic
not mean equal distribution of the load. Traffic should be Outbound decision - Where do I send my traffic?
thought as two separate entities, inbound and out bound. Applying Attributes to inbound routing announcements will affect outgoing traffic
Done on a per-destination basis. Inbound decision – I want traffic for netC through A and traffic for netD through B
Route Reflector
Why? Description Problems Advantages Propagation
Simplification, since it Route received from non-client
There is an
just copies the UPDATE peer, reflects to clients only.
Full mesh is costly, Route A Route Reflector reflects routes overhead on the
message. Route received from client or EBGP
Reflectors are between clients (not RR) and RR machine.
RR client peers with the peer, reflects to clients and non-
concentration points. other IBGP and EBGP peers. It might
RR server, which implies clients.
introduce Loops.
less IBGP sessions.
Confederations
Why? Description Confederation vs Route Reflector
Full mesh is costly. When an AS Consists on dividing an AS into sub-ASes, each with its
Route Reflector is the recommended solution.
gets too big is hard to manage own ASN and EBGP between them.
IGP Expansion
Why? Regions separated via IBGP Regions separated via EBGP
ASN hidden to the outside.
IGP is hard to manage in large networks, Regions run IGP, IGP routes are injected into
Central backbone AS with legal ASN.
segmentation helps by running IGP in each region, and IBGP regional routers.
Path stripping to avoid leaking ASN to
the regions are connected via BGP. Internet connection is part of central IBGP.
external peers.
Route Dampening
Instability syndrome Benefits Inside AS Benefits Outside AS
To control instability classifies routes as behaved and ill-behaved. Unstable
routes are not advertised. Flapping causes a penalty, if above threshold then IBGP routing can be Prevents unstable EBGP routes
route is suppressed (and not injected on IGP). Two limits; reuse limit and destroyed by route flapping. from being propagated.
suppress limit.
Marker
Common
Length
HEADER
Version
KEEP Type
ALIVE
Error
My AS Code
Sender’s Diagnostic
BGP ID Data
Code
UPDATE
Optional
Capabilitis
Value
Unfeasibl Path
NLRI
Routes Atributes
AS_4PATH
ATOMIC
LOCAL_PREF AGGREGATR AS_SET AS_TRANS
AGGREGATE
AS4_AGGR
LOCAL Outbound
Traffic
Prefer highest
COMMUNITY EXTENSIONS
Negotiated via
BGP Capabilities
Multiprotocol for when peering is
BGP-4 set up
NO_EXPORT NO_ADVERTIZE
Route Refresh
Cap
BGP TRUE facts
1. The three basic blocks of a BGP UPDATE message are Unreachable route, path attribute and NLRI.
2. MULTI_EXIT_DISC enters in the category of optional non-transitive attribute.
3. To establish a session with a provider without having an ASN, we can agree on a private ASN with the ISP.
4. To prevent network from becoming a transit AS when dual-homing, we should only advertise our locally originated prefixes to external peers.
5. Multiprotocol extensions in BGP-4 are used to carry routing information from multiple network layer protocols.
6. Three types of BGP filtering based on the info they filter: route f, path f and BGP community f.
7. Route dampening is a mechanism for controlling route instability by penalizing or suppressing ill behaved routes.
8. Full mesh of IBGP is needed because IBGP does not advertise routes learned from a IBGP peer to another.
9. By using NO-EXPORT attribute (in community), routes are not advertised further from our neighboring AS.
10. EBGP speakers prevent loops by using the list of ASes in the AS_PATH attribute of the UPDATE m, the receiver checks if its own ASN is on list.
11. Three well known mandatory BGP attributes are NEXT_HOP, ORIGIN, AS_PATH.
12. If no route in the IP routing table for NEXT_HOP address, the prefix will be added toBGPtable but won't be considered in the decision process.
13. A ROUTE_REFRESH message is used to request a peer to re-advertise its Adj-RIB-out.
14. The expression ^234$ will match all routes originated and received directly from 234.
15. BGP peer group can be used to improve BGP performance when some BGP neighbors share same UPDATES.
16. BGP assumes that there will be just one IP hop between two EBGP peers.
17. Symmetrical traffic means that traffic leaves and returns from the same given point.
18. BGP OPEN message is used to negotiate and select the hold time.
19. BGP prevents loops inside the AS by not advertising routes learned from IBGP to other IBGP peers.
20. In the wait state BGP waits for the TCP connection to be established.
21. If a BGP speaker receives a route with unsupported BGP community it will pass it along with attribute flag bit set to 1.
22. The expression 100$ will match all routes originated from AS 100.
23. Hot-potato routing is when you try to route the traffic out of your network (AS) as quickly as possible.
24. If all routers on an AS do not support flat dampening, route aggregation or static injection can be used to minimize route instability.