Title: BGP4
1BGP-4
- Avgust Jauk ltjauk_at_arnes.sigt
- ARNES
- Budapest, August 2002
2Introduction
- The early Arpanet was completely flat - single
network model - one routing protocol, all routers had all the
routing info - with the growth it become hard to maintain and
computationally intensive - Solution split the Internet into a set of
Autonomous Systems (AS) - Each Autonomous System is a set of routers and
networks under the same administration
3Internet divided into Autonomous Systems
Autonomous System 2
Autonomous System 1
Autonomous System 3
4Internet divided into Autonomous Systems (cont.)
- Special routers, called Exterior gateways used
to connect ASes - Two classes of routing protocols
- Interior routing protocols (IGP - Interior
Gateway protocols) - Exterior routing protocols (EGP - Exterior
Gateway protocols)
5Internet divided into Autonomous Systems (cont.)
EGP
Autonomous System 2 IGP
Autonomous System 1 IGP
EGP
EGP
Autonomous System 3 IGP
6BGP - Border Gateway Protocol
- RFC-1771
- Used for routing between Autonomous Systems
(EBGP) - Powerful tool for expressing routing policies
- Current version is BGP-4
- Can be used also inside AS (IBGP)
7BGP-4
- Characteristics
- Distance-vector protocol with enhancements
- Acquires Neighbors (peers), agrees on AS numbers
and timers - Exchanges reachability information
- Initially routers exchange the whole table
- Only updates are sent later
- Reliable updates it relies on TCP
- Keeps track of neighbors (keepalives every 30
seconds)
8BGP-4 (cont.)
- Keeps alternative routes -gt instantaneous
switch-over - Insures loop free routing (between ASs)
- Message Types
- Open (BGP version, my AS , Hold time, Router ID,
...) - Update (withdrawn routes, advertised route,
- Notification (errors) , originator closes the
connection - Keepalive
9BGP-4 (cont.)
- Update consist of
- Prefix length (example /16)
- Network prefix (example 192.168.0.0)
- Attributes
- AS path (a list of ASs that a route has
traversed) - next hop
- origin
- local preference
- multi-exit discriminator
- communities, ...
10BGP Attributes
- Attributes can be optional or well-known
- optional attributes do not have to be understood
by every BGP speaker (Community) - well-known attributes have to be understood by
every BGP speaker (AS_PATH, NEXT HOP, LOCAL_PREF) - Attributes can be transitive or local
- transitive attributes are passed on to EBGP peers
(AS_PATH) - local attributes are passed only to IBGP peers
(LOCAL_PREF)
11AS Path
- Distance Vector R3 is 2 hops away from R1
R1
R2
R3
- Path Vector To go from AS1 to AS3 you have to
- cross AS2
AS1
AS2
AS3
12AS Path Example
- Prefix X in AS1 is announced from A to B in
AS2, then on to - C in AS3
- The path when prefix X gets to AS3 will be
prefix X - path AS2 AS1
13Loop Avoidance
AS2 AS1
AS1
AS1
AS3
AS3 AS2 AS1
AS4 AS3 AS2 AS1
AS4
Routing information sent from AS1 to AS2, to AS3,
to AS4 and back to AS1 will be ignored by AS1
14BGP-4 Neighbors
- Internal Neighbors (IBGP)
- Neighbor is in the same AS
- May be several hops away
- Full neighbor mesh is required
- External Neighbors (EBGP)
- Neighbor is in a different AS
- Neighbor must be directly reachable
15BGP-4 Internal and External Neighbors
A
B
Internal BGP AS 1 194.181.203.0
194.181.203.2
C
D
AS 2 194.181.201.1
AS 3 194.181.202.1
16BGP-4 Route Updates
- External updates
- Sent to the external neighbors new routes,
withdrawn routes without replacement - Internal updates
- If a route is received via EBGP, it shall be
advertised to all internal neighbors (Update) - If a route is received via IBGP, it shall not be
redistributed
17BGP Route Selection
- Complicated rules about what route is the best
one - General rules
- (largest weight)
- highest LOCAL_PREF
- shortest AS_PATH
- lowest Multi-Exit Discriminator
- cheapest IGP route to BGP NEXT_HOP
- lowest BGP router_id
18BGP lt-gt IGP Interaction
- Autonomous System has to be consistent about the
routes it advertises - if EBGP advertises a route before all routers in
AS have learned about it, AS might receive
traffic that some routers cannot route - BGP waits until IGP has propagated routing
information across AS (Synchronization)
19BGP-4 Stub customer
customer
BGP only at border, Default route to the border
20BGP-4 Stub customer
- RIP or OSPF internally
- BGP to the provider
- internal routes are announced to the provider
- no information or default only needs to be
provided by the provider - Border router inserts a default route into IGP
21BGP-4 Multi-homed customer
A
B
customer
22BGP-4 Multi-homed customer
- Solution
- Take a default route from provider A
- Take external routes from provider B and insert
them into IGP (or better, have a full IBGP mesh!) - Result
- Direct connectivity through B for all external
routes announced by provider B - Connectivity through provider A for all other
destinations - For a backup, accept a default route with a
higher metric also from provider B
23BGP-4 Transit AS
AS1
AS2
transit AS
24BGP-4 Transit AS
- Solution 1
- Internal BGP used with IGP
- imports all BGP routes into IGP (OSPF)
- IBGP connection only between border gateways
- Synchronization with IGP required
- May use one IGP for backbone, another for
internal nodes - IGP cannot carry a lot of routes gt this solution
should not be used!
25BGP-4 Transit AS
- Solution 2 (preferred)
- fully meshed IBGP between ALL routers
- IGP carries local information only - no need to
import of BGP routes into IGP - there might be a lot of IBGP peers, hard to
manage. Solution - Route reflectors
- BGP confederations
26Advanced features
- Communities
- means of tagging routes
- used to ask for certain route-selection or
filtering policy inside other ASes - Route flap damping (RFC 2439)
- used to minimize the number of BGP updates
- suppress unstable routes routes that are likely
to flap based on the history of their behavior
27BGP-4 limitations
- very powerful tool for expressing routing
policies, but - limited to the hop-by-hop routing paradigm
- it cannot influence how other ASes treat traffic
we sent there - only destination IP addresses are taken into
account (destination based routing)
28BGP-4 More info
- RFCs
- 1675 BGP MIB
- 1771 A border Gateway Protocol (BGP-4)
- 1772 Application of the BGP in the Internet
- 1773 Experience with the BGP-4 protocol
- 1774 BGP-4 protocol analysis
- 1997 BGP Communities Attribute
- 1998 An Application of the BGP Community
Attribute in Multi-home Routing
29BGP-4 More Info
- 2796 BGP Route Reflection - An Alternative to
Full Mesh IBGP - 2858 Multiprotocol Extensions for BGP-4
- 3065 Autonomous System Confederations for BGP
- ...
- Bassam Halabi Internet Routing Architectures
(ISBN 1-56205-652-2)
30Cisco configuration
- configuring neighbors
- originating networks
- route filtering (in/out)
- route selection (when multi-homed)
- using weights
- using local preference
- using multi-exit discriminator (MED)
31Configuring neighbors
- router bgp ltas-numbergt
- neighbor ltip-addressgt remote-as ltas-numbergt
- neighbor ltip-addressgt description ltneighbor
descriptiongt
32Originating networks
- By listing networks to be announced
- network ltclassfull-network-numbergt
- at least one subnet has to be present in the
routing table! - Using redistribution from IGP
- router BGP ltas-numbergt
- redistribute ltIGPgt
- distribute-list ltACLgt out ltIGPgt
- !
- access-list ltACLgt permit ltnetworkgt
33Originating networks 2
- use aggregation to announce summary prefixes
- network ltip-prefix-addressgt mask ltsubnet-maskgt
- the prefix must match exactly an entry in the
routing table. Example - router bgp 1
- network 192.168.0.0 mask 255.255.0.0
- !
- ip route 192.168.0.0 255.255.0.0 null 0
34Originating networks 3
- Before aggregation
- 201.222.191.0/24 201.222.10111111.0/24
- 201.222.192.0/24 201.222.11000000.0/24
- 201.222.193.0/24 201.222.11000001.0/24
- After aggregation
- 201.222.191.0/24 201.222.10111111.0/24
- 201.222.192.0/23 201.222.11000000.0/23
35Route filtering
- filtering incoming/outgoing updates
- network filters
- router bgp ltASgt
- neighbor ltip-addressgt remote-as lthis-ASgt
- neighbor ltip-addressgt distribute-list ltACLgt
in/out - !
- access-list ltACLgt permit/deny ltnetworkgt ltmaskgt
36Route filtering 2
- AS-path based filters
- router bgp ltASgt
- neighbor ltip-addressgt remote-as lthis-ASgt
- neighbor ltip-addressgt filter-list ltAS-ACLgt
in/out - !
- ip as-path access-list ltAS-ACLgt permit/deny
ltregexpgt - regexp examples
- - network originated in local AS
- . - matches anything
- _123_ - networks reachable through AS 123
37Route filtering 3
- route-maps for complex policies
- router bgp ltASgt
- neighbor ltip-addressgt remote-as lthis-ASgt
- neighbor ltip-addressgt route-map ltmap-namegt in
- !
- route-map ltmap-namegt permit/deny ltsequencegt
- match ltcriteriagt
- set ltparametergt
- criteria origin, tag, next-hop, as-path,
community, ... - parameter origin, next-hop, tag, weight,
- community, MED, ...
38Selecting routes (when multi-homed)
- Using weights (limited to the router)
- router bgp ltasgt
- neighbor ltip-addressgt weight ltvaluegt
- It sets weight to ltvaluegt for all routes received
from specified neighbor
39Selecting routes 2
- Using local preference (AS-wide)
- router bgp ltas-numbergt
- neighbor ltip-addressgt route-map ltmapgt in
- ! bgp default local-preference ltvaluegt
- route-map ltmapgt
- match ltcriteriagt
- set local-preference ltvaluegt
- Default local preference is 100
- Weight takes precedence over local preference
40Selecting routes 3
- Multi-exit discriminator (MED)
- used to influence path selection in neighboring
AS - AS can specify its preferred entry point using
MED in outgoing updates - router bgp ltasgt
- neighbor ltip-addressgt route-map ltmapgt out
- !
- Route-map ltmapgt permit
- match ltcriteriagt
- set metric ltvaluegt
41Cisco configuration
- router bgp 65000
- network 172.16.0.0
- network 192.168.0.0 mask 255.255.0.0
- neighbor 192.168.1.1 remote-as 2222
- neighbor 192.168.1.1 update-source Loopback0
- (use it for IBGP peers)
- neighbor 192.168.1.1 next-hop-self
- (use it for IBGP peers)
- neighbor 192.168.1.1 version 4
- neighbor 192.168.1.1 filter-list 92 in
- neighbor 192.168.1.1 distribute-list 21 out
- no synchronisation
42Cisco configuration
- ip route 192.168.0.0 255.255.0.0 Null0
- ip as-path access-list 92 deny _65001_
- ip as-path access-list 92 deny 65002
- ip as_path access-list 92 permit .
- access-list 21 permit 192.168.0.0
- access-list 21 permit 172.16.0.0
- ip default-network x.y.z.k
- show ip bgp summary
- show ip bgp