BGP Basics and Routing Security

BGP Basics & Routing Security
Corey Eichelberger
ceichelberger@tacc.utexas.edu
TACC - Network Engineer
What is BGP
BGP or Border Gateway Protocol is protocol used between
routers to exchange routing information and reachability
information between or inside AS on the Internet.
BGP makes the Internet work, and in most cases it just
works 
Needs to be tuned for best performance
BGP makes routing decisions based on paths, network
policies and rule-sets, etc. 
BGP in the wild - Modify
Over 76,000 Autonomous Systems (ASN).
Over 1,000,000 IPv4 routes advertised.
Over 272,000 IPv6 routes advertised.
Each Router running BGP builds its own routing table with
best path information to a subset of the internet.
3
Data from: https://bgp.he.net/report/prefixes#_prefixes
R&E Routing Architecture Vs. Commodity.
Research and Education Networks
Bandwidth
Performance Engineering
Deterministic behavior
Community
Commodity Networks
Traffic shaping
DoS protections
Unknown architecture
R&E networks are engineered to support science while
commodity networks are not
Keep the science traffic on the science networks!
R&E vs. Commodity: What is the difference?
Multiple cloud providers
So what do we do?
High level : We need to use BGP policy to keep R&E traffic on R&E
networks
Announcements attract traffic
Routing determines the path the traffic takes through the network - BGP gives us
the tools
BGP is a path vector protocol
For a given prefix, the shorter AS path is preferred
If AS path length is the same, then other criteria are used, in order (“BGP path
selection algorithm”)
Override BGP’s use of AS path length when choosing between R&E
and commodity paths
R&E path will be longer in the general case (more organizations involved)
Use normal BGP route selection between R&E routes, and between commodity
routes
Remember - hop count is a legacy metric
BGP AS Path Length Illustrated
Hop count is a legacy metric!
BGP - Care and feeding
BGP just works in many cases
but needs tuned for
performance
Best path selection is a 10+ step
process!
Common steering mechanisms:
Localpref
Communities
AS Padding
MEDs
LocalPref
Per prefix
Modifies path for outbound
traffic
Higher preferred
Good tool for keeping R&E
traffic on R&E networks
Local
R&E
Commodity
LocalPref: 100
LocalPref: 200
BGP Community Strings
A community string is a number value that the peer uses like a tag. 
Tagging prefixes with communities tells the peer to handle the prefixes in a
special way.
Can make changes to routing policy based on per prefix strings
Prefixes can have multiple community strings
Can provide useful information about the prefix
Communities that might be useful to external networks should be made
public
Provides a mechanism for peers to affect a network’s internal behavior
Common uses: change local preference, DDoS mitigation
Look for upstream networks published communities
Regional?
National?
BGP Community Strings offered by Internet2
Set LocalPref on your advertised prefixes
Default - 100
11537:40 - Low
11537:160 - High
Prefix identification?
11537:5004 - Amazon
Where does the prefix enter the network?
11537:242 New York
Emergency!
11537:911 - Discard all traffic destined to these prefixes!
AS Path Padding?
65001:65000 - prepend x1
https://noc.net.internet2.edu/i2network/maps-documentation/documentation/bgp-communities.html
AS Path Padding
BGP will choose shortest AS Path
Add one or more copies of your AS# to prefixes advertised
to specific neighbors.
*
 
 
 
 
 
 
 
1
8
0
.
2
0
8
.
5
9
.
0
/
2
4
 
 
 
 
 
 
 
 
2
0
2
.
1
1
2
.
6
1
.
5
7
 
 
 
 
 
 
 
 
 
-
 
 
 
 
 
 
 
-
 
 
 
 
 
 
 
-
 
 
 
 
 
 
4
5
3
8
 
4
5
3
8
 
2
4
3
6
4
 
1
3
3
4
6
5
 
1
3
3
4
6
5
 
1
3
3
4
6
5
 
