18
BGP overview BGP operations BGP messages BGP decision algorithm BGP states

BGP overview BGP operations BGP messages BGP decision algorithm BGP states

Embed Size (px)

Citation preview

Page 1: BGP overview BGP operations BGP messages BGP decision algorithm BGP states

•BGP overview

•BGP operations

•BGP messages

•BGP decision algorithm

•BGP states

Page 2: BGP overview BGP operations BGP messages BGP decision algorithm BGP states

Internet Routing Protocols

• Routing protocols in Internet are arranged in a hierarchy that involves two types of protocols:

IGP - Interior Gateway protocol• For routers to communicate within an AS (autonomous system)• Relies on IP addresses to construct paths• Routing Information Protocol (RIP)• Open Shortest Path First (OSPF)

EGP- Exterior Gateway protocol• For router to communicate among different Ass• Relies on AS numbers to construct AS paths• Border Gateway Protocol (BGP)

Page 3: BGP overview BGP operations BGP messages BGP decision algorithm BGP states

BGP overview

• Currently in version 4.• InterAS (or Interdomain) routing protocol for

exchanging network reachability information among BGP routers.

• Uses TCP on port 179 to send routing messages.• BGP is a distance vector protocol, but unlike in RIP,

routing messages in BGP contain complete routes.• Network administrators can specify routing policies.

Page 4: BGP overview BGP operations BGP messages BGP decision algorithm BGP states

BGP overview (cont.)

Page 5: BGP overview BGP operations BGP messages BGP decision algorithm BGP states

Relationship with IGP

• BGP carries full Internet routing table

• IGP’s are used to carry next hop and interior network information.

• Routes are never redistributed from BGP into IGP, and vice versa.

• Recursive route lookup

Page 6: BGP overview BGP operations BGP messages BGP decision algorithm BGP states

BGP operations

• Two BGP routers exchanging information on a connection are called peers.

– Initially, BGP peers exchange the entire BGP routing table.

– A BGP router retains the current version of the entire BGP routing tables of all of its peers for the duration of the connection.

– Subsequently, only incremental updates are sent as the routing tables change.

– Keepalive messages are sent periodically to ensure that the connection between the BGP peers is alive.

– Notification messages are sent in response to errors or special conditions.

Page 7: BGP overview BGP operations BGP messages BGP decision algorithm BGP states

BGP operations (cont.)

• A route is defined as a unit of information that pairs a destination with the attributes of a path to that destination.

• Routes are stored in the Routing Information Bases (RIBs).

• A RIB within a BGP router consists of three distinct parts:– Adj-RIBs-In: contains unprocessed routing information that has

been advertised to the local BGP router by its peers;

– Loc-RIB: contains the routes that have been selected by the local BGP router's Decision Process;

– Adj-RIBs-Out: organizes the routes for advertisement to specific peers by means of the local speaker‘s UPDATE messages.

Page 8: BGP overview BGP operations BGP messages BGP decision algorithm BGP states

eBGP and iBGP

• BGP can also be used within an AS. BGP connections inside an AS are called internal BGP (iBGP), and BGP connections between different Ass are called external BGP (eBGP).

• The purpose of iBGP is to ensure that network reachability information is consistent among multiple BGP routers in the same AS.

R2 R3iBGP

AS2

R1

AS1

R4

AS4

eBGP eBGP

Page 9: BGP overview BGP operations BGP messages BGP decision algorithm BGP states

• BGP header format

– Marker: authenticates incoming BGP messages or detects loss of synchronization between a pair of BGP peers.

– Length: indicates the total length of the message in octets, including the BGP header.

– Type: indicates the type of the message.

BGP messages

Marker

Length Type

0 16 24 31

Page 10: BGP overview BGP operations BGP messages BGP decision algorithm BGP states

OPEN message

Marker

Length Type=OPEN Version

My autonomous system Hold time

BGP identifier

Optional parameter length

Optional parameters

0 8 16 24 31

• Version: the protocol version number of the message.

• My autonomous system: The AS number of the sending router.

• Hold time: the number of seconds between the transmission of successive KEEPALIVE messages.

• BPG identifier: the sending BGP router.

• Optional parameter: a list of optional parameters, encoded in TLV structure.

Page 11: BGP overview BGP operations BGP messages BGP decision algorithm BGP states

KEEPALIVE message

• If the hold time is zero, then KEEPALIVE messages will not be sent.

Marker

Length Type=KEEPALIVE

0 8 16 24 31

