Module 4 - Recorded Lecture - Animesh Giri
Module 4 - Recorded Lecture - Animesh Giri
Example Network
Example Network
• Access ISP
• Can provide wired/wireless
connectivity; DSL, cable,
DOCSIS, Wi-Fi, cellular etc
• Can also be a university or a
company
• Access ISPs connect to
regional ISPs
• Regional ISPs connect to tier-1 ISPs
• ~12 tier-1 ISPs -AT&T, Sprint, NTT etc.
• Access ISPs pay the regional ISPs, regional ISPs pay the tier-1 ISPs
References:
• 1989 : BGP-1 [RFC 1105]
– Replacement for EGP (1984, RFC 904)
• 1990 : BGP-2 [RFC 1163]
• 1991 : BGP-3 [RFC 1267]
• 1995 : BGP-4 [RFC 1771]
• 2006: BGP-4 [RFC 4271]
– Support for Classless Interdomain Routing (CIDR) , Route Aggregation
BGP Overview
I n th i s s e g m e n t
• Terms used in BGP
• BGP operation and messages
• BGP features
• BGP attributes
BGP - 4
• Border Gateway Protocol
• Policy-based routing protocol
• Relatively simple protocol, but configuration is complex
References:
• 1989 : BGP-1 [RFC 1105]
– Replacement for EGP (1984, RFC 904)
• 1990 : BGP-2 [RFC 1163]
• 1991 : BGP-3 [RFC 1267]
• 1995 : BGP-4 [RFC 1771]
• 2006: BGP-4 [RFC 4271]
– Support for Classless Interdomain Routing (CIDR) , Route Aggregation
• AS3 sends AS1 the list of prefixes that are reachable from AS3
• AS1 sends AS3 the list of prefixes that are reachable from AS1
• Similarly, AS1 and AS2 exchange prefix reachability information through their gateway
routers 1b and 2a
• When a gateway router receives eBGP-learned prefixes, the gateway router uses its iBGP
sessions to distribute the prefixes to the other routers in the AS
• Thus, all the routers in AS1 learn about AS3 prefixes, including the gateway router 1b
• The gateway router 1b (in AS1) can therefore re-advertise AS3’s prefixes to AS2
BGP Op e ra t i o n a n d Me s s a g e s
• Open : Establish a peering session
Establish session on
TCP port 179
• Keep Alive : Handshake at regular
intervals
BGP Attributes - 1
I n th i s s e g m e n t
• A brief look at some of the BGP attributes
BGP At tri b u t e s
• BGP Attributes
– Origin
– AS-Path
– Local Preference
– Next hop
– Attributes related to route aggregation
• Carried by BGP Update messages
Ori g i n
• Generated by the speaker that originates the associated routing information
– IGP – NLRI is interior to the originating AS
– EGP - NLRI is learnt via the EGP protocol
– INCOMPLETE – NLRI is learnt via some other means
AS_ PAT H
• List of traversed AS’s
through which the routing
information carried in the
AS 200 AS 100
150.20.0.0/16 160.30.0.0/16
UPDATE message has
passed
• Useful for loop checking and
for path-based route
selection AS 300
• Represented as
AS_SEQUENCE or
AS_SET
AS 400 160.30.0.0/16 300 200 100
150.20.0.0/16 300 200
AS_ PAT H
L OCAL _ P RE F
• Represents the advertising
speaker's degree of
preference for an advertised
route
• Higher degree of preference is
preferred
• Calculates the degree of
preference for each external
route based on the locally
configured policy
Ex a m p l e : L o c a l P r e f e re n c e
RTC#
router bgp 256
neighbor 1.1.1.1 remote-as 100
neighbor 128.213.11.2 remote-as 256
bgp default local-preference 150
RTD#
router bgp 256
neighbor 3.3.3.4 remote-as 300
neighbor 128.213.11.1 remote-as 256
bgp default local-preference 200
BGP Attributes - 2
I n th i s s e g m e n t
• BGP Attributes
– NLRI
– MED (Multi Exit Discriminator)
Ne two r k L a y e r Re a c h a b i l i t y I n f o rm a t i o n
• Contains a list of IP address prefixes and prefix lengths
• Prefixes could be advertised or withdrawn
• Example: 172.16.0.0/21, 10.10.1.0/24
Mu l t i - E x i t Di s c r i m i n a t o r
• Used by an ISPs to control the traffic being received by it’s peering points with
other ISPs
• Used when two AS connect to each other in more than one place
• All other factors being equal, exit point with lower MED is preferred
Mu l t i - E x i t Di s c r i m i n a t o r
• Use MED, if there are multiple links with a neighbor and want to tell your neighbor
where to send traffic to you
– Inter-AS policy
Su m m a ry
• BGP Attributes
– NLRI
– MED (Multi Exit Discriminator)
BITS Pilani
Pilani | Dubai | Goa | Hyderabad
iBGP vs eBGP
I n th i s s e g m e n t
• Differences between iBGP and eBGP
• BGP decision process
• BGP route selection process
i BGP an d e BGP
• eBGP – When BGP runs between 2 peers in different ASes
• iBGP – When BGP runs between 2 peers in the same AS
• iBGP and eBGP use the same messages
• However, route propagation rules are different:
– New routes learned from an eBGP peer are typically redistributed to all iBGP peers as well as all other eBGP peers
– New routes are learned from an iBGP peer are re-advertised only to eBGP peers
• All iBGP peers inside an AS need to be interconnected in a full mesh
– Issue of scaling
• iBGP sessions preserve the next hop attribute learned from eBGP peers
– There should be an internal route to the next hop, else the BGP route is unreachable
BGP De c i s i o n P r o c e s s
BGP Ro u t e S e l e c t i o n P r o c e s s
Shortest ASPATH
Lowest MED
Traffic engineering
i-BGP < e-BGP
Lowest IGP cost
to BGP egress
Lowest router ID Throw up hands and
break ties
Source: www.slideplayer.com
Su m m a ry
• Differences between iBGP and eBGP
• BGP decision process
• BGP route selection process
BITS Pilani
Pilani | Dubai | Goa | Hyderabad
RTC#
router bgp 50
bgp confederation identifier 500
bgp confederation peers 60 70
neighbor 128.213.10.1 remote-as 50 (IBGP connection within AS50)
neighbor 128.213.20.1 remote-as 50 (IBGP connection within AS50)
neighbor 129.210.11.1 remote-as 60 (BGP connection with confed peer 60)
neighbor 135.212.14.1 remote-as 70 (BGP connection with confed peer 70)
neighbor 5.5.5.5 remote-as 100 (EBGP connection to external AS100)
RTD#
router bgp 60
bgp confederation identifier 500
bgp confederation peers 50 70
neighbor 129.210.30.2 remote-as 60 (IBGP connection within AS60)
neighbor 128.213.30.1 remote-as 50(BGP connection with confed peer 50)
neighbor 135.212.14.1 remote-as 70 (BGP connection with confed peer 70)
neighbor 6.6.6.6 remote-as 600 (EBGP connection to external AS600)
Ad d i ti o n a l BGP F e a t u re s
• Communities
– Allows controlled distribution of routing information
– Group configuration
– No-export, no-advertise, no-export-subconfd
• Multiprotocol extension
– Extensions for BGP if it were to be used with other address families like IPv6
BGP Ca s e S t u d i e s
• Ref: http://www.cisco.com/c/en/us/support/docs/ip/border-gateway-protocol-bgp/
26634-bgp-toc.html
Su m m a ry
• Additional BGP features
– Route reflectors
– Confederations
– Communities
– Multiprotocol extension
BITS Pilani
Pilani | Dubai | Goa | Hyderabad
BGP Policies
I n th i s s e g m e n t
• BGP policies and what they enable
• BGP policy examples
BGP Po l i c i e s
• Route manipulation
• Route redistribution
• Route summarization
• Load balancing
• Traffic engineering
• Mechanisms
– Policies
• Prefer certain AS paths over others
• Prefer one neighbor over another for a prefix
• Make one path look better or worse than another, persuading a router to choose the seemingly
better path
Ex a m p l e - I m p o r t & E x p o r t P o l i c i e s
BGP Po l i c y - E x a m p l e
1) Influencing inbound path selection by
updating the AS_PATH attribute
• Router A advertises 172.17.1.0 to Router B
and Router E
• Which path would Router C take to forward
packets to 172.17.1.0 - [45000, 40000] or
[55000, 60000, 40000]?
• What can be done if the link between AS
45000 and AS 40000 is congested?
• Router A can influence inbound path
selection for the 172.17.1.0 network by
making the route through autonomous
system 45000 appear to be longer than the
path through autonomous system 60000
BGP Po l i c y - E x a m p l e
1) Influencing inbound path selection by updating the AS_PATH attribute
• The outbound BGP updates from Router
…
A to Router B will have their AS_PATH
router bgp 40000
neighbor 192.168.1.2 remote-as 45000
attribute modified to add AS 40000 twice
!
• AS 50000 receives updates about the
address-family ipv4 172.17.1.0 network AS 45000, with the
neighbor 192.168.1.2 activate new AS_PATH as 45000, 40000, 40000,
neighbor 192.168.1.2 route-map PREPEND and 40000
out • This is now longer than the AS-path from
network 172.17.1.0 mask 255.255.255.0 AS 55000 (unchanged at a value of
exit-address-family
55000, 60000, 40000)
!
• Devices in AS 50000 will now prefer the
route-map PREPEND permit 10
set as-path prepend 40000 40000
route through AS 55000 to forward
… packets destined to the 172.17.1.0
network.
BGP Po l i c y - E x a m p l e
2) Modifying incoming data from a neighbor
Any route received from 10.222.1.1 that
router bgp 100
matches the filter parameters set in
!
neighbor 10.222.1.1 route-map FIX-WEIGHT in
autonomous system access list 200 will
neighbor 10.222.1.1 remote-as 1 have its weight set to 200 and its local
! preference set to 250, and it will be
ip as-path access-list 200 permit ^690$ accepted.
ip as-path access-list 200 permit ^1800
!
route-map FIX-WEIGHT permit 10
match as-path 200
set local-preference 250
set weight 200
BGP Po l i c y - E x a m p l e
3) Prefix-based matching to set parameters of the update using inbound
route-maps
!
The route map named SET-LOCAL-PREF
router bgp 65100 sets the local preference of the inbound
network 10.108.0.0 prefix 172.20.0.0/16 to 120
neighbor 10.108.1.1 remote-as 65200
neighbor 10.108.1.1 route-map SET-LOCAL-PREF in
! Ref:
route-map SET-LOCAL-PREF permit 10 http://www.cisco.com/c/en/us/td/docs/ios-xm
match ip address 2 l/ios/iproute_bgp/configuration/xe-3se/3850/i
set local-preference 120 rg-xe-3se-3850-book/irg-prefix-filter.html
!
route-map SET-LOCAL-PREF permit 20 http://www.cisco.com/c/en/us/td/docs/securit
! y/asa/asa82/configuration/guide/config/route
access-list 2 permit 172.20.0.0 0.0.255.255 _maps.pdf
access-list 2 deny any
Su m m a ry
• BGP policies and what they enable
• BGP policy examples
– Influencing inbound path selection
– Modifying incoming data from a neighbor
– Prefix-based matching to set parameters of the update using inbound route-maps
BITS Pilani
Pilani | Dubai | Goa | Hyderabad
Issues in BGP
I n th i s s e g m e n t
• Protocol Oscillations
• Weak Security
• Scalability Induced problems
Ex a m p l e : P o l i c y Di s p u t e Os c i l l a t i o n s
abd
a ad
d
bcd
b
bd
cad
c
cd
Ex a m p l e : P o l i c y Di s p u t e Os c i l l a t i o n s
i. In the initial state, a, b, and c, choose
paths abd, bd, and cd respectively.
ii. When c sends its choice cd–b, upon
learning a higher ranked route b
changes from its current route bd to the
higher ranked route bcd. But, this forces
a to change to a lower ranked route ad,
because the higher ranked path abd no
longer exist.
iii. a then notices its choice ad–c. Similarly,
c changes to cad, b changes to bd.
iv. Finally, b notices its choice bd–a. And a
reverts to abd, c reverts to cd. The
system returns back to initial state, the
sequence of route updates repeats.
BGP Mi s - c o n f i g u r a t i o n s
Causes
• Accidental injection of routes into global BGP tables
• Accidental export of routes in violation of an ISP’s policy
Impact of mis-configurations
Source: “Understanding BGP Misconfiguration”, Ratul Mahajan, David Wetherall, Tom Anderson
Se c u r i t y i n BGP
• No mechanism to verify that a route learned is valid
• No support for controlling route announcements
• No support for checking if routes are policy complaint
• Use of TCP as the transport protocol
• Snooping of policy and routing information between two
ASes by an intruder
• MITM attacks
• DoS attacks
• Blackhole attack
• No mechanism to verify that traffic
actually traverses the path it should
Example of prefix hijacking
BGP variants
• S-BGP, soBGP
– Digital signatures
– S-BGP uses attestations, dynamically signed
Sc a l a b i l i t y I n d u c e d P r o b l e m s
• BGP aggregates reachability information (prefix aggregation)
– Provides scalability to BGP
– Hide fine-grained information about the reachability of destinations
– Black holes
Su m m a ry
• Protocol Oscillations
• Weak Security
• Scalability Induced problems
BITS Pilani
Pilani | Dubai | Goa | Hyderabad