6
5
3
0
0
 
i
Multi Exit Discriminator (MED)
Useful when you have N+1 connections to a network
Indication to external peers of the preferred path into
network
Lowest number preferred
Local
Regional
 
 
 
MED: 5
MED: 10
Regional
BGP is an OLD protocol
Has been in use since 1994
https://datatracker.ietf.org/doc/html/rfc1654
Security was not a concern and not baked into the protocol
Believes (without help) all advertisements from peers with no
checks.
It also by default can re-advertise to other peers what it
learns.
14
Hijacking, Leaking, and spoofing…
MANRS reports over 10,000 routing outages or attacks
in 2018*
40% of all incidents believed to be attacks. 
Incidents can quickly scale to global problems.
15
*https://www.manrs.org/2019/02/routing-security-getting-better-but-no-reason-to-
rest/
Route / Prefix Hijacking
When a network advertises/originates a route that
belongs to another network (without permission)
Not always malicious can easily be caused by
misconfiguration
16
https://www.manrs.org/2020/09/what-is-bgp-prefix-hijacking-part-1/
Route / Prefix Hijacking - How it works
AS Path length
17
https://www.manrs.org/2020/09/what-is-bgp-prefix-hijacking-part-1/
Example: Youtube and Pakistan
Telecom
Before, during and after Sunday, 24 February 2008: AS36561 (YouTube)
announces 208.65.152.0/22.
Sunday, 24 February 2008, 18:47 (UTC): AS17557 (Pakistan Telecom) starts
announcing 208.65.153.0/24. AS3491 (PCCW Global) propagates the
announcement. Routers around the world receive the announcement, and
YouTube traffic is redirected to Pakistan.
Sunday, 24 February 2008, 20:07 (UTC): YouTube changes to announcing
two /24s. Some traffic starts going back to YouTube.
18
https://www.cnet.com/culture/how-pakistan-knocked-youtube-offline-and-how-to-
make-sure-it-never-happens-again/
https://www.ripe.net/publications/news/industry-developments/youtube-hijacking-
a-ripe-ncc-ris-case-study
Example: Youtube and Pakistan Telecom 2
Sunday, 24 February 2008, 20:18 (UTC): AS36561 (YouTube) starts
announcing 208.65.153.128/25 and 208.65.153.0/25. Because of the
longest prefix match rule, every router that receives these
announcements will send the traffic to YouTube.
Sunday, 24 February 2008, 20:51 (UTC): All prefix announcements
originated by AS17557 (Pakistan Telecom) via AS3491 (PCCW Global),
are prepended by another 17557. The longer AS path means that more
routers prefer the announcement originated by YouTube.
Sunday, 24 February 2008, 21:01 (UTC): AS3491 (PCCW Global)
withdraws all prefixes originated by AS17557 (Pakistan Telecom), thus
stopping the hijack of 208.65.153.0/24.
19
Other Hijacking examples
2018: Amazon DNS routes hijacked and
redirected to malicious DNS server:
https://www.internetsociety.org/blog/2018
/04/amazons-route-53-bgp-hijack/
 
2020: Rostelecom hijacks internet traffic for
Google, AWS, Cloudflare, and others:
https://www.zdnet.com/article/russian-
telco-hijacks-internet-traffic-for-google-
aws-cloudflare-and-others/
 
