0% found this document useful (0 votes)
85 views65 pages

Understanding Inter-Domain Routing with BGP

- BGP (Border Gateway Protocol) is used for inter-domain routing between autonomous systems on the internet. It allows different networks to share routing and reachability information. - BGP is considered an exterior gateway protocol (EGP) as it operates between autonomous systems, while interior gateway protocols (IGPs) like RIP and OSPF are used for intra-domain routing within individual autonomous systems. - As a path vector protocol, BGP advertises the full path or sequence of autonomous systems that a packet would traverse to reach a destination network. This path information helps prevent routing loops and allows each AS to apply their own policies to route selection and propagation of routing information.

Uploaded by

Qusay Ismail
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views65 pages

Understanding Inter-Domain Routing with BGP

- BGP (Border Gateway Protocol) is used for inter-domain routing between autonomous systems on the internet. It allows different networks to share routing and reachability information. - BGP is considered an exterior gateway protocol (EGP) as it operates between autonomous systems, while interior gateway protocols (IGPs) like RIP and OSPF are used for intra-domain routing within individual autonomous systems. - As a path vector protocol, BGP advertises the full path or sequence of autonomous systems that a packet would traverse to reach a destination network. This path information helps prevent routing loops and allows each AS to apply their own policies to route selection and propagation of routing information.

Uploaded by

Qusay Ismail
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Inter-domain routing

BGP4
Outline
• Internet Logical Module
• The need of Inter-domain Routing
• Difference between the Inter and Intra Routing
• Autonomous System Type
• Inter-domain routing with Border Gateway Protocol
(BGP)
• IBGP and EBGP
• BGP Operation
• How do BGP select Route?
• BGP Attributes
• BGP Basic Process
Internet Logical model

Backbone service provider

“ Consumer” ISP Large corporation “Consumer”ISP

Small
corporation “Consumer ” ISP “Consumer ” ISP

Small Small Small


corporation corporation corporation
Example
Bazeq Backbone Other ISPs
ISP

PALTEL Other
Consumer Backup ISP

HADARA
Local ISP

Home
Hierarchical Routing
scale: with 50 million destinations: administrative autonomy
• can’t store all dest’s in routing • internet = network of networks
tables! • each network admin may want to
• routing table exchange would control routing in its own
swamp links! network
• Routing tables actually stored
dest. Network prefixes!! (not
necessary dest addr.)
Hierarchical Routing
• aggregate routers into regions, gateway routers
“autonomous systems” (AS)
• special routers in AS
• routers in same AS run same
• run intra-AS routing
routing protocol
protocol with all other
– “intra-AS” routing protocol routers in AS
– routers in different AS can • also responsible for routing
run different intra-AS to destinations outside AS
routing protocol
– run inter-AS routing
protocol with other
gateway routers
Autonomous System (AS)

AS 100
Inter and Intra Domain Routing
Interior Gateway Protocol (IGP) “Intra-AS”: routing within AS
• RIP, OSPF
Exterior Gateway Protocol (EGP) “ inter-AS”: routing between AS’s
• BGPv4
Border Gateways perform both IGP & EGP routing

IGP
R EGP IGP
R R
R
R
R
AS A
AS C

R
R
IGP
AS B
EGP Requirements
• Scalability to global Internet
– Provide connectivity at global scale
– Link-state does not scale
– Should promote address aggregation
– Fully distributed
• EGP path selection guided by policy rather than
path optimality
– Trust, peering arrangements, etc
– EGP should allow flexibility in choice of paths
EGP Example
Only EGP routers
are shown N1 reachable
R2 R3
through AS3
AS2

R1 R4
N1
AS1 AS3

• R4 advertises that network N1 can be reached through AS3


• R3 examines announcement & applies policy to decide whether it
will forward packets to N1 through R4
• If yes, routing table updated in R3 to indicate R4 as next hop to
N1
• IGP propagates N1 reachability information through AS2
EGP Example

R2 R3
N1 reachable
through AS2 AS2

R1 R4
N1
AS1 AS3

• EGP routers within an AS, e.g., R3 and R2, are kept consistent
• Suppose AS2 willing to handle transit packets from AS1 to N1
• R2 advertises to AS1 the reachability of N1 through AS2
• R1 applies its policy to decide whether to accept N1 via AS2
Intra-AS (or Intra-Domain) and
Inter-AS (or Inter-Domain) routing
C.b Gateways:
B.a • perform inter-AS
A.a routing amongst
b c themselves
A.c
a C a • perform intra-AS
b
a B routers with
d other routers in
c their AS
A b

