Introduction to BGP

advertisement
Introduction to Inter-Domain
Routing
Refs:
(a) Courtesy of Teng Fei/Prof. Lixin Gao, ECE Umass
(b)http://www.research.att.com/~griffin/sigcomm2001_bgp_tutorial/abs
tract.html
The Internet Looks Like?
Subnetting
CLASS “B”
e.g. Company
e.g. Site
2
10
2
10
Net ID
0000
Subnet ID (20)
e.g. Dept
2
10
Subnet ID (22)
2
Host-ID
10
16
000000
2
Host-ID
Subnet
Host ID (10)
16
14
Net ID
1111
Subnet ID (20)
Subnet
Host ID (12)
14
Net ID
Host-ID
Net ID
16
14
16
14
10
Subnet
Host ID (12)
16
14
Net ID
Subnet ID (26)
Host-ID
1111011011
Host-ID
Subnet
Host ID (6)
Classless Interdomain Routing (CIDR) Addressing




The IP address space is broken into line segments.
Each line segment is described by a prefix.
A prefix is of the form x/y where x indicates the prefix of all addresses
in the line segment, and y indicates the length of the segment.
e.g. The prefix 128.9/16 represents the line segment containing
addresses in the range: 128.9.0.0 … 128.9.255.255.
128.9.0.0
65/8
0
128.9.16.14
142.12/19
128.9/16
216
232-1
Hierarchical Routing

Why?



Scalability
Administrative Autonomy
Solution

Autonomous Systems (ASs)

identified by unique AS numbers
BGP-Border Gateway Protocol




Inter-domain routing (EGP)
Distance Vector (Path Vector)
Build on the top of TCP (port 179)
Policy based
Defined in RFC 1771
How Does BGP Work?

Between Two BGP Routers


form one TCP connection


BGP peers/neighbors
BGP session
BGP Routing information are exchanged

prefix/AS path/etc.
eBGP and iBGP

eBGP


BGP running between two different ASs
iBGP




BGP running within the same AS
An AS has multiple BGP speakers and
provides transit service
Distribute routing info among BGP routers
minor but important difference with eBGP
Complete BGP illustration
eBGP
AS100
AS300
RtA
RtD
iBGP
RtB
RtC
AS200
Example of iBGP session
AS300
AS100
RtA
RtD
IGP
Loopback IF
150.212.1.1
RtB
RtC
134.18.50.22
AS200
BGP Messages




Open
Update
Notification
Keepalive
TCP connection always established
throughout the BGP session
Open Messages




The first message sent after TCP
established
Each peer identify itself to each other
Negotiate protocol version/parameters
Security (optional)
Open Message Format
Version (1 octet)
My Autonomous System (2 octet)
Hold Time (2 octet)
BGP identifier (4 octet)
Optional Parameter
Length (1 octet)
Optional parameters (variable length)
Update Message



Primary message used in a BGP
advertises(announce) a prefix to BGP
neighbors/withdraw a previously
advertised message
Encourage multiple prefixes in a single
Update
Notification Message



Used when error(s) happen(s)
TCP will be closed immediately after
notification is sent
Indicates the remote system why BGP
was terminated
Keepalive Message



Confirm the connection is still active
rate depend on the hold timer
negotiated by open message and
update message frequency
A common header with no other data
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
* 3.0.0.0
*
*
*
*>
*
* 4.0.0.0
*
*
*
*>
*
Next Hop
12.123.1.234
12.123.45.252
12.123.199.239
12.123.145.124
12.123.1.236
12.123.133.124
12.123.45.252
12.123.199.239
12.123.9.241
12.123.13.241
12.123.5.240
12.123.142.124
Metric LocPrf Weight Path
0 7018 80 i
0 7018 80 i
0 7018 80 i
0 7018 80 i
0 7018 80 i
0 7018 80 i
0 7018 1 i
0 7018 1 i
0 7018 1 i
0 7018 1 i
0 7018 1 i
0 7018 1 i
BGP attributes







AS-path attribute
Origin attribute
BGP Nexthop attribute
Weight Attribute
Local preference attribute
Metric attribute
Community attribute
AS-Path Attribute




