bgp tutorial
DESCRIPTION
BGP basic 101TRANSCRIPT
-
5/24/2018 BGP Tutorial
1/213
1 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
BGP for Internet ServiceProviders
Philip SmithPhilip Smith
AfNOGAfNOG 3,3, LomeLome, Togo, Togo
-
5/24/2018 BGP Tutorial
2/213
222 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Presentation Slides
Will be available on
www.cisco.com/public/cons/seminars/AfNOG3
Feel free to ask questions any time
-
5/24/2018 BGP Tutorial
3/213
333 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
BGP for Internet Service Providers
BGP Basics (quick recap)
Scaling BGP
Deploying BGP in an ISP network
Multihoming Examples
-
5/24/2018 BGP Tutorial
4/213
4 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
BGP Basics
What is this BGP thing?What is this BGP thing?
-
5/24/2018 BGP Tutorial
5/213
555 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Border Gateway Protocol
Routing Protocol used to exchangerouting information between networks
exterior gateway protocol
RFC1771
work in progress to update
draft-ietf-idr-bgp4-17.txt
-
5/24/2018 BGP Tutorial
6/213
666 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Autonomous System (AS)
Collection of networks with same routing policy
Single routing protocol
Usually under single ownership, trust andadministrative control
AS 100
-
5/24/2018 BGP Tutorial
7/213
777 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
BGP Basics
Runs over TCP port 179
Path vector protocol
Incremental updates
Internal & External BGP
AS 100 AS 101
AS 102
EE
BB DD
AA CC
Peering
-
5/24/2018 BGP Tutorial
8/213
888 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
AS 100 AS 101
AS 102
DMZNetwork
AA
BB
CC
DD
EE
Shared network between ASes
Demarcation Zone (DMZ)
-
5/24/2018 BGP Tutorial
9/213
999 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
BGP General Operation
Learns multiple paths via internaland external BGP speakers
Picks the best path and installs inthe forwarding table
Best path is sent to external BGPneighbours
Policies applied by influencing thebest path selection
-
5/24/2018 BGP Tutorial
10/213
101010 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
External BGP Peering (eBGP)
AS 100 AS 101CC
AA
Between BGP speakers in different AS
Should be directly connected
Neverrun an IGP between eBGP peers
BB
-
5/24/2018 BGP Tutorial
11/213
111111 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Configuring External BGP
Router A in AS100interface ethernet 5/0ip address 222.222.10.2 255.255.255.240router bgp 100network 220.220.8.0 mask 255.255.252.0neighbor 222.222.10.1 remote-as 101neighbor 222.222.10.1prefix-list RouterC inneighbor 222.222.10.1prefix-list RouterC out
Router C in AS101interface ethernet 1/0/0ip address 222.222.10.1 255.255.255.240
router bgp 101network 220.220.16.0 mask 255.255.240.0neighbor 222.222.10.2 remote-as 100neighbor 222.222.10.2prefix-list RouterA inneighbor 222.222.10.2prefix-list RouterA out
-
5/24/2018 BGP Tutorial
12/213
121212 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Internal BGP (iBGP)
BGP peer within the same AS
Not required to be directly connected
iBGP speakers need to be fully meshed
they originate connected networks
they do not pass on prefixes learned from
other iBGP speakers
-
5/24/2018 BGP Tutorial
13/213
131313 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Internal BGP Peering (iBGP)
Topology independent
Each iBGP speaker must peer withevery other iBGP speaker in the AS
AS 100
AA
EE
BB
DD
-
5/24/2018 BGP Tutorial
14/213
141414 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Peering to Loop-back Address
AS 100
Peer with loop-back address
Loop-back interface does not go down ever!
iBGP session is not dependent on state of a singleinterface
iBGP session is not dependent on physical topology
-
5/24/2018 BGP Tutorial
15/213
151515 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Configuring Internal BGP
Router Ainterface loopback 0ip address 215.10.7.1 255.255.255.255router bgp 100network 220.220.1.0neighbor 215.10.7.2 remote-as 100neighbor 215.10.7.2 update-source loopback0
neighbor 215.10.7.3 remote-as 100neighbor 215.10.7.3 update-source loopback0
Router Binterface loopback 0ip address 215.10.7.2 255.255.255.255router bgp 100
network 220.220.5.0neighbor 215.10.7.1 remote-as 100neighbor 215.10.7.1 update-source loopback0neighbor 215.10.7.3 remote-as 100neighbor 215.10.7.3 update-source loopback0
-
5/24/2018 BGP Tutorial
16/213
16 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
BGP Attributes
Recap
-
5/24/2018 BGP Tutorial
17/213
171717 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Sequence of ASes aroute has traversed
Loop detection
Apply policy
AS-Path
AS 100
AS 300
AS 200
AS 500
AS 400
170.10.0.0/16 180.10.0.0/16
150.10.0.0/16
180.10.0.0/16 300 200 100
170.10.0.0/16 300 200
150.10.0.0/16 300 400
180.10.0.0/16 300 200 100170.10.0.0/16 300 200
-
5/24/2018 BGP Tutorial
18/213
181818 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Next Hop
160.10.0.0/16
150.10.0.0/16
150.10.1.1 150.10.1.2
AS 100
AS 300
AS 200AA BB
CC
150.10.0.0/16 150.10.1.1160.10.0.0/16 150.10.1.1
eBGP
iBGP
eBGP address of external neighbour
iBGP NEXT_HOP from eBGP
-
5/24/2018 BGP Tutorial
19/213
191919 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
iBGP Next Hop
AS 300
BBCC
220.1.1.0/24 220.1.254.2220.1.2.0/23 220.1.254.3
iBGP
DD
AA
220.1.1.0/24
220.1.2.0/23
Loopback220.1.254.2/32
Loopback220.1.254.3/32
Next hop is ibgp router loopback address
Recursive route look-up
-
5/24/2018 BGP Tutorial
20/213
202020 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Third Party Next Hop
192.68.1.0/24
150.1.1.3150.1.1.3
150.1.1.1
150.1.1.2
192.68.1.0/24 150.1.1.3
AS 201
AS 200
CC
AA BB
eBGP between Router A andRouter C
eBGP between Router A andRouter B
192.68.1/24 prefix has next
hop address of 150.1.1.3 this is passed on to Router Cinstead of 150.1.1.2
AS 202
-
5/24/2018 BGP Tutorial
21/213
212121 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Next Hop (summary)
IGP should carry route to next hops
Recursive route look-up
Unlinks BGP from actual physicaltopology
Allows IGP to make intelligent forwarding
decision
-
5/24/2018 BGP Tutorial
22/213
222222 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Origin
Conveys the origin of the prefix
Historical attribute
Influences best path selection
Three values: IGP, EGP, incomplete
IGP generated by BGP network statement
EGP generated by EGP
incomplete redistributed from another routingprotocol
-
5/24/2018 BGP Tutorial
23/213
232323 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Aggregator
Conveys the IP address of the router/BGP
speaker generating the aggregate route Useful for debugging purposes
Does not influence best path selection
-
5/24/2018 BGP Tutorial
24/213
242424 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Local Preference
AS 400
AS 200
160.10.0.0/16
AS 100
AS 300
160.10.0.0/16 500> 160.10.0.0/16 800
500 800 EE
BB
CC
AA
DD
-
5/24/2018 BGP Tutorial
25/213
252525 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Local Preference
Local to an AS non-transitive
Default local preference is 100
Used to influence BGP path selection
determines best path for outboundtraffic
Path with highest local preference wins
-
5/24/2018 BGP Tutorial
26/213
262626 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Local Preference
Configuration of Router B:router bgp 400
neighbor 220.5.1.1 remote-as 300
neighbor 220.5.1.1 route-map local-pref in!
route-map local-prefpermit 10
match ip address prefix-listMATCH
set local-preference 800
!
ip prefix-listMATCHpermit 160.10.0.0/16
-
5/24/2018 BGP Tutorial
27/213
272727 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Multi-Exit Discriminator (MED)
AS 201
AS 200
192.68.1.0/24
CC
AA BB
192.68.1.0/24 1000192.68.1.0/24 2000
-
5/24/2018 BGP Tutorial
28/213
282828 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Multi-Exit Discriminator
Inter-AS non-transitive
Used to convey the relative preference of entry
pointsdetermines best path for i nboundtraffic
Comparable if paths are from same AS
IGP metric can be conveyed as MEDset metric-type internal in route-map
-
5/24/2018 BGP Tutorial
29/213
292929 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Multi-Exit Discriminator
Configuration of Router B:router bgp 400
neighbor 220.5.1.1 remote-as 200
neighbor 220.5.1.1 route-map set-medout!
route-map set-medpermit 10
match ip address prefix-listMATCH
set metric 1000
!ip prefix-listMATCHpermit 192.68.1.0/24
-
5/24/2018 BGP Tutorial
30/213
303030 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Weight Used to Deploy RPF
Local to router on which its configured
Not really an attribute
route-map: set weight Highest weight wins over all valid paths
Weight customer eBGP on edge routers to allow RPF to workcorrectly
AS4
AS1
Link to use for most traffic from AS1
Backup link, but RPF
still needs to work
AS4, LOCAL_PREF 200
AS4, LOCAL_PREF 100
-
5/24/2018 BGP Tutorial
31/213
313131 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Community
BGP attribute
Described in RFC1997
32 bit integer
Represented as two 16 bit integers
Used to group destinations
Each destination could be member of multiplecommunities
Community attribute carried across ASs Very useful in applying policies
-
5/24/2018 BGP Tutorial
32/213
323232 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
160.10.0.0/16 300:1
Community
AS 200
160.10.0.0/16 300:1
170.10.0.0/16 300:1
170.10.0.0/16 300:1
AS 400
DD
CC
FF
BB
170.10.0.0/16
AS 100 AA
160.10.0.0/16
ISP 1200.10.0.0/16 300:9
XX
ISP 2
200.10.0.0/16
AS 300
EE
-
5/24/2018 BGP Tutorial
33/213
333333 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Well-Known Communities
no-export
do not advertise to eBGP peers
no-advertisedo not advertise to any peer
local-AS
do not advertise outside local AS (only used withconfederations)
-
5/24/2018 BGP Tutorial
34/213
343434 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
No-Export Community
170.10.0.0/16
170.10.X.X No-Export
170.10.0.0/16
AS 100 AS 200
170.10.X.X
CC FF
GG
DDAA
BB EE
AS100 announces aggregate and subprefixes
aim is to improve loadsharing by leaking subprefixes Subprefixes marked with no-export community
Router G in AS200 does not announce prefixes with no-exportcommunity set
-
5/24/2018 BGP Tutorial
35/213
35 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
BGP Path Selection Algorithm
Why Is This the Best Path?
-
5/24/2018 BGP Tutorial
36/213
363636 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
BGP Path Selection Algorithm
Do not consider path if no route to next hop
Do not consider iBGP path if notsynchronised (Cisco IOS)
Highest weight (local to router)
Highest local preference (global within AS)
Prefer locally originated route
Shortest AS path
BGP P th S l ti Al ith
-
5/24/2018 BGP Tutorial
37/213
373737 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
BGP Path Selection Algorithm(continued)
Lowest origin code
IGP < EGP < incomplete
Lowest Multi-Exit Discriminator (MED)
Ifbgp deterministic-med, order the paths beforecomparing
Ifbgp always-compare-med, then compare for allpaths
otherwise MED only considered if paths are fromthe same AS (default)
BGP P th S l ti Al ith
-
5/24/2018 BGP Tutorial
38/213
383838 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
BGP Path Selection Algorithm(continued)
Prefer eBGP path over iBGP path
Path with lowest IGP metric to next-hop
Lowest router-id (originator-id for reflectedroutes)
Shortest Cluster-List
Client must be aware of Route Reflector
attributes! Lowest neighbour IP address
-
5/24/2018 BGP Tutorial
39/213
39 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Applying Policy with BGP
Control!
-
5/24/2018 BGP Tutorial
40/213
404040 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Applying Policy with BGP
Applying Policy
Decisions based on AS path, community or the prefix
Rejecting/accepting selected routes
Set attributes to influence path selection
Tools:
Prefix-list (filter prefixes)
Filter-list (filter ASes)Route-maps and communities
Policy Control
-
5/24/2018 BGP Tutorial
41/213
414141 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Policy ControlPrefix List
Filter routes based on prefix
Inbound and Outboundrouter bgp 200
neighbor 220.200.1.1 remote-as 210
neighbor 220.200.1.1 prefix-list PEER-IN in
neighbor 220.200.1.1 prefix-list PEER-OUT out
!
ip prefix-list PEER-IN deny 218.10.0.0/16
ip prefix-list PEER-INpermit 0.0.0.0/0 le 32ip prefix-list PEER-OUTpermit 215.7.0.0/16
Policy Control
-
5/24/2018 BGP Tutorial
42/213
424242 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Policy ControlFilter List
Filter routes based on AS path
Inbound and Outboundrouter bgp 100
neighbor 220.200.1.1 remote-as 210neighbor 220.200.1.1 filter-list 5 out
neighbor 220.200.1.1 filter-list 6 in
!
ip as-path access-list 5permit ^200$
ip as-path access-list 6permit ^150$
Policy Control
-
5/24/2018 BGP Tutorial
43/213
434343 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Policy ControlRegular Expressions
Like Unix regular expressions
. Match one character
* Match any number of preceding expression
+ Match at least one of preceding expression
^ Beginning of line
$ End of line
_ Beginning, end, white-space, brace
| Or
() brackets to contain expression
Policy Control
-
5/24/2018 BGP Tutorial
44/213
444444 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Policy ControlRegular Expressions
Simple Examples
.* Match anything
.+ Match at least one character
^$ Match routes local to this AS_1800$ Originated by 1800
^1800_ Received from 1800
_1800_ Via 1800
_790_1800_ Passing through 1800 then 790
_(1800_)+ Match at least one of 1800 in sequence_\(65350\)_ Via 65350 (confederation AS)
Policy Control
-
5/24/2018 BGP Tutorial
45/213
454545 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Policy ControlRoute Maps
A route-map is like a programme for IOS
Has line numbers, like programmes
Each line is a separate condition/action
Concept is basically:if matchthen do expressionand exi t
else
if match then do expressionand exi t
else etc
Policy Control
-
5/24/2018 BGP Tutorial
46/213
464646 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Policy ControlRoute Maps
Example using prefix-lists
router bgp 100neighbor 1.1.1.1 route-map infilter in!route-map infilterpermit 10
match ip address prefix-list HIGH-PREFset local-preference 120!route-map infilterpermit 20match ip address prefix-list LOW-PREFset local-preference 80!
route-map infilterpermit 30!ip prefix-list HIGH-PREFpermit 10.0.0.0/8ip prefix-list LOW-PREFpermit 20.0.0.0/8
Policy Control
-
5/24/2018 BGP Tutorial
47/213
474747 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Policy ControlRoute Maps
Example using filter lists
router bgp 100neighbor 220.200.1.2 route-map filter-on-as-path in!route-map filter-on-as-pathpermit 10
match as-path 1set local-preference 80!route-map filter-on-as-pathpermit 20match as-path 2set local-preference 200!route-map filter-on-as-pathpermit 30!ip as-path access-list 1 permit _150$ip as-path access-list 2 permit _210_
Policy Control
-
5/24/2018 BGP Tutorial
48/213
484848 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
o cy Co t oRoute Maps
Example configuration of AS-PATH prependrouter bgp 300
network 215.7.0.0
neighbor 2.2.2.2 remote-as 100
neighbor 2.2.2.2 route-map SETPATH out
!
route-map SETPATH permit 10
set as-path prepend300 300
Use your own AS number when prepending
Otherwise BGP loop detection may causedisconnects
Policy Control
-
5/24/2018 BGP Tutorial
49/213
494949 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
ySetting Communities
Example Configurationrouter bgp 100
neighbor 220.200.1.1 remote-as 200
neighbor 220.200.1.1 send-community
neighbor 220.200.1.1 route-map set-community out
!route-map set-community permit 10
match ip address prefix-listNO-ANNOUNCE
set community no-export
!
route-map set-community permit 20!
ip prefix-listNO-ANNOUNCEpermit 172.168.0.0/16 ge 17
Policy Control
-
5/24/2018 BGP Tutorial
50/213
505050 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
yMatching Communities
Example Configurationrouter bgp 100neighbor 220.200.1.2 remote-as 200
neighbor 220.200.1.2 route-map filter-on-community in
!
route-map filter-on-communitypermit 10
match community 1set local-preference 50
!
route-map filter-on-communitypermit 20
match community 2 exact-match
set local-preference 200
!
ip community-list 1 permit 150:3 200:5
ip community-list 2 permit 88:6
-
5/24/2018 BGP Tutorial
51/213
515151 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
BGP for Internet Service Providers
BGP Basics (quick recap)
Scaling BGP Deploying BGP in an ISP network
Multihoming Examples
-
5/24/2018 BGP Tutorial
52/213
52 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
BGP Scaling Techniques
-
5/24/2018 BGP Tutorial
53/213
535353 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
BGP Scaling Techniques
How to scale iBGP mesh beyond a few peers?
How to implement new policy without causing
flaps and route churning? How to reduce the overhead on the routers?
How to keep the network stable, scalable, as wellas simple?
-
5/24/2018 BGP Tutorial
54/213
545454 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
BGP Scaling Techniques
Dynamic Reconfiguration
Peer groups
Route flap damping
-
5/24/2018 BGP Tutorial
55/213
55 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Dynamic Reconfiguration
Soft Reconfiguration and Route Refresh
S f R fi i
-
5/24/2018 BGP Tutorial
56/213
565656 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Soft Reconfiguration
Problem:
Hard BGP peer clear required after everypolicy change because the router does not
store prefixes that are denied by a filter Hard BGP peer clearing consumes CPU
and affects connectivity for all networks
Solution:
Soft-reconfiguration
S ft R fi ti
-
5/24/2018 BGP Tutorial
57/213
575757 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Soft Reconfiguration
BGP in
process
BGP
table
BGP out
process
BGP in
table
receivedreceivedand used
accepted
discardedpeer
peer
normal
soft
S ft R fi ti
-
5/24/2018 BGP Tutorial
58/213
585858 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Soft Reconfiguration
New policy is activated without tearing downand restarting the peering session
Per-neighbour basis
Use more memory to keep prefixes whoseattributes have been changed or have not beenaccepted
C fi i S ft R fi ti
-
5/24/2018 BGP Tutorial
59/213
595959 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Configuring Soft Reconfiguration
router bgp 100
neighbor 1.1.1.1 remote-as 101
neighbor 1.1.1.1 route-map infilter in
neighbor 1.1.1.1 soft-reconfiguration inbound
! Outbou nd do es not need to be conf igured!
Then when we change the policy, we issue an exec command
clear ip bgp 1.1.1.1 soft [in | out]
Ro te Refresh Capabilit
-
5/24/2018 BGP Tutorial
60/213
606060 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Route Refresh Capability
Facilitates non-disruptive policy changes
No configuration is needed
No additional memory is used
Requires peering routers to support routerefresh capability RFC2918
clear ip bgp x.x.x.x in tells peer to resend fullBGP announcement
Soft Reconfigurationvs Route Refresh
-
5/24/2018 BGP Tutorial
61/213
616161 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
vs. Route Refresh
Use Route Refresh capability if supported
find out from show ip bgp neighbor
uses much less memory
Otherwise use Soft Reconfiguration
Only hard-reset a BGP peering as a last resort
-
5/24/2018 BGP Tutorial
62/213
62 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Peer Groups
Peer Groups
-
5/24/2018 BGP Tutorial
63/213
636363 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Peer Groups
Without peer groups
iBGP neighbours receive same update
Large iBGP mesh slow to build Router CPU wasted on repeat calculations
Solution peer groups!
Group peers with same outbound policy
Updates are generated once per group
Peer Groups Advantages
-
5/24/2018 BGP Tutorial
64/213
646464 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Peer Groups Advantages
Makes configuration easier
Makes configuration less prone to error
Makes configuration more readable
Lower router CPU load
iBGP mesh builds more quickly
Members can have different inbound policy
Can be used for eBGP neighbours too!
Configuring Peer Group
-
5/24/2018 BGP Tutorial
65/213
656565 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Configuring Peer Group
router bgp 100neighbor ibgp-peer peer-group
neighbor ibgp-peer remote-as 100
neighbor ibgp-peer update-source loopback 0
neighbor ibgp-peer send-community
neighbor ibgp-peer route-map outfilter out
neighbor 1.1.1.1 peer-group ibgp-peer
neighbor 2.2.2.2 peer-group ibgp-peer
neighbor 2.2.2.2 route-map infilter in
neighbor 3.3.3.3 peer-group ibgp-peer
! note how 2.2.2.2 has different inbound filter from peer-group !
Configuring Peer Group
-
5/24/2018 BGP Tutorial
66/213
666666 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Configuring Peer Group
router bgp 109
neighbor external-peer peer-group
neighbor external-peer send-community
neighbor external-peer route-map set-metric out
neighbor 160.89.1.2 remote-as 200neighbor 160.89.1.2 peer-group external-peer
neighbor 160.89.1.4 remote-as 300
neighbor 160.89.1.4 peer-group external-peer
neighbor 160.89.1.6 remote-as 400
neighbor 160.89.1.6 peer-group external-peerneighbor 160.89.1.6 filter-list infilter in
-
5/24/2018 BGP Tutorial
67/213
67 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Route Flap Damping
Stabilising the Network
Route Flap Damping
-
5/24/2018 BGP Tutorial
68/213
686868 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Route Flap Damping
Route flap
Going up and down of path or change in attribute
BGP WITHDRAW followed by UPDATE = 1 flap
eBGP neighbour going down/up is NOT a flap
Ripples through the entire Internet
Wastes CPU
Damping aims to reduce scope of route flappropagation
Route Flap Damping (continued)
-
5/24/2018 BGP Tutorial
69/213
696969 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Route Flap Damping (continued)
Requirements
Fast convergence for normal route changes
History predicts future behaviour
Suppress oscillating routes
Advertise stable routes
Documented in RFC2439
Operation
-
5/24/2018 BGP Tutorial
70/213
707070 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Operation
Add penalty (1000) for each flap
Change in attribute gets penalty of 500
Exponentially decay penalty
half life determines decay rate
Penalty above suppress-limitdo not advertise route to BGP peers
Penalty decayed below reuse-limit
re-advertise route to BGP peers
penalty reset to zero when it is half of reuse-limit
Operation
-
5/24/2018 BGP Tutorial
71/213
717171 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Ope at o
Reuse limit
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
0
1000
2000
3000
4000
Time
Penalty
Suppress limit
NetworkAnnounced
NetworkRe-announced
NetworkNot Announced
Operation
-
5/24/2018 BGP Tutorial
72/213
727272 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
p
Only applied to inbound announcementsfrom eBGP peers
Alternate paths still usable
Controlled by:
Half-life (default 15 minutes)
reuse-limit (default 750)
suppress-limit (default 2000)maximum suppress time (default 60 minutes)
Configuration
-
5/24/2018 BGP Tutorial
73/213
737373 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
g
Fixed dampingrouter bgp 100
bgp dampening [ ]
Selective and variable dampingbgp dampening [route-map ]
Variable damping
recommendations for ISPs
http://www.ripe.net/docs/ripe-229.html
BGP Scaling Techniques
-
5/24/2018 BGP Tutorial
74/213
747474 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
g q
These 3 techniques should be corerequirements in all ISP networks
Soft reconfiguration/Route Refresh
Peer groups
Route flap damping
BGP for Internet Service Providers
-
5/24/2018 BGP Tutorial
75/213
757575 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
BGP Basics (quick recap)
Scaling BGP
Deploying BGP in an ISP network
Multihoming Examples
-
5/24/2018 BGP Tutorial
76/213
76 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Deploying BGP in an ISPNetwork
Current Practices
BGP versus OSPF/ISIS
-
5/24/2018 BGP Tutorial
77/213
777777 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Internal Routing Protocols (IGPs)
examples are ISIS and OSPF
used for carrying infrastructure addressesNOT used for carrying Internet prefixes orcustomer prefixes
design goal is to minimise number of prefixes
in IGP to aid scalability and rapid convergence
BGP versus OSPF/ISIS
-
5/24/2018 BGP Tutorial
78/213
787878 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
BGP used internally (iBGP) and externally(eBGP)
iBGP used to carry
some/all Internet prefixes across backbone
customer prefixes
eBGP used to
exchange prefixes with other ASes
implement routing policy
BGP versus OSPF/ISISConfiguration Example
-
5/24/2018 BGP Tutorial
79/213
797979 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
router bgp 34567
neighbor core-ibgp peer-group
neighbor core-ibgp remote-as 34567
neighbor core-ibgp update-source Loopback0
neighbor core-ibgp send-community
neighbor core-ibgp-partial peer-group
neighbor core-ibgp-partial remote-as 34567
neighbor core-ibgp-partial update-source Loopback0
neighbor core-ibgp-partial send-community
neighbor core-ibgp-partial prefix-list network-ibgp out
neighbor 222.1.9.10 peer-group core-ibgp
neighbor 222.1.9.13 peer-group core-ibgp-partial
neighbor 222.1.9.14 peer-group core-ibgp-partial
BGP versus OSPF/ISIS
-
5/24/2018 BGP Tutorial
80/213
808080 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
DO NOT:
distribute BGP prefixes into an IGP
distribute IGP routes into BGP
use an IGP to carry customer prefixes
YOUR NETWORK WILL NOT SCALE
-
5/24/2018 BGP Tutorial
81/213
81 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Aggregation
Quality or Quantity?
Aggregation
-
5/24/2018 BGP Tutorial
82/213
828282 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
ISPs receive address block from RegionalRegistry or upstream provider
Aggregation means announcing the address
block only, not subprefixesSubprefixes should only be announced in special cases see later.
Aggregate should be generated internally
Not on the network borders!
Configuring AggregationMethod One
-
5/24/2018 BGP Tutorial
83/213
838383 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
ISP has 221.10.0.0/19 address block
To put into BGP as an aggregate:
router bgp 100
network 221.10.0.0 mask 255.255.224.0ip route 221.10.0.0 255.255.224.0 null0
The static route is a pull up route
more specific prefixes within this address block ensureconnectivity to ISPs customers
longest match lookup
Configuring AggregationMethod Two
-
5/24/2018 BGP Tutorial
84/213
848484 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Configuration Examplerouter bgp 109
network 221.10.0.0 mask 255.255.252.0
aggregate-address 221.10.0.0 255.255.224.0 [summary-only]
Requires more specific prefix in routing table before
aggregate is announced {summary-only} keyword
ensures that only the summary is announced if a morespecific prefix exists in the routing table
Sets aggregator attributeUseful for debugging
Announcing Aggregate Cisco IOS
-
5/24/2018 BGP Tutorial
85/213
858585 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Configuration Examplerouter bgp 100
network 221.10.0.0 mask 255.255.224.0
neighbor 222.222.10.1 remote-as 101
neighbor 222.222.10.1 prefix-list out-filter out
!
ip route 221.10.0.0 255.255.224.0 null0
!ip prefix-list out-filter permit 221.10.0.0/19
Announcing an Aggregate
-
5/24/2018 BGP Tutorial
86/213
868686 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
ISPs who dont and wont aggregate areheld in poor regard by community
Registries minimum allocation size is now
a /20no real reason to see subprefixes of allocatedblocks in the Internet
BUT there are currently >62000 /24s!
The Internet Today
-
5/24/2018 BGP Tutorial
87/213
878787 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Current Internet Routing Table StatisticsBGP Routing Table Entries 111947
Prefixes after maximum aggregation 73017
Unique prefixes in Internet 53184
Prefixes larger than registry alloc 45107
/24s announced 62487
only 5471 /24s are from 192.0.0.0/8
ASes in use 13045
-
5/24/2018 BGP Tutorial
88/213
88 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Receiving Prefixes
Receiving Prefixes from downstreampeers
-
5/24/2018 BGP Tutorial
89/213
898989 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
ISPs should only accept prefixes which havebeen assigned or allocated to theirdownstream peer
For example
downstream has 220.50.0.0/20 block
should only announce this to peers
peers should only accept this from them
Receiving Prefixes:Cisco IOS
-
5/24/2018 BGP Tutorial
90/213
909090 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Configuration Example on upstreamrouter bgp 100
neighbor 222.222.10.1 remote-as 101
neighbor 222.222.10.1 prefix-list customer in
!
ip prefix-list customer permit 220.50.0.0/20
Receiving Prefixes from upstreampeers
-
5/24/2018 BGP Tutorial
91/213
919191 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Not desirable unless really necessary
special circumstances see later
Ask upstream to either:
originate a default-route
-or-
announce one prefix you can use as default
Receiving Prefixes from upstreampeers
-
5/24/2018 BGP Tutorial
92/213
929292 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Downstream Router Configurationrouter bgp 100
network 221.10.0.0 mask 255.255.224.0
neighbor 221.5.7.1 remote-as 101
neighbor 221.5.7.1 prefix-list infilter in
neighbor 221.5.7.1 prefix-list outfilter out
!
ip prefix-list infilter permit 0.0.0.0/0
!
ip prefix-list outfilter permit 221.10.0.0/19
Receiving Prefixes from upstreampeers
-
5/24/2018 BGP Tutorial
93/213
939393 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Upstream Router Configurationrouter bgp 101
neighbor 221.5.7.2 remote-as 100
neighbor 221.5.7.2 default-originate
neighbor 221.5.7.2 prefix-list cust-in in
neighbor 221.5.7.2 prefix-list cust-out out
!
ip prefix-list cust-in permit 221.10.0.0/19
!
ip prefix-list cust-out permit 0.0.0.0/0
Receiving Prefixes from upstreampeers
-
5/24/2018 BGP Tutorial
94/213
949494 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
If necessary to receive prefixes fromupstream provider, care is required
dont accept RFC1918 etc prefixes
http://www.ietf.org/internet-drafts/draft-manning-dsua-07.txt
dont accept your own prefix
dont accept default (unless you need it)
dont accept prefixes longer than /24
This guideline may change soon
Receiving Prefixes
-
5/24/2018 BGP Tutorial
95/213
959595 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
router bgp 100
network 221.10.0.0 mask 255.255.224.0neighbor 221.5.7.1 remote-as 101
neighbor 221.5.7.1 prefix-list in-filter in
!
ip prefix-list in-filter deny 0.0.0.0/0 ! Block default
ip prefix-list in-filter deny 0.0.0.0/8 le 32
ip prefix-list in-filter deny 10.0.0.0/8 le 32
ip prefix-list in-filter deny 127.0.0.0/8 le 32
ip prefix-list in-filter deny 169.254.0.0/16 le 32
ip prefix-list in-filter deny 172.16.0.0/12 le 32
ip prefix-list in-filter deny 192.0.2.0/24 le 32
ip prefix-list in-filter deny 192.168.0.0/16 le 32
ip prefix-list in-filter deny 221.10.0.0/19 le 32 ! Block local prefix
ip prefix-list in-filter deny 224.0.0.0/3 le 32 ! Block multicast
ip prefix-list in-filter deny 0.0.0.0/0 ge 25 ! Block prefixes >/24
ip prefix-list in-filter permit 0.0.0.0/0 le 32
-
5/24/2018 BGP Tutorial
96/213
96 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Prefixes into iBGP
Injecting prefixes into iBGP
-
5/24/2018 BGP Tutorial
97/213
979797 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Use iBGP to carry customer prefixes
dont ever use IGP
Point static route to customer interface
Use BGP network statement
As long as static route exists (interface
active), prefix will be in BGP
Router Configurationnetwork statement
-
5/24/2018 BGP Tutorial
98/213
989898 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Example:interface loopback 0
ip address 215.17.3.1 255.255.255.255
!
interface Serial 5/0
ip unnumbered loopback 0
ip verify unicast reverse-path
!
ip route 215.34.10.0 255.255.252.0 Serial 5/0
!
router bgp 100network 215.34.10.0 mask 255.255.252.0
Injecting prefixes into iBGP
-
5/24/2018 BGP Tutorial
99/213
999999 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
interface flap will result in prefix withdrawand re-announce
use ip routepermanent
Static route always exists, even if interface is down prefix announced in iBGP
many ISPs use redistribute static rather thannetwork statement
only use this if you understand why
Inserting prefixes into BGP:redistribute static
-
5/24/2018 BGP Tutorial
100/213
100100100 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Care required with redistribute!
redistribute means everythingin the will be transferred into
the current routing protocolDoes not scale if uncontrolled
Best avoided if at all possible
redistribute normally used with route-maps and
under tight administrative control
Router Configuration:redistribute static
-
5/24/2018 BGP Tutorial
101/213
101101101 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Example:ip route 215.34.10.0 255.255.252.0 Serial 5/0!
router bgp 100
redistribute static route-map static-to-bgp
!route-map static-to-bgppermit 10
match ip address prefix-list ISP-block
set origin igp
!
ip prefix-list ISP-blockpermit 215.34.10.0/22 le 30!
Injecting prefixes into iBGP
-
5/24/2018 BGP Tutorial
102/213
102102102 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Route-map ISP-block can be used for manythings:
setting communities and other attributes
setting origin code to IGP, etc
Be careful with prefix-lists and route-maps
absence of either/both could mean all statically
routed prefixes go into iBGP
-
5/24/2018 BGP Tutorial
103/213
103 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Configuration Tips
iBGP and IGPs
-
5/24/2018 BGP Tutorial
104/213
104104104 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Make sure loopback is configured on router
iBGP between loopbacks, NOT real interfaces
Make sure IGP carries loopback /32 address
Make sure IGP carries DMZ netsUse ip-unnumbered where possible
Or use next-hop-self on iBGP neighbours
neighbor x.x.x.x next-hop-self
Next-hop-self
-
5/24/2018 BGP Tutorial
105/213
105105105 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Used by many ISPs on edge routers
Preferable to carrying DMZ /30 addresses inthe IGP
Reduces size of IGP to just core infrastructureAlternative to using ip unnumbered
Helps scale network
BGP speaker announces external network
using local address (loopback) as next-hop
BGP Template iBGP peers
-
5/24/2018 BGP Tutorial
106/213
106106106 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
iBGP Peer GroupAS100
router bgp 100neighbor internal peer-group
neighbor internal description ibgp peersneighbor internal remote-as 100neighbor internal update-source Loopback0neighbor internal next-hop-selfneighbor internal send-communityneighbor internal version 4
neighbor internal password 7 03085A09neighbor 1.0.0.1 peer-group internalneighbor 1.0.0.2 peer-group internal
BGP Template iBGP peers
U
-
5/24/2018 BGP Tutorial
107/213
107107107 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Use peer-groups
iBGP between loopbacks!
Next-hop-self
Keep DMZ and point-to-point out of IGP
Always send communities in iBGPOtherwise accidents will happen
Hardwire BGP to version 4
Yes, this is being paranoid!
Use passwords on iBGP sessionNot being paranoid, VERY necessary
BGP Template eBGP peers
Router B: AS 200
-
5/24/2018 BGP Tutorial
108/213
108108108 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
router bgp 100
bgp dampening route-map RIPE229-flap
network 10.60.0.0 mask 255.255.0.0
neighbor external peer-group
neighbor external remote-as 200
neighbor external description ISP connection
neighbor external remove-private-AS
neighbor external version 4
neighbor external prefix-list ispout out ! real filterneighbor external filter-list 1 out ! accident filter
neighbor external route-map ispout out
neighbor external prefix-list ispin in
neighbor external filter-list 2 in
neighbor external route-map ispin in
neighbor external password 7 020A0559
neighbor external maximum-prefix 120000 [warning-only]neighbor 10.200.0.1 peer-group external
!
ip route 10.60.0.0 255.255.0.0 null0 254
AS 200
AS100
10.0.0.0
A
B
10.60.0.0/16
10.200.0.0
.1
.2
AS 100 is acustomer
of AS 200
BGP Template eBGP peers
-
5/24/2018 BGP Tutorial
109/213
109109109 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
BGP damping use RIPE-229 parameters Remove private ASes from announcements
Common omission today
Use extensive filters, with backup
Use as-path filters to backup prefix-listsUse route-maps for policy
Use password agreed between you and peer on eBGPsession
Use maximum-prefix tracking
Router will warn you if there are sudden changes in BGP tablesize, bringing down eBGP if necessary
More BGP defaults
-
5/24/2018 BGP Tutorial
110/213
110110110 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Log neighbour changes
bgp log-neighbor-changes
Enable deterministic MED
bgp deterministic-med
Otherwise bestpath could be different every time BGPsession is reset
Make BGP admin distance higher than any IGP
distance bgp 200 200 200
BGP for Internet Service Providers
-
5/24/2018 BGP Tutorial
111/213
111111111 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
BGP Basics (quick recap)
Scaling BGP
Deploying BGP in an ISP network
Multihoming Examples
-
5/24/2018 BGP Tutorial
112/213
112 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Multihoming
MultihomingDefinition
-
5/24/2018 BGP Tutorial
113/213
113113113 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
More than one link external to the localnetwork
two or more links to the same ISP
two or more links to different ISPs Usually two external facing routers
one router gives link and provider redundancyonly
AS Numbers
-
5/24/2018 BGP Tutorial
114/213
114114114 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
An Autonomous System Number isrequired by BGP
Obtained from upstream ISP or RegionalRegistry
Necessary when you have links to morethan one ISP or exchange point
Configuring Policy
-
5/24/2018 BGP Tutorial
115/213
115115115 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Three BASIC Principles
prefix-lists to filter prefixes
filter-lists to filterASNs
route-maps to apply policy
Avoids confusion!
Originating Prefixes
-
5/24/2018 BGP Tutorial
116/213
116116116 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Basic Assumptions
MUST announce assigned address block to Internet
MAY also announce subprefixes reachability is notguaranteed
RIR minimum allocation is /20
several ISPs filter RIR blocks on this boundary
called Net Police by some
Part of the Net Police prefix list
!! APNICip prefix-list FILTER permit 61.0.0.0/8 ge 9 le 20
-
5/24/2018 BGP Tutorial
117/213
117117117 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
ip prefix-list FILTER permit 202.0.0.0/7 ge 9 le 20ip prefix-list FILTER permit 210.0.0.0/7 ge 9 le 20ip prefix-list FILTER permit 218.0.0.0/7 ge 9 le 20
ip prefix-list FILTER permit 220.0.0.0/8 ge 9 le 20!! ARINip prefix-list FILTER permit 24.0.0.0/8 ge 9 le 20ip prefix-list FILTER permit 63.0.0.0/8 ge 9 le 20ip prefix-list FILTER permit 64.0.0.0/6 ge 9 le 20
ip prefix-list FILTER permit 68.0.0.0/8 ge 9 le 20ip prefix-list FILTER permit 199.0.0.0/8 ge 9 le 20ip prefix-list FILTER permit 200.0.0.0/8 ge 9 le 20ip prefix-list FILTER permit 204.0.0.0/6 ge 9 le 20ip prefix-list FILTER permit 208.0.0.0/7 ge 9 le 20ip prefix-list FILTER permit 216.0.0.0/8 ge 9 le 20!! RIPE NCC
ip prefix-list FILTER permit 62.0.0.0/8 ge 9 le 20
ip prefix-list FILTER permit 80.0.0.0/7 ge 9 le 20ip prefix-list FILTER permit 193.0.0.0/8 ge 9 le 20ip prefix-list FILTER permit 194.0.0.0/7 ge 9 le 20ip prefix-list FILTER permit 212.0.0.0/7 ge 9 le 20ip prefix-list FILTER permit 217.0.0.0/8 ge 9 le 20
Net Police prefix list issues
-
5/24/2018 BGP Tutorial
118/213
118118118 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
meant to punish ISPs who wont and dontaggregate
impacts legitimate multihoming
impacts regions where domestic backbone isunavailable or costs $$$ compared with international
bandwidth hard to maintain requires updating when RIRs start
allocating from new address blocks
dont do it unless consequences understood and youare prepared to keep it current
-
5/24/2018 BGP Tutorial
119/213
119 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Multihoming Options
Multihoming Scenarios
-
5/24/2018 BGP Tutorial
120/213
120120120 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Stub network
Multi-homed stub network
Multi-homed network
Configuration Options
Stub Network
-
5/24/2018 BGP Tutorial
121/213
121121121 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
No need for BGP
Point static default to upstream ISP
Upstream ISP advertises stub network
Policy confined within upstream ISPs policy
AS100
AS101
Multi-homed Stub Network
-
5/24/2018 BGP Tutorial
122/213
122122122 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Use BGP (not IGP or static) to loadshare
Use private AS (ASN > 64511)
Upstream ISP advertises stub network
Policy confined within upstream ISPs policy
AS100
AS65530
Multi-Homed Network
Global Internet
-
5/24/2018 BGP Tutorial
123/213
123123123 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Many situations possible
multiple sessions to same ISP
secondary for backup only
load-share between primary and secondary
selectively use different ISPs
AS300 AS200
AS100
Private-AS Application
65001
-
5/24/2018 BGP Tutorial
124/213
124124124 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Applications
ISP with single-homed customers(RFC2270)
corporate networkwith severalregions andconnections to theInternet only in thecore
1880
193.1.34.0/24 65003193.2.35.0/24
65002193.0.33.0/24
65001193.0.32.0/24
A
193.1.32.0/22 1880
B
C
Private-AS Removal
-
5/24/2018 BGP Tutorial
125/213
125125125 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
neighbor x.x.x.x remove-private-AS
Rules:
available for eBGP neighbors only
if the update has AS_PATH made up of private-AS numbers, the
private-AS will be droppedif the AS_PATH includes private and public AS numbers, private ASnumber will not be removedit is a configuration error!
if AS_PATH contains the AS number of the eBGP neighbor, theprivate-AS numbers will not be removed
if used with confederations, it will work as long as the private AS
numbers are after the confederation portion of the AS_PATH
-
5/24/2018 BGP Tutorial
126/213
126 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Two links to the same ISP
With Redundancy and Loadsharing
Two links to the same ISP (withredundancy)
-
5/24/2018 BGP Tutorial
127/213
127127127 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
AS 109 AS 65534
AACC
AS109 removes private AS and any customersubprefixes from Internet announcement
DD
EE BB
Link one
Link two
Loadsharing to the same ISP
-
5/24/2018 BGP Tutorial
128/213
128128128 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Announce /19 aggregate on each link
Split /19 and announce as two /20s, one on each link
basic inbound loadsharing
assumes equal circuit capacity and even spread of traffic across
address block
Vary the split until perfect loadsharing achieved
Accept the default from upstream
basic outbound loadsharing by nearest exit
okay in first approx as most ISP and end-site traffic is inbound
Two links to the same ISP
Router A Configuration
-
5/24/2018 BGP Tutorial
129/213
129129129 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
grouter bgp 65534
network 221.10.0.0 mask 255.255.224.0
network 221.10.0.0 mask 255.255.240.0
neighbor 222.222.10.2 remote-as 109
neighbor 222.222.10.2 prefix-list routerC out
neighbor 222.222.10.2 prefix-list default in
!ip prefix-list defaultpermit 0.0.0.0/0
ip prefix-list routerCpermit 221.10.0.0/20
ip prefix-list routerCpermit 221.10.0.0/19
!
ip route 221.10.0.0 255.255.240.0 null0
ip route 221.10.0.0 255.255.224.0 null0
Router B configuration is similar but with the other /20
Two links to the same ISP
Router C Configuration
-
5/24/2018 BGP Tutorial
130/213
130130130 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
router bgp 109
neighbor 222.222.10.1 remote-as 65534
neighbor 222.222.10.1 default-originate
neighbor 222.222.10.1 prefix-list Customer in
neighbor 222.222.10.1 prefix-list default out
!
ip prefix-list Customerpermit 221.10.0.0/19 le 20
ip prefix-list defaultpermit 0.0.0.0/0
Router C only allows in /19 and /20 prefixes fromcustomer block
Router D configuration is identical
Loadsharing to the same ISP
-
5/24/2018 BGP Tutorial
131/213
131131131 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Loadsharing configuration is only on customerrouter
Upstream ISP has to
remove customer subprefixes from externalannouncements
remove private AS from external announcements
Could also use BGP communities
-
5/24/2018 BGP Tutorial
132/213
132 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Two links to the same ISP
Multiple Dualhomed Customers
(RFC2270)
Multiple Dualhomed Customers(RFC2270)
-
5/24/2018 BGP Tutorial
133/213
133133133 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
AS 109AS 65534A1A1
CC
AS109 removes private AS andany customer subprefixes from
Internet announcement
DDEE
B1B1
AS 65534
A2A2
B2B2
AS 65534A3A3
B3B3
Multiple Dualhomed Customers
C i
-
5/24/2018 BGP Tutorial
134/213
134134134 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Customer announcements as per previousexample
Use the sameprivate AS for each customer
documented in RFC2270
address space is not overlapping
each customer hears default only
Router Anand Bnconfiguration same as Router
A and B previously
Two links to the same ISP
Router A1 Configurationb 65534
-
5/24/2018 BGP Tutorial
135/213
135135135 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
router bgp 65534
network 221.10.0.0 mask 255.255.224.0
network 221.10.0.0 mask 255.255.240.0
neighbor 222.222.10.2 remote-as 109
neighbor 222.222.10.2 prefix-list routerC out
neighbor 222.222.10.2 prefix-list default in
!ip prefix-list defaultpermit 0.0.0.0/0
ip prefix-list routerCpermit 221.10.0.0/20
ip prefix-list routerCpermit 221.10.0.0/19
!
ip route 221.10.0.0 255.255.240.0 null0
ip route 221.10.0.0 255.255.224.0 null0
Router B1 configuration is similar but for the other /20
Multiple Dualhomed Customers
Router C Configurationt b 109
-
5/24/2018 BGP Tutorial
136/213
136136136 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
router bgp 109
neighbor bgp-customers peer-group
neighbor bgp-customers remote-as 65534
neighbor bgp-customers default-originate
neighbor bgp-customers prefix-list default out
neighbor 222.222.10.1 peer-groupbgp-customers
neighbor 222.222.10.1 description Customer One
neighbor 222.222.10.1 prefix-list Customer1 in
neighbor 222.222.10.9 peer-groupbgp-customers
neighbor 222.222.10.9 description Customer Twoneighbor 222.222.10.9 prefix-list Customer2 in
Multiple Dualhomed Customers
neighbor 222.222.10.17 peer-groupbgp-customers
i hb 222 222 10 17 d i ti C t Th
-
5/24/2018 BGP Tutorial
137/213
137137137 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
neighbor 222.222.10.17 description Customer Three
neighbor 222.222.10.17 prefix-list Customer3 in
!
ip prefix-list Customer1permit 221.10.0.0/19 le 20
ip prefix-list Customer2permit 221.16.64.0/19 le 20ip prefix-list Customer3permit 221.14.192.0/19 le 20
ip prefix-list defaultpermit 0.0.0.0/0
Router C only allows in /19 and /20 prefixesfrom customer block
Router D configuration is almost identical
Multiple Dualhomed Customers
Router E Configuration
assumes customer address space is not part of
-
5/24/2018 BGP Tutorial
138/213
138138138 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
assumes customer address space is not part ofupstreams address block
router bgp 109
neighbor 222.222.10.17 remote-as 110
neighbor 222.222.10.17 remove-private-AS
neighbor 222.222.10.17 prefix-list Customers out
!
ip prefix-list Customerspermit 221.10.0.0/19
ip prefix-list Customerspermit 221.16.64.0/19
ip prefix-list Customerspermit 221.14.192.0/19
Private AS still visible inside AS109
Multiple Dualhomed Customers
If customers prefixes come from
ISP dd bl k
-
5/24/2018 BGP Tutorial
139/213
139139139 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
ISPs address blockdo NOT announce them to the Internet
announce ISP aggregate only
Router E configuration:router bgp 109
neighbor 222.222.10.17 remote-as 110
neighbor 222.222.10.17 prefix-listmy-aggregate out
!ip prefix-listmy-aggregatepermit 221.8.0.0/13
-
5/24/2018 BGP Tutorial
140/213
140 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Two links to different ISPs
With Redundancy
Two links to different ISPs (withredundancy)
A /19 t h li k
-
5/24/2018 BGP Tutorial
141/213
141141141 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Announce /19 aggregate on each link
Split /19 and announce as two /20s, one oneach link
basic inbound loadsharing
When one link fails, the announcement of the/19 aggregate via the other ISP ensurescontinued connectivity
Two links to different ISPs (withredundancy)
Internet
-
5/24/2018 BGP Tutorial
142/213
142142142 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
AS 109 AS 108
AS 107
CC DD
Announce second
/20 and /19 block
Internet
Announce first
/20 and /19 blockBBAA
Two links to different ISPs (withredundancy)
Router A Configurationrouter bgp 107
-
5/24/2018 BGP Tutorial
143/213
143143143 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
router bgp 107
network 221.10.0.0 mask 255.255.224.0
network 221.10.0.0 mask 255.255.240.0
neighbor 222.222.10.1 remote-as 109
neighbor 222.222.10.1 prefix-list firstblock out
neighbor 222.222.10.1 prefix-list default in
!
ip prefix-list default permit 0.0.0.0/0
!
ip prefix-list firstblockpermit 221.10.0.0/20ip prefix-list firstblockpermit 221.10.0.0/19
Two links to different ISPs (withredundancy)
Router B Configurationrouter bgp 107
-
5/24/2018 BGP Tutorial
144/213
144144144 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
router bgp 107
network 221.10.0.0 mask 255.255.224.0
network 221.10.16.0 mask 255.255.240.0
neighbor 220.1.5.1 remote-as 108
neighbor 220.1.5.1 prefix-list secondblock out
neighbor 220.1.5.1 prefix-list default in
!
ip prefix-list defaultpermit 0.0.0.0/0
!
ip prefix-list secondblockpermit 221.10.16.0/20ip prefix-list secondblockpermit 221.10.0.0/19
-
5/24/2018 BGP Tutorial
145/213
145 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Two links to different ISPsMore Controlled Loadsharing
Loadsharing with different ISPs
Announce /19 aggregate on each link
O fi t li k /19 l
-
5/24/2018 BGP Tutorial
146/213
146146146 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
On first link, announce /19 as normal
On second link, announce /19 with longer ASPATH, and announce one /20 subprefix
controls loadsharing between upstreams and theInternet
Vary the subprefix size and AS PATH lengthuntil perfect loadsharing achieved
Still require redundancy!
Loadsharing with different ISPs
Internet
-
5/24/2018 BGP Tutorial
147/213
147147147 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
AS 109 AS 108
AS 107
CC DD
Announce /20 subprefix, and
/19 block with longer AS pathAnnounce /19 block
BBAA
Loadsharing with different ISPs
-
5/24/2018 BGP Tutorial
148/213
148148148 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Router A Configurationrouter bgp 107
network 221.10.0.0 mask 255.255.224.0
neighbor 222.222.10.1 remote-as 109
neighbor 222.222.10.1 prefix-list default inneighbor 222.222.10.1 prefix-list aggregate out
!
ip prefix-list aggregatepermit 221.10.0.0/19
Loadsharing with different ISPs
Router B Configuration
-
5/24/2018 BGP Tutorial
149/213
149149149 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Router B Configuration
router bgp 107
network 221.10.0.0 mask 255.255.224.0
network 221.10.16.0 mask 255.255.240.0
neighbor 220.1.5.1 remote-as 108
neighbor 220.1.5.1 prefix-list default in
neighbor 220.1.5.1 prefix-list subblocks out
neighbor 220.1.5.1 route-map routerD out
!
..next slide..
Loadsharing with different ISPs
-
5/24/2018 BGP Tutorial
150/213
150150150 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
route-map routerDpermit 10
match ip address prefix-list aggregate
set as-path prepend 107 107
route-map routerDpermit 20!
ip prefix-list subblockspermit 221.10.0.0/19 le 20
ip prefix-list aggregatepermit 221.10.0.0/19
-
5/24/2018 BGP Tutorial
151/213
151 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Service Provider Multihoming
Service Provider Multihoming
Previous examples dealt with loadsharingi b d t ffi
-
5/24/2018 BGP Tutorial
152/213
152152152 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Previous examples dealt with loadsharinginbound traffic
What about outbound?
ISPs strive to balance traffic flows in both
directionsBalance link utilisation
Try and keep most traffic flows symmetric
Service Provider Multihoming
Balancing outbound traffic requiresi b d ti i f ti
-
5/24/2018 BGP Tutorial
153/213
153153153 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
a a c g outbou d t a c equ esinbound routing information
Common solution is full routing table
Rarely necessary the routing mallet to try
solve loadsharing problemsKeep It Simple (KISS) is often easier (and $$$cheaper) than carrying n-copies of the fullrouting table
Service Provider Multihoming
E l
-
5/24/2018 BGP Tutorial
154/213
154154154 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Examples
One upstream, one local peer
One upstream, local exchange point
Two upstreams, one local peer
All examples require BGP and a public ASN
-
5/24/2018 BGP Tutorial
155/213
155 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Service Provider MultihomingOne Upstream, One local peerOne Upstream, One local peer
One Upstream, One Local Peer
-
5/24/2018 BGP Tutorial
156/213
156156156 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Announce /19 aggregate on each link
Accept default route only from upstream
Either 0.0.0.0/0 or a network which can be used asdefault
Accept all routes from local peer
One Upstream, One Local Peer
Upstream ISP
AS107
-
5/24/2018 BGP Tutorial
157/213
157157157 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
AS 109
CC
AA
AS107
Local Peer
AS108
One Upstream, One Local Peer
Router A Configuration
router bgp 109
k 221 10 0 0 k 255 255 224 0
-
5/24/2018 BGP Tutorial
158/213
158158158 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
network 221.10.0.0 mask 255.255.224.0
neighbor 222.222.10.2 remote-as 108
neighbor 222.222.10.2 prefix-listmy-block out
neighbor 222.222.10.2 prefix-listAS108-peer in
!
ip prefix-listAS108-peerpermit 222.5.16.0/19
ip prefix-listAS108-peerpermit 221.240.0.0/20
ip prefix-listmy-blockpermit 221.10.0.0/19
!
ip route 221.10.0.0 255.255.224.0 null0
One Upstream, One Local Peer
Router A Alternative Configuration
router bgp 109
t k 221 10 0 0 k 255 255 224 0
-
5/24/2018 BGP Tutorial
159/213
159159159 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
network 221.10.0.0 mask 255.255.224.0
neighbor 222.222.10.2 remote-as 108
neighbor 222.222.10.2 prefix-listmy-block out
neighbor 222.222.10.2 filter-list 10 in
!
ip as-path access-list 10permit ^(108_)+$
!
ip prefix-listmy-blockpermit 221.10.0.0/19
!
ip route 221.10.0.0 255.255.224.0 null0
One Upstream, One Local Peer
Router C Configurationrouter bgp 109
-
5/24/2018 BGP Tutorial
160/213
160160160 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
network 221.10.0.0 mask 255.255.224.0
neighbor 222.222.10.1 remote-as 107
neighbor 222.222.10.1 prefix-list default in
neighbor 222.222.10.1 prefix-listmy-block out!
ip prefix-listmy-blockpermit 221.10.0.0/19
ip prefix-list defaultpermit 0.0.0.0/0
!
ip route 221.10.0.0 255.255.224.0 null0
One Upstream, One Local Peer
Two configurations possible for Router A
-
5/24/2018 BGP Tutorial
161/213
161161161 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Filter-lists assume peer knows what they aredoing
Prefix-list higher maintenance, but safer Local traffic goes to and from local peer,
everything else goes to upstream
-
5/24/2018 BGP Tutorial
162/213
162 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Service Provider MultihomingOne Upstream, Local Exchange PointOne Upstream, Local Exchange Point
One Upstream, Local Exchange Point
Announce /19 aggregate to every
-
5/24/2018 BGP Tutorial
163/213
163163163 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Announce /19 aggregate to everyneighbouring AS
Accept default route only from upstream
Either 0.0.0.0/0 or a network which can be used asdefault
Accept all routes from IXP peers
One Upstream, Local Exchange Point
Upstream ISP
AS107
-
5/24/2018 BGP Tutorial
164/213
164164164 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
AS 109
CC
AA
IXP
One Upstream, Local Exchange Point
Router A Configuration
interface fastethernet 0/0description Exchange Point LAN
-
5/24/2018 BGP Tutorial
165/213
165165165 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
ip address 220.5.10.1 mask 255.255.255.224
ip verify unicast reverse-path
no ip directed-broadcast
no ip proxy-arp
no ip redirects!
router bgp 109
network 221.10.0.0 mask 255.255.224.0
neighbor ixp-peers peer-group
neighbor ixp-peers soft-reconfiguration in
neighbor ixp-peers prefix-listmy-block out..next slide
One Upstream, Local Exchange Point
neighbor 220.5.10.2 remote-as 100
neighbor 222.5.10.2 peer-group ixp-peers
neighbor 222.5.10.2 prefix-listpeer100 in
-
5/24/2018 BGP Tutorial
166/213
166166166 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
neighbor 220.5.10.3 remote-as 101
neighbor 222.5.10.3 peer-group ixp-peers
neighbor 222.5.10.3 prefix-listpeer101 in
neighbor 220.5.10.4 remote-as 102
neighbor 222.5.10.4 peer-group ixp-peers
neighbor 222.5.10.4 prefix-listpeer102 in
neighbor 220.5.10.5 remote-as 103
neighbor 222.5.10.5 peer-group ixp-peers
neighbor 222.5.10.5 prefix-listpeer103 in
..next slide
One Upstream, Local Exchange Point
ip route 221 10 0 0 255 255 224 0 null0
-
5/24/2018 BGP Tutorial
167/213
167167167 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
ip route 221.10.0.0 255.255.224.0 null0
!
ip prefix-listmy-blockpermit 221.10.0.0/19
ip prefix-listpeer100permit 222.0.0.0/19
ip prefix-listpeer101permit 222.30.0.0/19
ip prefix-listpeer102permit 222.12.0.0/19
ip prefix-listpeer103permit 222.18.128.0/19
!
One Upstream, Local Exchange Point
Router C Configurationrouter bgp 109
-
5/24/2018 BGP Tutorial
168/213
168168168 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
network 221.10.0.0 mask 255.255.224.0
neighbor 222.222.10.1 remote-as 107
neighbor 222.222.10.1 prefix-list default in
neighbor 222.222.10.1 prefix-listmy-block out
!
ip prefix-listmy-blockpermit 221.10.0.0/19
ip prefix-list defaultpermit 0.0.0.0/0
!
ip route 221.10.0.0 255.255.224.0 null0
One Upstream, Local Exchange Point
Note Router A configuration
-
5/24/2018 BGP Tutorial
169/213
169169169 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
g
Prefix-list higher maintenance, but safer
uRPF on the FastEthernet interface
IXP traffic goes to and from local IXP,everything else goes to upstream
-
5/24/2018 BGP Tutorial
170/213
170 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Service Provider MultihomingTwo Upstreams, One local peerTwo Upstreams, One local peer
Two Upstreams, One Local Peer
Announce /19 aggregate on each link
-
5/24/2018 BGP Tutorial
171/213
171171171 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Announce /19 aggregate on each link
Accept default route only from upstreams
Either 0.0.0.0/0 or a network which can be used asdefault
Accept all routes from local peer
Two Upstreams, One Local Peer
Upstream ISP
Upstream ISPAS107
-
5/24/2018 BGP Tutorial
172/213
172172172 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
AS 109
CC
AA
p
AS106
Local Peer
AS108 DD
Two Upstreams, One Local Peer
R t A
-
5/24/2018 BGP Tutorial
173/213
173173173 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Router A
Same routing configuration as in example withone upstream and one local peer
Same hardware configuration
Two Upstreams, One Local Peer
Router C Configurationrouter bgp 109
network 221 10 0 0 mask 255 255 224 0
-
5/24/2018 BGP Tutorial
174/213
174174174 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
network 221.10.0.0 mask 255.255.224.0
neighbor 222.222.10.1 remote-as 107
neighbor 222.222.10.1 prefix-list default in
neighbor 222.222.10.1 prefix-listmy-block out
!
ip prefix-listmy-blockpermit 221.10.0.0/19
ip prefix-list defaultpermit 0.0.0.0/0
!
ip route 221.10.0.0 255.255.224.0 null0
Two Upstreams, One Local Peer
Router D Configurationrouter bgp 109
network 221.10.0.0 mask 255.255.224.0
-
5/24/2018 BGP Tutorial
175/213
175175175 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
network 221.10.0.0 mask 255.255.224.0
neighbor 222.222.10.5 remote-as 106
neighbor 222.222.10.5 prefix-list default in
neighbor 222.222.10.5 prefix-listmy-block out
!
ip prefix-listmy-blockpermit 221.10.0.0/19
ip prefix-list defaultpermit 0.0.0.0/0
!
ip route 221.10.0.0 255.255.224.0 null0
Two Upstreams, One Local Peer
This is the simple configuration for Router C andD
-
5/24/2018 BGP Tutorial
176/213
176176176 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Traffic out to the two upstreams will take nearestexit
Inexpensive routers required
This is not useful in practice especially for internationallinks
Loadsharing needs to be better
Two Upstreams, One Local Peer
Better configuration options:
A t f ll ti f b th t
-
5/24/2018 BGP Tutorial
177/213
177177177 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Accept full routing from both upstreams
Expensive & unnecessary!
Accept default from one upstream and someroutes from the other upstream
The way to go!
Two Upstreams, One Local Peer:Full Routes
Router C Configuration
router bgp 109
network 221.10.0.0 mask 255.255.224.0
-
5/24/2018 BGP Tutorial
178/213
178178178 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
neighbor 222.222.10.1 remote-as 107
neighbor 222.222.10.1 prefix-list rfc1918-deny in
neighbor 222.222.10.1 prefix-listmy-block out
neighbor 222.222.10.1 route-mapAS107-loadshare in
!
ip prefix-listmy-blockpermit 221.10.0.0/19
! See earlier in presentation for RFC1918 list
..next slide
Two Upstreams, One Local Peer:Full Routes
ip route 221.10.0.0 255.255.224.0 null0
!
ip as-path access-list 10 permit ^(107_)+$
-
5/24/2018 BGP Tutorial
179/213
179179179 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
ip as-path access-list 10 permit ^(107_)+_[0-9]+$
!
route-mapAS107-loadsharepermit 10
match ip as-path 10
set local-preference 120
route-mapAS107-loadsharepermit 20
set local-preference 80
!
Two Upstreams, One Local Peer:Full Routes
Router D Configurationrouter bgp 109
-
5/24/2018 BGP Tutorial
180/213
180180180 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
network 221.10.0.0 mask 255.255.224.0
neighbor 222.222.10.5 remote-as 106
neighbor 222.222.10.5 prefix-list rfc1918-deny in
neighbor 222.222.10.5 prefix-listmy-block out
!
ip prefix-listmy-blockpermit 221.10.0.0/19
! See earlier in presentation for RFC1918 list
Two Upstreams, One Local Peer:Full Routes
Router C configuration:
Accept full routes from AS107
Tag prefixes originated by AS107 and AS107s neighbouringAS i h l l f 120
-
5/24/2018 BGP Tutorial
181/213
181181181 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
ASes with local preference 120
Traffic to those ASes will go over AS107 link
Remaining prefixes tagged with local preference of 80
Traffic to other all other ASes will go over the link toAS106
Router D configuration same as Router C withoutthe route-map
Two Upstreams, One Local Peer:Full Routes
Full routes from upstreamsExpensive needs 128Mbytes RAM today
-
5/24/2018 BGP Tutorial
182/213
182182182 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Need to play preference games
Previous example is only an example real life
will need improved fine-tuning!
Previous example doesnt consider inboundtraffic see earlier presentation for examples
Two Upstreams, One Local Peer:Partial Routes
Router C Configuration
router bgp 109network 221.10.0.0 mask 255.255.224.0
neighbor 222 222 10 1 remote-as 107
-
5/24/2018 BGP Tutorial
183/213
183183183 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
neighbor 222.222.10.1 remote as 107
neighbor 222.222.10.1 prefix-list rfc1918-nodef-deny in
neighbor 222.222.10.1 prefix-listmy-block out
neighbor 222.222.10.1 filter-list 10 inneighbor 222.222.10.1 route-map tag-default-low in
!
ip prefix-listmy-blockpermit 221.10.0.0/19
ip prefix-list default permit 0.0.0.0/0
..next slide
Two Upstreams, One Local Peer:Partial Routes
! See earlier presentation for RFC1918 list
!
ip route 221.10.0.0 255.255.224.0 null0
!
-
5/24/2018 BGP Tutorial
184/213
184184184 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
ip as-path access-list 10permit ^(107_)+$
ip as-path access-list 10permit ^(107_)+_[0-9]+$
!route-map tag-default-low permit 10
match ip address prefix-list default
set local-preference 80
route-map tag-default-low permit 20
!
Two Upstreams, One Local Peer:Partial Routes
Router D Configurationrouter bgp 109
network 221.10.0.0 mask 255.255.224.0
-
5/24/2018 BGP Tutorial
185/213
185185185 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
neighbor 222.222.10.5 remote-as 106
neighbor 222.222.10.5 prefix-list default in
neighbor 222.222.10.5 prefix-listmy-block out
!
ip prefix-listmy-blockpermit 221.10.0.0/19
ip prefix-list defaultpermit 0.0.0.0/0
!
ip route 221.10.0.0 255.255.224.0 null0
Two Upstreams, One Local Peer:Partial Routes
Router C configuration:
Accept full routes from AS107
(or get them to send less)
-
5/24/2018 BGP Tutorial
186/213
186186186 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
( g )
Filter ASNs so only AS107 and AS107s neighbouring ASesare accepted
Allow default, and set it to local preference 80
Traffic to those ASes will go over AS107 link
Traffic to other all other ASes will go over the link to AS106
If AS106 link fails, backup via AS107 and vice-versa
Two Upstreams, One Local Peer:Partial Routes
Partial routes from upstreamsNot expensive only carry the routes necessary forloadsharing
-
5/24/2018 BGP Tutorial
187/213
187187187 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
loadsharing
Need to filter on AS paths
Previous example is only an example real life willneed improved fine-tuning!
Previous example doesnt consider inbound traffic see earlier presentation for examples
Two Upstreams, One Local Peer:Partial Routes
When upstreams cannot or will notannounce default route
-
5/24/2018 BGP Tutorial
188/213
188188188 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Because of operational policy against usingdefault-originate on BGP peering
Solution is to use IGP to propagate defaultfrom the edge/peering routers
Two Upstreams, One Local Peer:Partial Routes
Router C Configurationrouter ospf 109
default-information originate metric 30
passive-interface Serial 0/0
-
5/24/2018 BGP Tutorial
189/213
189189189 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
!
router bgp 109
network 221.10.0.0 mask 255.255.224.0
neighbor 222.222.10.1 remote-as 107
neighbor 222.222.10.1 prefix-list rfc1918-deny in
neighbor 222.222.10.1 prefix-listmy-block out
neighbor 222.222.10.1 filter-list 10 in
!
..next slide
Two Upstreams, One Local Peer:Partial Routes
ip prefix-listmy-blockpermit 221.10.0.0/19
! See earlier presentation for RFC1918 list
!
-
5/24/2018 BGP Tutorial
190/213
190190190 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
!
ip route 221.10.0.0 255.255.224.0 null0
ip route 0.0.0.0 0.0.0.0 serial 0/0 254
!
ip as-path access-list 10permit ^(107_)+$
ip as-path access-list 10permit ^(107_)+_[0-9]+$
!
Two Upstreams, One Local Peer:Partial Routes
Router D Configurationrouter ospf 109
default-information originate metric 10
passive-interface Serial 0/0
-
5/24/2018 BGP Tutorial
191/213
191191191 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
!
router bgp 109
network 221.10.0.0 mask 255.255.224.0neighbor 222.222.10.5 remote-as 106
neighbor 222.222.10.5 prefix-list deny-all in
neighbor 222.222.10.5 prefix-listmy-block out
!
..next slide
Two Upstreams, One Local Peer:Partial Routes
ip prefix-list deny-all deny 0.0.0.0/0 le 32
ip prefix-list my-block permit 221.10.0.0/19
-
5/24/2018 BGP Tutorial
192/213
192192192 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
ip prefix listmy blockpermit 221.10.0.0/19
! See earlier presentation for RFC1918 list
!
ip route 221.10.0.0 255.255.224.0 null0
ip route 0.0.0.0 0.0.0.0 serial 0/0 254
!
Two Upstreams, One Local Peer:Partial Routes
Partial routes from upstreams
Use OSPF to determine outbound path
-
5/24/2018 BGP Tutorial
193/213
193193193 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Router D default has metric 10 primary outbound path
Router C default has metric 30 backup outbound path
Serial interface goes down, static default is removedfrom routing table, OSPF default withdrawn
-
5/24/2018 BGP Tutorial
194/213
194 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Service Provider MultihomingCase StudyCase Study
Case StudyRequirements (1)
ISP needs to multihome:
To AS5400 in Europe
-
5/24/2018 BGP Tutorial
195/213
195195195 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
To AS5400 in Europe
To AS2516 in Japan
/19 allocated by APNIC
AS 17660 assigned by APNIC
1Mbps circuits to both upstreams
Case StudyRequirements (2)
ISP wants:
Symmetric routing and equal link utilisation in and out( l ibl )
-
5/24/2018 BGP Tutorial
196/213
196196196 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
(as close as possible)
international circuits are expensive
Has two 2600 border routers with 64Mbytes memory
Cannot afford to upgrade memory or hardware on borderrouters or internal routers
Philip, make it work, please
Case Study
Upstream ISPAS2516
Upstream ISP
AS5400
-
5/24/2018 BGP Tutorial
197/213
197197197 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
AS 17660
AA BB
ISP Core
Allocated /19 from APNIC
Circuit to AS5400 is 1Mbps, circuit to AS2516 is 1Mbps
Case Study
Both providers stated that routers with128Mbytes memory required for AS17660 tomultihome
Wrong!
-
5/24/2018 BGP Tutorial
198/213
198198198 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Wrong!
Full routing table is rarely required or desired
Solution:Accept default from one upstream
Accept partial prefixes from the other
Case StudyInbound Loadsharing
First cut: Went to a few US LookingGlasses
Checked the AS path to AS5400
-
5/24/2018 BGP Tutorial
199/213
199199199 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
p
Checked the AS path to AS2516
AS2516 was one hop closerSent AS-PATH prepend of one AS on AS2516peering
Case StudyInbound Loadsharing
RefinementDid not need any
First cut worked seeing on average 600kbps inbound
-
5/24/2018 BGP Tutorial
200/213
200200200 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
First cut worked, seeing on average 600kbps inboundon each circuit
Does vary according to time of day, but this is asbalanced as it can get, given customer profile
J
Case StudyOutbound Loadsharing
First cut:Requested default from AS2516
Requested full routes from AS5400
-
5/24/2018 BGP Tutorial
201/213
201201201 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Then looked at my Routing Report
Picked the top 5 ASNs and created a filter-list
If 701, 1, 7018, 1239 or 7046 are in AS-PATH, prefixes arediscarded
Allowed prefixes originated by AS5400 and up to two AS hopsaway
Resulted in 32000 prefixes being accepted in AS17660
Case StudyOutbound Loadsharing
Refinement
32000 prefixes quite a lot, seeing more outbound traffic on
the AS5400 pathTraffic was very asymmetric
out through AS5400, in through AS2516
-
5/24/2018 BGP Tutorial
202/213
202202202 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
Added the next 3 ASNs from the Top 20 list
209, 2914 and 3549
Now seeing 14000 prefixes
Traffic is now evenly loadshared outbound
Around 200kbps on average
Mostly symmetric
Case StudyConfiguration Router A
router ospf 100
log-adjacency-changes
passive-interface default
no passive-interface Ethernet0/0
default-information originate metric 20
!
-
5/24/2018 BGP Tutorial
203/213
203203203 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
!
router bgp 17660
no synchronizationno bgp fast-external-fallover
bgp log-neighbor-changes
bgp deterministic-med
...next slide
Case StudyConfiguration Router A
neighbor 166.49.165.13 remote-as 5400
neighbor 166.49.165.13 description eBGP multihop to AS5400
neighbor 166.49.165.13 ebgp-multihop 5
neighbor 166.49.165.13 update-source Loopback0
neighbor 166.49.165.13 prefix-list in-filter in
neighbor 166.49.165.13 prefix-list out-filter out
-
5/24/2018 BGP Tutorial
204/213
204204204 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
neighbor 166.49.165.13 filter-list 1 in
neighbor 166.49.165.13 filter-list 3 out
!
prefix-list in-filter deny r f c 1 9 1 8 e t c in
prefix-list out-filter permit 202.144.128.0/19
!
ip route 0.0.0.0 0.0.0.0 serial 0/0 254
...next slide
Case StudyConfiguration Router A
ip as-path access-list 1 deny _701_
ip as-path access-list 1 deny _1_
ip as-path access-list 1 deny _7018_ip as-path access-list 1 deny _1239_
ip as-path access-list 1 deny _7046_
ip as-path access-list 1 deny 209
-
5/24/2018 BGP Tutorial
205/213
205205205 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
p p y _ _
ip as-path access-list 1 deny _2914_
ip as-path access-list 1 deny _3549_
ip as-path access-list 1 permit _5400$
ip as-path access-list 1 permit _5400_[0-9]+$
ip as-path access-list 1 permit _5400_[0-9]+_[0-9]+$
ip as-path access-list 1 deny .*
ip as-path access-list 3 permit ^$
!
Case StudyConfiguration Router B
router ospf 100
log-adjacency-changes
passive-interface default
no passive-interface Ethernet0/0
default-information originate
-
5/24/2018 BGP Tutorial
206/213
206206206 2002, Cisco Systems, Inc. All rights reserved.AfNOG 3
!
router bgp 17660
no synchronization
no auto-summary
no bgp fast-external-fallover
...next slide
Case StudyConfiguration Router