network layer
inter-AS, intra-AS link layer
routing in
gateway A.c physical layer
Intra-AS and Inter-AS routing
Inter-AS
routing
C.b
between B.a
A and B
A.a Host
b A.c c h2
a C a
b
a B
Host
d c Intra-AS routing
h1
A b within AS B
Intra-AS routing
within AS A

Two level routing:


Intra-AS: administrator is responsible for choice
Inter-AS: unique standard
Why different Intra- and Inter-AS routing ?

• Policy: Inter is concerned with policies (which


provider we must select/avoid, etc). Intra is
contained in a single organization, so, no policy
decisions necessary
• Performance: Intra is focused on performance
metrics; needs to keep costs low. In Inter it is difficult
to propagate performance metrics efficiently
(latency, privacy etc). Besides, policy related
information is more meaningful.
Autonomous Systems (AS)
• A collection of physical networks that share the same
policy and resources for external routing.
• Autonomous systems number (ASN)
– 16 bit number: 13+K already in use
– Used by BGP to identify “networks”
– ASN information is public
• Roughly speaking, AS=ISP=domain
– Some domains have multiple ASes
– Some networks do not have AS number
Autonomous Systems Types
• Stub AS: has only a single connection to the outside world
• Multi-homed AS: has multiple connections to the outside
world, but refuses to carry transit traffic
• Transit AS: has multiple connections to the outside world, and
can carry transit and local traffic
Stub and Transit Networks

AS 1 AS 2

• AS 1, AS 2, and AS 5 are stub


networks AS 3 AS 4
• AS 2 is a multi-homed stub
network
• AS 3 and AS 4 are transit
networks
AS 5

17
Border Gateway Protocol v4
• BGP (RFC 1771) is an EGP routing protocol to exchange
network reachability information among BGP routers
(also called BGP speakers)
• Network reachability info contains sequence of ASs that
packets traverse to reach a destination network
• Info exchanged between BGP speakers allows a router to
construct a graph of AS connectivity
– Routing loops can be pruned
– Routing policy at AS level can be applied
Inter-domain routing with BGP4
• To control traffic routing across ASes.
• BGP is a Path Vector protocol: and extension of Distance Vector
• BGP is path vector protocol: advertises a sequence of AS numbers to the
[Link]/16,
destination network AS-PATH {3,2,1}

AS 1 AS 2 AS 3 AS 5
[Link]/16

• Path vector info used to prevent routing loops


• BGP enforces policy through selection of different paths to a destination
and by control of redistribution of routing information
• Each Border Gateway broadcast to neighbors (peers) the entire path (ie,
sequence of ASs) to destinations, i.e. IP network Prefixes
• For example, Gateway X may store the following path to destination Z:
Path (X,Z) = X,Y1,Y2,Y3,…,Z
BGP (cont’d)
• Now, suppose Gwy X send its path to peer Gwy W
• Gwy W may or may not select the path offered by Gwy X,
because of cost, policy ($$$$) or loop prevention reasons.
• If Gwy W selects the path advertised by Gwy X, then:

Path (W,Z) = w, Path (X,Z)


• By looking at the content of the Path Vector, potential AS
routing loops can be detected (and thus discarded).
Note: path selection based not so much on cost (eg,# of
AS hops), but mostly policy issues
Simple view of BGP
• To contrast with distance vector routing where neighbors exchange:
<dest network prefix,cost>
• In BGP, neighbors exchange: <dest network prefix, a-
list-of-attributes >
where the AS-Path-vector is one of the BGP attributes, amongst
many others
• How are these attributes used?
– Support routing policy established as part of peering agreement
– Help find routes that minimize cost
– Optimizing performance is only another goal (not the only goal
as in Intra-domain routing)
– BGP is known as a “policy-based” routing protocol
Distribution of routing
information
Based on TCP
Path vector based protocol
- BGP router advertises its best route to each neighbor
- Advertisements are only sent when their routes change
Contrast with other routing protocols:
– RIP's distribution is based on UDP datagrams, so
periodically you need to exchange information (a form of
"soft state")
– BGP's distribution is based on a TCP connection - no need
to refresh.  But a consequence is that if the connection is
broken, you have to assume everything is lost. more
vulnerable to malicious (or natural) failures of connections
– OSPF uses its own transport to do in-sequence and
intelligent flooding (which neither UDP or TCP supports).
BGP Speaker & AS Relationship
• BGP speaker: a router running BGP
• Peers or neighbors: two speakers exchanging information on a
connection
• BGP peers use TCP (port 179) to exchange messages
• Initially, BGP peers exchange entire BGP routing table
– Incremental updates sent subsequently
– Reduces bandwidth usage and processing overhead
– Keepalive messages sent periodically (30 seconds)
• Internal BGP (iBGP) between BGP routers in same AS
• External BGP (eBGP) connections across AS borders
iBGP & eBGP
R eBGP iBGP eBGP R
R R
iBGP
iBGP iBGP iBGP