A list of AS numbers that a route has
traversed in order to reach a destination
Whenever a route update pass through
a new AS, the AS number is prepended
AS numbers are listed in order
If the AS number is already in the
update, the route is dropped.
AS-PATH Attribute Example
170.10.0.0
AS100
RtA
AS200
RtC
RtD
RtA advertise 170.10.0.0 to RtC,
AS-PATH: 100
RtB
AS300
RtB advertise 170.10.0.0 to RtC,
AS-PATH: 300, 100
RtC advertise 170.10.0.0 to RtD,
AS-PATH: 300, 100
Origin Attribute



Mandatory attribute
Defines the origin of the path
information
three typical values



“i”: IGP, interior to the originating AS
“e”: EGP, learnt via exterior gateway
protocol
“?”: incomplete, unknown or via others
Origin Attribute Example
ip route 190.10.0.0 255.255.0.0 null 0
RtA
170.10.20.1
150.10.30.1
175.10.40.2
iBGP
RtB
190.10.50.1
AS100
170.10.20.2
RtE
AS300
170.10.0.0
RtA -> 170.10.0.0: 300 i
RtA -> 190.10.50.0: i
RtE -> 150.10.0.0: 100 i
RtE -> 190.10.0.0: 100 ?
Nexthop Attribute



The next hop IP address that is to use
to reach destination
For eBGP, always the directly connected
neighbor’s interface
For iBGP, the nexthop advertised by
eBGP should be carried through into
iBGP
Nexthop Attribute Example
150.10. 0.0
RtA
170.10.20.1
150.10.30.1
175.10.40.2
iBGP
RtB
190.10.50.1
AS100
170.10.20.2
RtC
AS300
170.10.0.0
RtC advertise 170.10.0.0 to RtA,
Nexthop 170.10.20.2
RtA advertise 170.10.0.0 to RtB,
Nexthop 170.10.20.2
How does BGP select a route?



Little information available about other
domains
Based on policies rather than optimality
Decisions (local) based on local
preference
Weight Attribute





Cisco implementation
Assigned locally to indicate a router to
choose best exit path
Does not propagate through router
updates
Higher weight is preferred
Default is 0
Weight Attribute Example
175.10.0.0
170.10.0.0
AS100
RtA
AS4
175.10.0.0
190.10.0.0
RtB
AS200
175.10.0.0
W=200
RtC W=100
AS300
RtA will be chosen
Local Preference Attribute




Indicate the AS about which exit is
preferred
Exchanged among routers in the same
AS through updates
Higher value is preferred
Default value is 100
Local Preference Example
175.10.0.0
170.10.0.0
AS100
RtA
175.10.0.0
AS4
190.10.0.0
RtB
AS200
Set
locPref=200
Set locPref=150
RtC
RtD
AS300
All traffic in AS 300 will
be directed to RtD
Metric Attribute





Also called Multi_exit_discriminator
Exchanged between AS, but not carried
through
Low value of a metric is more preferred
Default value is 0
Unless specified, router only compare
metrics for paths from the same
neighbor AS
Metric Attribute Example
Set Metric = 0
AS400
AS100
RtA
RtB
Set Metric = 200
Set Metric = 120
RtC
RtD
AS300
RtA will pick RtC
as the best route
Community Attribute





Optional attribute
Transitive between ASs
A label/string that attach to the prefixes
Aggregate prefixes into groups
So as to apply routing decisions
BGP policies
Decide
exactly ONE
best path
BGP router
Import policy
Receive routes
for prefixes
from multiple
neighbors
Filter out unwanted
routes, and manipulate
the attributes of
remaining routes
Decision
Process
Export
policy
Manipulate attributes of the
best route, influence
neighbor's choice, or decide
whether to advertise the
route to neighbors
Decision Process





Highest local preference
Shortest AS path
eBGP over iBGP
Lowest IGP metric
Lowest router id
Problems Of BGP


Convergence issue
Scalability issue
Summary

Inter-domain routing


Route selection is done based on policies
rather than optimality
Policies are encoded into local preferences
Download