20
Resource Public Key Infrastructure (RPKI)
Regional Internet Registries (RIR’s) certifies owners of AS numbers
and IP addresses.
They also certify route announcements
Route Origin Authorization (ROAs) show that you are authorized
to advertise the IP addresses 
Allows you to verify addresses advertised to your router are
authorized to be advertised by that entity
Router can set the route as Valid, Invalid, or unknown
Create route policy depending on those results
Allows reject on wrong AS, wrong prefix, or too specific
advertisement
21
https://www.noction.com/blog/rpki-overview
Route Leak
RFC7908 - “A route leak is the propagation of routing
announcement(s) beyond their intended scope.”
A multihomed stub network announces routes from one upstream
providers routes to one or more of its other upstream providers
Stub network becomes an inadvertent transit provider.
Only announce AS’s and prefixes that you originate.
22
https://datatracker.ietf.org/doc/html/rfc7908
Simple Campus/Institution Route Leak Example
23
AS3
AS1
AS2
X
X: AS1
X: AS2, AS4, AS5, AS1
AS4
X: AS4, AS5,
AS1
X: AS3, AS1
X: AS2, AS3,
AS1
AS5
X:  AS5, AS1
Stub network AS3 creates route leak
advertising AS1 to AS2.
Route Leak Example
2017: Rostelecom Route Leak Targets E-
Commerce Services:
https://www.thousandeyes.com/blog/roste
lecom-route-leak-targets-ecommerce-
services
Confirmation that traffic destined for
those E-Commerce sites went through
the leakers network (possible
inspection?)
24
Route Policy to fix Leaks - Overview
BGP Operations and Security RFC:
https://datatracker.ietf.org/doc/html/rfc7454
Includes lots of great best practices for AS and prefix filtering
Good Primer: 
https://www.noction.com/wp-
content/uploads/2019/08/BGP-Filtering-Best-Practices.pdf
25
Route Policy to fix Leaks - Inbound
Loose Inbound Filtering Highlights include:
Don’t accept your own prefixes from a peer.
Filter Bogons (Addresses not assigned)
Be careful of more specific prefixes
IPv4: more specific than a /24
IPv6: more specific than a /48
Strict Filtering: use scripts or tool to validate incoming prefixes
against route registries.
https://www.irr.net/
26
Route Policy to fix Leaks - Outbound
If you are a multihomed, only advertise what you originate.
Don’t advertise private space (RFC1918)
Don’t advertise ULA (fc:00/7)
Prefixes used on your internal networks
Don’t re-advertise default route
27
IP Spoofing
Attacker creates and send IP packets with false source address
Commonly used in Distributed Denial of Service (DDOS) attacks
DNS, memcached, NTP, UDP - lots of vulnerabilities
November 2021: Microsoft detects and mitigates a 3.47Tbps
(340 million packets per second) 15 minute long DDOS attack
using UDP reflection.
28
https://azure.microsoft.com/en-us/blog/azure-ddos-protection-2021-q3-and-q4-ddos-attack-
trends/
Source Address Validation and IP Spoofing
Unicast Reverse Path Forwarding (uRPF)
Router checks it’s forwarding information table (FIB) for source
address in each packet.
Strict: Source Address must be reachable via incoming
interface (strict) or in the FIB (loose) or packet is dropped.
Can be done with ACL’s as well but can require a lot of manual
configuration.
Best Current Practices (BCP) 38
http://www.bcp38.info/index.php/Main_Page
https://datatracker.ietf.org/doc/html/rfc2827
29
https://blog.apnic.net/2022/02/07/source-address-validation-use-cases-and-gap-
analysis/
https://learn.nsrc.org/bgp/urpf
BGPSec
RPKI doesn’t validate the entire ASPATH of
a prefix.
BGPSec intended to verify the full path.
https://datatracker.ietf.org/doc/html/rfc82
05
 and more
IETF working groups moving forward
(
https://datatracker.ietf.org/wg/sidrops/ab
out/
)
No commercial implementations yet. 
few open source projects
(https://github.com/usnistgov/NIST-BGP-
SRx)
30
More Information
Single point of contact to help with end-to-end
performance issues
: 
epoc@tacc.utexas.edu
More about EPOC:
http://epoc.global
Deep Dive reports: 
https://epoc.global/materials
 
Jennifer Schopf, 
jschopf@
tacc.utexas
.edu
  
Jason Zurawski, 
zurawski@es.net
Other Resources
MANRS
https://manrs.org/
Routing Working Group
Mailing list 
routing-wg@gna-g.net
  