R R R
iBGP eBGP
R eBGP

 eBGP to exchange reachability information in different AS’s


- eBGP peers directly connected
 iBGP to ensure net reachability info is consistent among the
BGP speakers in the same AS
BGP Peers – External (eBGP)

A C

AS 100 AS 101
[Link]/24 [Link]/24
B D

BGP speakers
are called peers
E
Peers in different AS’s
are called External Peers AS 102
[Link]/24
eBGP TCP/IP
Peer Connection
Note: eBGP Peers normally should be directly connected.
BGP Peers – Internal (iBGP)

A C

AS 100 AS 101
[Link]/24 [Link]/24
B D

BGP speakers
are called peers
E
Peers in the same AS
are called Internal Peers AS 102
[Link]/24
iBGP TCP/IP
Peer Connection
Note: iBGP Peers don’t have to be directly connected.
Why do we use iBGP?

• Why not use IGP protocol to exchange external


routes?
– Too many external routes
– If all IGP routers receive all these routes, it generates too
much control traffic
– Too much burden on all IGP routers

• BGP routers in same domain need to exchange


the routes learned from the BGP routers of
neighbor domains
– All the BGP routers of an AS help distribute routes to
different neighbor ASes
– They need a consistent view of all external routes
BGP Operations (Simplified)
Establish session on
TCP port 179 AS1

BGP session
Exchange all
active routes

AS2

While connection
Exchange incremental is ALIVE exchange
updates route UPDATE messages
28
BGP Messages
• OPEN:
– opens TCP conn. to peer
– authenticates sender
• UPDATE:
– “Announcement”: prefix is reachable
• KEEPALIVE:
– keeps connection alive in absence of UPDATES
– serves as ACK to an OPEN request
• NOTIFICATION:
– reports errors in previous msg;
– closes a connection
Protocol Description: Open Messages

• The first message sent after TCP established


• Each peer identify itself to each other
• Negotiate protocol version/parameters
• Security (optional)
Protocol Description: Keep-alive
Message
• Confirm the connection is still active

• rate depends on the hold timer negotiated by open message


and update message frequency

.
Update Message

• Primary message used in a BGP


• Advertises (announces) a prefix to BGP neighbors/withdraw a
previously advertised message
• Encourage multiple prefixes in a single Update
Attributes in UPDATE messages
Some Fields in BGP Update Message
– IP prefixes : List of reachable IP prefixes (NLRI)
– ORIGIN: how the route was learned (IGP, EGP,
Incomplete)
– NEXT-HOP: the IP address of the router that advertised
the route
– AS-PATH: the list of AS through which the announcement
passed (analogous to “hop count” in RIP)
– LOCAL-PREF: used by an AS to rank/prioritize outgoing
paths based on peering relationships
– MED (Multi-Exit-Discriminator): used by an AS to steer
traffic from neighboring AS to enter via different Border
Gateway
The above attributes are commonly used for performing
“Traffic Engineering” (TE) across neighboring ASes (to be
discuss later)
BGP Peers

A C

AS 100 AS 101
[Link]/24 [Link]/24
B D

BGP Peers exchange


Update messages containing E
Network Layer Reachability
Information (NLRI) AS 102
[Link]/24
BGP Update
Messages
BGP Updates — NLRI
• Network Layer Reachability
Information
• Used to advertise feasible routes
• Composed of:
– Network Prefix
– Mask Length
Attributes are Used to Select Best Routes

[Link]/24
pick me!

[Link]/24 [Link]/24
pick me! pick me!

Given multiple
routes to the same
[Link]/24
pick me!
prefix, a BGP speaker
must pick at most
one best route

(Note: it could reject


them all!)
Protocol Description: Notification
Message
• Used when error(s) happen(s)
• TCP will be closed immediately after
notification is sent
• Indicates to remote system why BGP was
terminated
How do BGP Select Route
AS 2 AS 2

EGP (e.g., BGP)


IGP (e.g., OSPF)
IGP (e.g., RIP)

