BGP 1
BGP 1
BGP 1
ISP/IXP Workshops
BGP Attributes
BGP Path Selection
Applying Policy
Next
... Hop AS Path MED ... ...
Sequence of ASes a
route has traversed AS 200 AS 100
170.10.0.0/16 180.10.0.0/16
Used for:
Loop detection 180.10.0.0/16 300 200 100
Applying policy 170.10.0.0/16 300 200
AS 300
AS 400
150.10.0.0/16
AS 200 AS 100
170.10.0.0/16 180.10.0.0/16
150.10.1.1 150.10.1.2
iBGP C
AS 200
A B
150.10.0.0/16 eBGP AS 300
150.10.0.0/16 150.10.1.1
160.10.0.0/16 150.10.1.1
AS 100
160.10.0.0/16 eBGP – address of external neighbour
iBGP – NEXT_HOP from eBGP
iBGP C
Loopback
120.1.254.3/32
Loopback B
120.1.254.2/32
AS 300
D
120.1.1.0/24 120.1.254.2
Next hop is ibgp router loopback address 120.1.2.0/23 120.1.254.3
AS 200
120.68.1.0/24 150.1.1.3
C
150.1.1.1 eBGP between Router A
and Router C
eBGP between RouterA and
150.1.1.2 150.1.1.3 RouterB
A B 120.68.1/24 prefix has next
hop address of 150.1.1.3 –
this is passed on to RouterC
120.68.1.0/24 instead of 150.1.1.2
AS 201
More efficient
No extra config needed
ISP Workshops © 2008 Cisco Systems, Inc. All rights reserved. 10
Next Hop Best Practice
AS 100
160.10.0.0/16
AS 200 AS 300
D 500 800 E
A B
160.10.0.0/16 500
AS 400
> 160.10.0.0/16 800
C
Local to an AS – non-transitive
Default local preference is 100 (IOS)
Configuration of Router B:
router bgp 400
neighbor 120.5.1.1 remote-as 300
neighbor 120.5.1.1 route-map local-pref in
!
route-map local-pref permit 10
match ip address prefix-list MATCH
set local-preference 800
!
ip prefix-list MATCH permit 160.10.0.0/16
AS 200
AS 201
Configuration of Router B:
router bgp 400
neighbor 120.5.1.1 remote-as 200
neighbor 120.5.1.1 route-map set-med out
!
route-map set-med permit 10
match ip address prefix-list MATCH
set metric 1000
!
ip prefix-list MATCH permit 120.68.1.0/24
B
AS4, LOCAL_PREF
Backup link, but RPF 100, weight 100
still needs to work A AS1
32 bit integer
Represented as two 16 bit integers (RFC1998)
Common format is <local-ASN>:xx
0:0 to 0:65535 and 65535:0 to 65535:65535 are reserved
A B
AS 100 AS 200
160.10.0.0/16 170.10.0.0/16
A B
AS 100 AS 200
160.10.0.0/16 170.10.0.0/16
105.7.X.X D
A
105.7.0.0/16
AS 100 AS 200 G
B E
C F
AS100 announces aggregate and subprefixes
Intention is to improve loadsharing by leaking subprefixes
Subprefixes marked with no-export community
Router G in AS200 does not announce prefixes with no-export
community set
ISP Workshops © 2008 Cisco Systems, Inc. All rights reserved. 28
No-Peer Community
105.7.0.0/16 upstream
105.7.X.X No-Peer D C&D&E are
peers e.g.
Tier-1s
105.7.0.0/16
upstream
E
A
upstream
B
Inbound or Outbound
Based upon network numbers (using familiar IPv4
address/mask format)
Using access-lists for filtering prefixes was deprecated
long ago
Strongly discouraged!
Syntax:
[no] ip prefix-list list-name [seq seq-value]
permit|deny network/len [ge ge-value] [le le-value]
network/len: The prefix and its length
ge ge-value: "greater than or equal to”
le le-value: "less than or equal to”
Example Configuration
router bgp 100
network 105.7.0.0 mask 255.255.0.0
neighbor 102.10.1.1 remote-as 110
neighbor 102.10.1.1 prefix-list AS110-IN in
neighbor 102.10.1.1 prefix-list AS110-OUT out
!
ip prefix-list AS110-IN deny 218.10.0.0/16
ip prefix-list AS110-IN permit 0.0.0.0/0 le 32
ip prefix-list AS110-OUT permit 105.7.0.0/16
ip prefix-list AS110-OUT deny 0.0.0.0/0 le 32
Example Configuration:
Simple Examples
.* match anything
.+ match at least one character
^$ match routes local to this AS
_1800$ originated by AS1800
^1800_ received from AS1800
_1800_ via AS1800
_790_1800_ via AS1800 and AS790
_(1800_)+ multiple AS1800 in sequence
(used to match AS-PATH prepends)
_\(65530\)_ via AS65530 (confederations)
Example
Omitting the third line below means that prefixes not matching list-one
or list-two are dropped
Example Configuration
router bgp 100
neighbor 102.10.1.2 remote-as 200
neighbor 102.10.1.2 route-map filter-on-community in
!
route-map filter-on-community permit 10
match community 1
set local-preference 50
!
route-map filter-on-community permit 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
ISP Workshops © 2008 Cisco Systems, Inc. All rights reserved. 53
Policy Control –
Setting Communities
Example Configuration
router bgp 100
network 105.7.0.0 mask 255.255.0.0
neighbor 102.10.1.1 remote-as 200
neighbor 102.10.1.1 send-community
neighbor 102.10.1.1 route-map set-community out
!
route-map set-community permit 10
match ip address prefix-list NO-ANNOUNCE
set community no-export
!
route-map set-community permit 20
match ip address prefix-list AGGREGATE
!
ip prefix-list NO-ANNOUNCE permit 105.7.0.0/16 ge 17
ISP Workshops
ip prefix-list AGGREGATE permit 105.7.0.0/16
© 2008 Cisco Systems, Inc. All rights reserved. 54
Managing Policy Changes
ISP/IXP Workshops
Suppress Map
Used to suppress selected more-specific prefixes (e.g. defined
through a route-map) in the absence of the summary-only
keyword.
Unsuppress Map
Used to unsuppress selected more-specific prefixes per BGP
peering when the summary-only keyword is in use.
router1#sh ip bgp
BGP table version is 11, local router ID is 102.5.7.1
Status codes: s suppressed, d damped, h history, * valid, > best, i -
internal
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 102.10.0.0/16 0.0.0.0 32768 i
s> 102.10.10.0 0.0.0.0 0 32768 i
s> 102.10.11.0 0.0.0.0 0 32768 i
s> 102.10.12.0 0.0.0.0 0 32768 i
*> 102.10.33.0 0.0.0.0 0 32768 i
*> 102.10.34.0 0.0.0.0 0 32768 i
router2#sh ip bgp
BGP table version is 90, local router ID is 102.5.7.2
Status codes: s suppressed, d damped, h history, * valid, > best,
i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 102.10.0.0/16 102.5.7.1 0 100 i
*> 102.10.33.0 102.5.7.1 0 0 100 i
*> 102.10.34.0 102.5.7.1 0 0 100 i
router1#sh ip bgp
BGP table version is 11, local router ID is 102.5.7.1
Status codes: s suppressed, d damped, h history, * valid, > best,
i -internal
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 102.10.0.0/16 0.0.0.0 32768 i
s> 102.10.10.0 0.0.0.0 0 32768 i
s> 102.10.11.0 0.0.0.0 0 32768 i
s> 102.10.12.0 0.0.0.0 0 32768 i
s> 102.10.33.0 0.0.0.0 0 32768 i
s> 102.10.34.0 0.0.0.0 0 32768 i
router2#sh ip bgp
BGP table version is 90, local router ID is 102.5.7.2
Status codes: s suppressed, d damped, h history, * valid, > best,
i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 102.10.0.0/16 102.5.7.1 0 100 i
*> 102.10.10.0 102.5.7.1 0 0 100 i
*> 102.10.11.0 102.5.7.1 0 0 100 i
*> 102.10.12.0 102.5.7.1 0 0 100 i