Page 12: BGP overview BGP operations BGP messages BGP decision algorithm BGP states

NOTIFICATION message

• Error code: the type of error condition.• Error subcode: specific information about the nature

of the error.• Data: the reason for the notification.

Marker

Length Type=NOTIFICATION Error code

DataError subcode

0 8 16 24 31

Page 13: BGP overview BGP operations BGP messages BGP decision algorithm BGP states

UPDATE message

• Unfeasible routes length: the total length of the withdrawn routes field in octets.• Withdrawn routes: a list of IP address prefixes for the routes that need to be

withdrawn from BGP routing tables.• Total path attribute length: the total length of the Path Attributes field in octets.• Path attributes: a variable length sequence of path attributes. • NLRI: a list of IP prefixes.

Unfeasible routes length (2 octets)

Withdrawn routes (variable)

Total path attribute length (2 octets)

Path attributes (variable)

Network layer reachability information (variable)

Length (1 octet) Prefix (variable)

Length (1 octet) Prefix (variable)

……

Attribute type Attribute length Attribute value

Attribute type Attribute length Attribute value

……

BGP header

Length (1 octet) Prefix (variable)

Length (1 octet) Prefix (variable)

……

Page 14: BGP overview BGP operations BGP messages BGP decision algorithm BGP states

Update message (cont.)

• Attribute flag (1 octet):– O bit: attribute is optional (O=1), or required (O=0).

– T bit: an optional attribute is transitive (T=1), or non-transitive (T=1).

– P bit: the information in the optional transitive attribute is partial (P=1), or complete (P=0).

– E bit: the attribute length is two octets (E=1), or one octet (E=0).

Attribute type Attribute length Attribute value

OT P E 0 Attribute type code

Page 15: BGP overview BGP operations BGP messages BGP decision algorithm BGP states

Update message (cont.)

• Attribute type code:– ORIGIN (type code 1): defines the origin of the NLRI.– AS_PATH (type code 2): lists the sequence of Ass that the route have traversed

to reach the destination.– NEXT_HOP (type code 3): defines the IP address of the border router that

should be used as the next hop to the destination listed in the NLRI.– MULTI_NEXT_DISC (type code 4): discriminates among multiple entry/exit

points to a neighboring AS and gives a hint to the neighboring AS about the preferred path.

– LOCAL_PREF( type code 5): informs other BGP routers within the same AS of its degree of preference for an advertised route.

– ATOMIC_AGGREGATE (type code 6): informs other BGP routers that it selected a less specific route without selecting a more specific one that is included in it.

– AGGREGATOR (type code 7): specifies the last AS number that formed the aggregate route followed by the IP address of the BGP router that formed the aggregate route.

Page 16: BGP overview BGP operations BGP messages BGP decision algorithm BGP states

The BGP decision algorithm

• After BGP router receives updates about different destinations from peers, the protocol will have to decide which paths to choose in order to reach a specific destination.

• BGP will choose only a single path to reach a specific destination.

• The decision process is based on different attributes, such as next hop, local preference, the route origin, and so on.

• BGP will always propagate the best path to its neighbors.

Page 17: BGP overview BGP operations BGP messages BGP decision algorithm BGP states

How BGP selects a Path

1. If NextHop is inaccessible do not consider it.2. Prefer the largest Weight.3. If same weight prefer largest Local Preference. 4. If same Local Preference prefer the route that the specified router

has originated.5. If no route was originated prefer the shorter AS path.6. If all paths are external prefer the lowest origin code

(IGP<EGP<INCOMPLETE).7. If origin codes are the same prefer the path with the lowest MED.8. If path is the same length prefer the External path over Internal.9. If IGP synchronization is disabled and only internal path remain

prefer the path through the closest IGP neighbor.10.Prefer the route with the lowest ip address value for BGP router ID.

Page 18: BGP overview BGP operations BGP messages BGP decision algorithm BGP states

BGP finite state machine

• Idle state: In this state BGP refuses all incoming BGP connections. No resources are allocated to the peer.

• Connect state: In this state BGP is waiting for the transport protocol connection to be completed.

• Active state: In this state BGP is trying to acquire a peer by initiating a transport protocol connection.

• OpenSent state: In this state BGP waits for an OPEN message from its peer.

• OpenConfirm state: In this state BGP waits for a KEEPALIVE or NOTIFICATION message.

• Established state: In the Established state BGP can exchange UPDATE, NOTIFICATION, and KEEPALIVE messages with its peer.