• Traditional routing (OSPF, RIP,..etc)


– Routing is done based on metrics
– Routing domain is one autonomous system
• BGP routing
– Routing is done based on policies (attributes)
– Routing domain is the entire Internet
38
Path Selection
• Each BGP speaker
– Evaluates paths to a destination from an AS border
router
– Selects the best that complies with policies
– Advertises that route to all BGP neighbors
• BGP assigns a preference order to each path & selects
path with highest value; BGP does not keep a cost metric
to any path
• When multiple paths to a destination exist, BGP
maintains all of the paths, but only advertises the one
with highest preference value
Route Advertisement

• BGP router uses NLRI, Total Path Attributes Length,


and Path Attributes, to advertise a route
• NLRI contains list of IP address prefixes that can be
reached by the route
• Path Attributes describe characteristics of the route
and is used to affect routing behavior
BGP Policies
• Implements policies
to enable politics and traffic engineering

• Decision process (in each router):

updates => in-policy out-policy (modified)


filter best path
filter
=>
updates
selection
updates => in-policy
filter
BGP Policy
• Examples of policy:
– Never use AS X
– Never use AS X to get to a destination in AS Y
– Never use AS X and AS Y in the same path
• Import policies to accept, deny, or set
preferences on route advertisements from
neighbors
• Export policies to determine which routes
should be advertised to which neighbors
– A route is advertised only if AS is willing to carry
traffic on that route
Terminology: “Policy”
• Where do you want your traffic to go?
– It is difficult to get what you want, but you can try
• Control of how you accept and send routing
updates to neighbors
– prefer cheaper connections, load-sharing, etc.
• Accepting routes from some ISPs and not others
• Sending some routes to some ISPs and not
others
• Preferring routes from some ISPs over others
“Policy” Implementation
• You want to use a local line to talk to
the customers of other local ISPs
– local peering
• You do not want other local ISPs to
use your expensive international lines
• So you need some sort of control over
routing policies
• BGP can do this
Routing Policy
• Why?
– To steer traffic through preferred paths
– Inbound/Outbound prefix filtering
– To enforce Customer-ISP agreements
• How?
– AS based route filtering – filter list
– Prefix based route filtering – prefix list
– BGP attribute modification – route maps
– Complex route filtering – route maps
BGP Attributes
• Used to convey information
associated with NLRI
– Local preference
– AS path
– Weight
– Origin
Local Preference
• Not used by eBGP, mandatory for
iBGP
• Default value of 100 on Cisco IOS
• Local to an AS
• Used to prefer one exit over another
• Path with highest local preference
wins
Local Preference

AS 100
[Link]/16

AS 200 AS 300

D 500 800 E

A B

[Link]/16 500
AS 400
> [Link]/16 800
C
Origin
• Conveys the origin of the prefix
– Historical attribute
• Three values:
– IGP – from BGP network statement
• E.g. – network [Link]
– EGP – redistributed from EGP (not used today)
– Incomplete – redistributed from another
routing protocol
• E.g. – redistribute static
• IGP < EGP < incomplete
– Lowest origin code wins
ORIGIN attribute
• Originating domain sends a route with ORIGIN attribute
• ORIGIN attributes also specifies if the origin is internal to the AS or not

AS 2 AS 4
[Link]/8,
[Link]/8, ORIGIN {1}
ORIGIN {1}
[Link]/8,
ORIGIN {1}

AS 1 AS 5

[Link]/8,
ORIGIN {1} AS 3 [Link]/8,
ORIGIN {1} 50
Weight
• Not really an attribute
• Used when there is more than one route to same
destination
• Local to the router on which it is assigned, and
not propagated in routing updates
• Default is 32768 for paths that the router
originates and zero for other paths
• Routes with a higher weight are preferred when
there are multiple routes to the same destination
AS-Path Attribute
• Sequence of ASes a
route has traversed AS 200 AS 100
• Loop detection [Link]/16 [Link]/16

• Apply policy Network


[Link]/16
Path
300 200 100
[Link]/16 300 200

AS 300
AS 400
[Link]/16

Network Path
[Link]/16 300 200 100
AS 500 [Link]/16 300 200
[Link]/16 300 400
AS-Path (with 16 and 32-bit ASNs)

• Internet with 16-


bit and 32-bit AS 70000 AS 80000
ASNs
[Link]/16 [Link]/16

• AS-PATH length [Link]/16


[Link]/16
300 23456 23456
300 23456

maintained AS 300
AS 400
[Link]/16

[Link]/16 300 70000 80000


