514-21-BGP

advertisement
BGP
BGP
• Border Gateway Protocol
– Currently version 4
– RFC 4271
– TCP port 179
• Routing between Autonomous Systems (ASes)
• Decentralised routing
– Allows an AS to advertise that it exists
– Each AS advertises routes it has, leaves decision
about whether to use them or not to peer
• Originally supported IPv4; these days multiprotocol
Autonomous System
• set of routers under same administrative
control
• owned/operated by same entity
• identified by a unique number
– autonomous system number (ASN)
– historically a 16-bit value
– public range:
1-64511
– private range:
64512-65535
Autonomous Systems
AS3
AS4
AS1
AS2
AS5
AS6
Autonomous Systems
AS1
AS2
eBGP
iBGP
BGP
• Path-Vector protocol
– Routing information includes the AS path a
route has traversed
– A router prepends its AS number to any route
it receives before advertising it
– A router discards any AS path that includes its
ASN in it
• Why?
Autonomous Systems
AS3
AS4
AS1
AS2
192.168.0.0/24
AS5
192.168.0.0/24
AS6
AS5
AS6
AS2
AS1
BGP message types
• OPEN
– Establish BGP session with peer; negotiate hold time,
advise ASN.
• KEEPALIVE
– Periodic message sent so a router knows a peer is
still up in absence of updates
• UPDATE
– Routes added or withdrawn
• NOTIFICATION
– Error condition encountered
BGP Message Format
marker
length
type
Marker: all ones in most cases; can be used for MD5 authentication.
Length: 19-4096 bytes
Type: one of four values (open, update, notification, keepalive)
UPDATE Message
• An exterior gateway protocol calls for
incremental changes to routing table.
– reduce volume of traffic to synchronise routing
through the network
• An UPDATE message advises
– when new routes are available
• Network Layer Reachability Information (NLRI)
– when a route is withdrawn
IP address prefix
+---------------------------+
|
Length (1 octet)
|
+---------------------------+
|
Prefix (variable)
|
+---------------------------+
• IPv4 routes are described in CIDR format
and encoded as <Length, Prefix>; e.g.
– 130.216.0.0/15
– 00001111 10000010 11011000
– (15)
(130)
(216)
UPDATE Message
+-----------------------------------------------------+
|
Withdrawn Routes Length (2 octets)
|
+-----------------------------------------------------+
|
Withdrawn Routes (variable)
|
+-----------------------------------------------------+
|
Total Path Attribute Length (2 octets)
|
+-----------------------------------------------------+
|
Path Attributes (variable)
|
+-----------------------------------------------------+
|
Network Layer Reachability Information (variable) |
+-----------------------------------------------------+
Section 4.3, UPDATE message format, RFC 4271
Withdrawing Routes
• The prefixes to withdraw (if any) are
specified in the withdrawn routes section
• The receiver finds the appropriate prefix
previously announced by the peer and
removes that one
• When a BGP connection is closed, all
routes advertised from that connection are
withdrawn by the peers
Advertising Routes
• New routes, and their attributes, are
specified in the NLRI and path attributes
sections
• Mandatory attributes:
– origin:
– AS path:
– next hop:
IGP, EGP, ?
seq. of ASes in path to prefix
IP address of router to use
Other Attributes
•
•
•
•
MED (Multi Exit Discriminator)
Local Pref
Community
…
Attributes
0
1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Attr. Flags |Attr. Type Code|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Bit
Bit
Bit
Bit
0:
1:
2:
3:
optional (0) / well-known (1)
transitive (1) / non-transitive (2)
partial (1) / complete (0)
attr. length octet (0) or two octets (1)
Classes of Attributes
• Well-known mandatory
– BGP speaker MUST understand it and MUST include
it in NLRI
• Well-known discretionary
– BGP speaker MUST understand it and MAY include it
in NLRI
• Optional transitive
– BGP speaker MAY understand it but MUST forward
attribute if received in NLRI – sets partial bit to 1
• Optional non-transitive
– BGP speaker MAY understand it but MUST NOT
forward attribute received in NLRI
Multiprotocol BGP (MBGP)
• BGP was designed to organise global IPv4
routing
• MBGP: a set of extensions to enable other types
of routes to be chucked around using the
attributes section
–
–
–
–
Optional, non-transitive
Has to be negotiated at OPEN.
MP-Reach-NLRI (type 14)
MP-Unreach-NLRI (type 15)
• RFC 4760
MP-Reach-NLRI
+---------------------------------------------------------+
| Address Family Identifier (2 octets)
|
+---------------------------------------------------------+
| Subsequent Address Family Identifier (1 octet)
|
+---------------------------------------------------------+
| Length of Next Hop Network Address (1 octet)
|
+---------------------------------------------------------+
| Network Address of Next Hop (variable)
|
+---------------------------------------------------------+
| Reserved (1 octet)
|
+---------------------------------------------------------+
| Network Layer Reachability Information (variable)
|
+---------------------------------------------------------+
Source: Page 3, RFC 4760
BGP decision process
Step Attribute
1
Highest LocalPref
Controlled by local
or neighbour AS?
local
2
Lowest AS path length
neighbour
3
Lowest origin type
neither
4
Lowest MED
neighbour
5
eBGP-learned over iBGP-learned
neither
6
Lowest IGP cost to border router local
7
Lowest router ID (to break ties)
neither
Source: BGP routing policies in ISP networks, Caesar and Rexford.
BGP Communities
• Administrative tag used to associate routes
together
• Assists in implementing administrative routing
policy
• Optional transitive attribute.
• Well-known communities:
– No-Export; do not advertise outside of this AS
– No-Advertise; do not advertise further
– No-Export-Subconfed; do not advertise outside
selected portion of AS.
Processing Route Advertisements
Applying Policy
• Import policy
– Filter routes from going further
– Append or modify attributes
• Decision process
• Export policy
– Which neighbours will receive the route
– Don’t want to carry traffic you aren’t being
paid to carry
Source: BGP routing policies in ISP networks, Caesar and Rexford.
Routing Policy
• Import policy
– Protect network from bad advertisements
• Advertising private or unallocated address space
• Customer advertising default route to provider
– Promote aggregation through filtering NLRI
with prefixes longer than particular value
Configuring Local Policies
1. Preference
•
add/delete/modify route attributes
2. Filtering
•
Eliminate certain routes from consideration;
control who they will be exported to;
3. Tagging
•
Associate additional state with a route using
community attribute
Further Reading
• BGP routing policies in ISP networks; Matthew Caesar
and Jennifer Rexford
• RFC 4760: Multiprotocol Extensions for BGP-4
• RFC 4271: A Border Gateway Protocol 4 (BGP-4)
Next lecture reading
• RFC 4364
– Section 3 to 4.3.2 (pp. 8-19)
– Section 4.3.5 to 4.3.6 (pp. 22)
Download