Contact Brenna Meade to be added 
meadeb@iu.edu
  
Web
https://www.gna-g.net/join-working-group/gna-g-routing-wg/
Questions / Comments
Slide Note
Embed
Share

Border Gateway Protocol (BGP) is a crucial protocol used by routers to exchange routing information and make routing decisions. This protocol plays a key role in how the Internet functions, with over 76,000 Autonomous Systems and millions of routes being advertised. Research and Education (R&E) networks differ from commodity networks in their engineering to support scientific endeavors. Using BGP policy is essential for directing traffic effectively within these networks. Learn more about BGP, AS path lengths, and routing architecture differences.

  • BGP Basics
  • Routing Security
  • Autonomous Systems
  • R&E Networks
  • Internet Routing

Uploaded on Oct 01, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. BGP Basics & Routing Security Corey Eichelberger ceichelberger@tacc.utexas.edu TACC - Network Engineer

  2. What is BGP BGP or Border Gateway Protocol is protocol used between routers to exchange routing information and reachability information between or inside AS on the Internet. BGP makes the Internet work, and in most cases it just works Needs to be tuned for best performance BGP makes routing decisions based on paths, network policies and rule-sets, etc.

  3. BGP in the wild - Modify Over 76,000 Autonomous Systems (ASN). Over 1,000,000 IPv4 routes advertised. Over 272,000 IPv6 routes advertised. Each Router running BGP builds its own routing table with best path information to a subset of the internet. 3 Data from: https://bgp.he.net/report/prefixes#_prefixes

  4. R&E Routing Architecture Vs. Commodity. Research and Education Networks Bandwidth Performance Engineering Deterministic behavior Community Commodity Networks Traffic shaping DoS protections Unknown architecture R&E networks are engineered to support science while commodity networks are not Keep the science traffic on the science networks!

  5. R&E vs. Commodity: What is the difference? Multiple cloud providers

  6. So what do we do? High level : We need to use BGP policy to keep R&E traffic on R&E networks Announcements attract traffic Routing determines the path the traffic takes through the network - BGP gives us the tools BGP is a path vector protocol For a given prefix, the shorter AS path is preferred If AS path length is the same, then other criteria are used, in order ( BGP path selection algorithm ) Override BGP s use of AS path length when choosing between R&E and commodity paths R&E path will be longer in the general case (more organizations involved) Use normal BGP route selection between R&E routes, and between commodity routes Remember - hop count is a legacy metric

  7. BGP AS Path Length Illustrated Hop count is a legacy metric!

  8. BGP - Care and feeding BGP just works in many cases but needs tuned for performance Best path selection is a 10+ step process! Common steering mechanisms: Localpref Communities AS Padding MEDs

  9. LocalPref Per prefix Modifies path for outbound traffic Higher preferred Good tool for keeping R&E traffic on R&E networks R&E Commodity Local

  10. BGP Community Strings A community string is a number value that the peer uses like a tag. Tagging prefixes with communities tells the peer to handle the prefixes in a special way. Can make changes to routing policy based on per prefix strings Prefixes can have multiple community strings Can provide useful information about the prefix Communities that might be useful to external networks should be made public Provides a mechanism for peers to affect a network s internal behavior Common uses: change local preference, DDoS mitigation Look for upstream networks published communities Regional? National?

  11. BGP Community Strings offered by Internet2 Set LocalPref on your advertised prefixes Default - 100 11537:40 - Low 11537:160 - High Prefix identification? 11537:5004 - Amazon Where does the prefix enter the network? 11537:242 New York Emergency! 11537:911 - Discard all traffic destined to these prefixes! AS Path Padding? 65001:65000 - prepend x1

  12. AS Path Padding BGP will choose shortest AS Path Add one or more copies of your AS# to prefixes advertised to specific neighbors. * 180.208.59.0/24 202.112.61.57 - - - 4538 4538 24364 133465 133465 133465 65300 i

  13. Multi Exit Discriminator (MED) Useful when you have N+1 connections to a network Indication to external peers of the preferred path into network Lowest number preferred MED: 5 Regional Regional MED: 10 Local

  14. BGP is an OLD protocol Has been in use since 1994 https://datatracker.ietf.org/doc/html/rfc1654 Security was not a concern and not baked into the protocol Believes (without help) all advertisements from peers with no checks. It also by default can re-advertise to other peers what it learns. 14

  15. Hijacking, Leaking, and spoofing MANRS reports over 10,000 routing outages or attacks in 2018* 40% of all incidents believed to be attacks. Incidents can quickly scale to global problems. 15 *https://www.manrs.org/2019/02/routing-security-getting-better-but-no-reason-to- rest/

  16. Route / Prefix Hijacking When a network advertises/originates a route that belongs to another network (without permission) Not always malicious can easily be caused by misconfiguration 16 https://www.manrs.org/2020/09/what-is-bgp-prefix-hijacking-part-1/

  17. Route / Prefix Hijacking - How it works AS Path length 17 https://www.manrs.org/2020/09/what-is-bgp-prefix-hijacking-part-1/

  18. Example: Youtube and Pakistan Telecom Before, during and after Sunday, 24 February 2008: AS36561 (YouTube) announces 208.65.152.0/22. Sunday, 24 February 2008, 18:47 (UTC): AS17557 (Pakistan Telecom) starts announcing 208.65.153.0/24. AS3491 (PCCW Global) propagates the announcement. Routers around the world receive the announcement, and YouTube traffic is redirected to Pakistan. Sunday, 24 February 2008, 20:07 (UTC): YouTube changes to announcing two /24s. Some traffic starts going back to YouTube. 18 https://www.ripe.net/publications/news/industry-developments/youtube-hijacking- a-ripe-ncc-ris-case-study https://www.cnet.com/culture/how-pakistan-knocked-youtube-offline-and-how-to- make-sure-it-never-happens-again/

  19. Example: Youtube and Pakistan Telecom 2 Sunday, 24 February 2008, 20:18 (UTC): AS36561 (YouTube) starts announcing 208.65.153.128/25 and 208.65.153.0/25. Because of the longest prefix match rule, every router that receives these announcements will send the traffic to YouTube. Sunday, 24 February 2008, 20:51 (UTC): All prefix announcements originated by AS17557 (Pakistan Telecom) via AS3491 (PCCW Global), are prepended by another 17557. The longer AS path means that more routers prefer the announcement originated by YouTube. Sunday, 24 February 2008, 21:01 (UTC): AS3491 (PCCW Global) withdraws all prefixes originated by AS17557 (Pakistan Telecom), thus stopping the hijack of 208.65.153.0/24. 19

  20. Other Hijacking examples 2018: Amazon DNS routes hijacked and redirected to malicious DNS server: https://www.internetsociety.org/blog/2018 /04/amazons-route-53-bgp-hijack/ 2020: Rostelecom hijacks internet traffic for Google, AWS, Cloudflare, and others: https://www.zdnet.com/article/russian- telco-hijacks-internet-traffic-for-google- aws-cloudflare-and-others/ 20

  21. Resource Public Key Infrastructure (RPKI) Regional Internet Registries (RIR s) certifies owners of AS numbers and IP addresses. They also certify route announcements Route Origin Authorization (ROAs) show that you are authorized to advertise the IP addresses Allows you to verify addresses advertised to your router are authorized to be advertised by that entity Router can set the route as Valid, Invalid, or unknown Create route policy depending on those results Allows reject on wrong AS, wrong prefix, or too specific advertisement 21 https://www.noction.com/blog/rpki-overview

  22. Route Leak RFC7908 - A route leak is the propagation of routing announcement(s) beyond their intended scope. A multihomed stub network announces routes from one upstream providers routes to one or more of its other upstream providers Stub network becomes an inadvertent transit provider. Only announce AS s and prefixes that you originate. 22 https://datatracker.ietf.org/doc/html/rfc7908

  23. Simple Campus/Institution Route Leak Example X: AS5, AS1 X: AS4, AS5, AS1 AS5 AS4 X: AS2, AS4, AS5, AS1 X: AS1 AS1 AS2 X X: AS2, AS3, AS1 X: AS3, AS1 AS3 Stub network AS3 creates route leak advertising AS1 to AS2. 23

  24. Route Leak Example 2017: Rostelecom Route Leak Targets E- Commerce Services: https://www.thousandeyes.com/blog/roste lecom-route-leak-targets-ecommerce- services Confirmation that traffic destined for those E-Commerce sites went through the leakers network (possible inspection?) 24

  25. Route Policy to fix Leaks - Overview BGP Operations and Security RFC: https://datatracker.ietf.org/doc/html/rfc7454 Includes lots of great best practices for AS and prefix filtering Good Primer: https://www.noction.com/wp- content/uploads/2019/08/BGP-Filtering-Best-Practices.pdf 25

  26. Route Policy to fix Leaks - Inbound Loose Inbound Filtering Highlights include: Don t accept your own prefixes from a peer. Filter Bogons (Addresses not assigned) Be careful of more specific prefixes IPv4: more specific than a /24 IPv6: more specific than a /48 Strict Filtering: use scripts or tool to validate incoming prefixes against route registries. https://www.irr.net/ 26

  27. Route Policy to fix Leaks - Outbound If you are a multihomed, only advertise what you originate. Don t advertise private space (RFC1918) Don t advertise ULA (fc:00/7) Prefixes used on your internal networks Don t re-advertise default route 27

  28. IP Spoofing Attacker creates and send IP packets with false source address Commonly used in Distributed Denial of Service (DDOS) attacks DNS, memcached, NTP, UDP - lots of vulnerabilities November 2021: Microsoft detects and mitigates a 3.47Tbps (340 million packets per second) 15 minute long DDOS attack using UDP reflection. 28 https://azure.microsoft.com/en-us/blog/azure-ddos-protection-2021-q3-and-q4-ddos-attack- trends/

  29. Source Address Validation and IP Spoofing Unicast Reverse Path Forwarding (uRPF) Router checks it s forwarding information table (FIB) for source address in each packet. Strict: Source Address must be reachable via incoming interface (strict) or in the FIB (loose) or packet is dropped. Can be done with ACL s as well but can require a lot of manual configuration. Best Current Practices (BCP) 38 http://www.bcp38.info/index.php/Main_Page https://datatracker.ietf.org/doc/html/rfc2827 29 https://learn.nsrc.org/bgp/urpf https://blog.apnic.net/2022/02/07/source-address-validation-use-cases-and-gap- analysis/

  30. BGPSec RPKI doesn t validate the entire ASPATH of a prefix. BGPSec intended to verify the full path. https://datatracker.ietf.org/doc/html/rfc82 05 and more IETF working groups moving forward (https://datatracker.ietf.org/wg/sidrops/ab out/) No commercial implementations yet. few open source projects (https://github.com/usnistgov/NIST-BGP- SRx) 30

  31. More Information Single point of contact to help with end-to-end performance issues: epoc@tacc.utexas.edu More about EPOC: http://epoc.global Deep Dive reports: https://epoc.global/materials Jennifer Schopf, jschopf@tacc.utexas.edu Jason Zurawski, zurawski@es.net

  32. Other Resources MANRS https://manrs.org/ Routing Working Group Mailing list routing-wg@gna-g.net Contact Brenna Meade to be added meadeb@iu.edu Web https://www.gna-g.net/join-working-group/gna-g-routing-wg/

  33. Questions / Comments

More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#