AS 90000 [Link]/16 300 70000
[Link]/16 300 400
AS-PATH attributes
• Each AS that propagates a route prepends its own AS number
– AS-PATH collects a path to reach the network prefix
• Path information prevents routing loops from occurring
• Path information also provides information on the length of a path (By default,
a shorter route is preferred)
• Note: BGP aggregates routes according to CIDR rules

[Link]/8,
[Link]/8, AS 2 AS 4 AS-PATH {4,2,1}
AS-PATH {1}
[Link]/8,
AS-PATH {2,1}

AS 1 AS 5

[Link]/8,
AS-PATH {1} AS 3 [Link]/8,
AS-PATH {3,1} 54
Shorter Doesn’t Always Mean
Shorter
Mr. BGP says that In fairness:
path 4 1 is better could you do
than path 3 2 1 this “right” and
Duh! still scale?

AS 4 Exporting
internal
AS 3
state would
dramatically
AS 2 increase global
instability and
amount of
routing
state
AS 1
BGP Basics Process …
• Each AS originates a set of NLRI (routing
announcements)
• NLRI is exchanged between BGP peers
• Can have multiple paths for a given prefix
• BGP picks the best path and installs in the IP
forwarding table
• Policies applied (through attributes) influences
BGP path selection
BGP Routing Information
Base
BGP RIB
Network Next-Hop Path
*>i160.10.1.0/24 [Link] i
*>i160.10.3.0/24 [Link] i

router bgp 100


network [Link] [Link]
D [Link]/24
network [Link] [Link]
D [Link]/24 no auto-summary
D [Link]/24
R [Link]/16
S [Link]/24
BGP ‘network’ commands are normally used
to populate the BGP RIB with routes from the
Route Table Route Table
BGP Routing Information
Base
IN Process OUT Process
BGP RIB
Network Next-Hop Path
*>i160.10.1.0/24 [Link] i
*>i160.10.3.0/24 [Link] i
* > [Link]/16 [Link] 100 i
Update Update

Network Next-Hop Path


[Link]/16 [Link] 100

• BGP “in” process


• receives path information from peers
• results of BGP path selection placed in the BGP table
• “best path” flagged (denoted by “>”)
BGP Routing Tables

Status codes: s suppressed, d damped, h history, * valid, > best, i -


internal, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight Path


* [Link] [Link] 0 7018 80 i
* [Link] 0 7018 80 i
* [Link] 0 7018 80 i
* [Link] 0 7018 80 i
*> [Link] 0 7018 80 i
* [Link] 0 7018 80 i
* [Link] [Link] 0 7018 1 i
* [Link] 0 7018 1 i
* [Link] 0 7018 1 i
*> [Link] 0 7018 1 i
* [Link] 0 7018 1 i
BGP Routing Information
Base
IN Process OUT Process
BGP RIB
Network Next-Hop Path
*>i160.10.1.0/24 [Link] i
*>i160.10.3.0/24 [Link] i
*> [Link]/16 [Link] 100
Update Update

Network Next-Hop Path


[Link]/24 [Link] 200
[Link]/24 [Link] 200
[Link]/16 [Link] 200 100
• BGP “out” process
• builds update using info from RIB
• may modify update based on config
• Sends update to peers
BGP Routing Information
Base
BGP RIB
Network Next-Hop Path
*>i160.10.1.0/24 [Link] i
*>i160.10.3.0/24 [Link] i
*> [Link]/16 [Link] 100

D [Link]/24
D [Link]/24 • Best paths installed in routing table if:
D [Link]/24
R [Link]/16
• prefix and prefix length are unique
S [Link]/24 • lowest “protocol distance”
B [Link]/16

Route Table
Import Routes
provider route peer route customer route ISP route

From From
provider provider

From From
peer peer

From From
customer customer
Export Routes
provider route peer route customer route ISP route

To From
provider provider

To To
peer peer

To To
customer customer
filters
block
Importing and Exporting Routes
• An AS may not accept all routes that
are advertised
• An AS may not advertise certain Control
Inbound Change
routes traffic export rules
• Route policies determines which
routes are filtered

• If an AS wants to have less inbound AS A


traffic it should adapt its export rules
• If an AS wants to control its inbound
traffic, it adapts its import rules
Control
Change
Outbound
import rules
traffic

64
BGP route selection
(bestpath)
• Largest weight
• Largest local preference
• Shortest AS path length
– Number of ASes in the AS-PATH attribute
• Lowest origin
– IGP < EGP
• Lowest router ID

You might also like