BRKSPG-3012 - SP Security Leveraging BGP FlowSpec To Protect Your Infrastructure
BRKSPG-3012 - SP Security Leveraging BGP FlowSpec To Protect Your Infrastructure
BRKSPG-3012 - SP Security Leveraging BGP FlowSpec To Protect Your Infrastructure
SP Security
Leveraging BGP FlowSpec to protect
your infrastructure
How
1. Find this session in the Cisco Live Mobile App
2. Click “Join the Discussion”
3. Install Spark or go directly to the space
4. Enter messages/questions in the space
cs.co/ciscolivebot#BRKSPG-3012
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
What We Hope To Achieve With This Session
• Introduce BGP Flowspec
• Clarify what it can do and where it fits
• DDoS Mitigation is not the only use-case in production
• Provide one more tool to your networking belt
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Me ?
• Nicolas Fevrier
• TL / Technical Marketing Engineer based in Paris
• Service Providers BU
• In Cisco since 2004
• Worked on all IOS XR Platforms
• from CRS-1 to NCS5500
• Worked in Services/Deployment and BU
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 5
You ?
CiscoLive attendees registered to this session
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 6
Agenda
• Introduction
• BGP FlowSpec Protocol Description
• Use-cases, Demo
w/ DDoS Mitigation
• Configuring the Protocol
• Caveats and Limitations
• Conclusion
Acknowledgements
• Andy Karch
• Bertrand Duvivier
• Gunter Van de Velde
• Brian Prater
• Kirill Kasavchenko
• Tomas Sundstrom
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 8
Another 180+ Pages Slidedeck ?
• 90 Minutes
• Large “Back Up Slides” section
• Use of “For your reference” logo
For Your
Reference
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 9
Introduction
Introduction
• August 2009, IETF ratified “Dissemination of Flow Specification Rules”
• Separation of controlling and forwarding plane. Sounds familiar ?
• A powerful tool in the SP Security toolbox but Use-cases are expending way
beyond Security
DP CP
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 11
Introduction
BGP FlowSpec is not:
• Netflow
• Sample traffic and generate records from local table collector
• Openflow
• But similarities exist
• Microflow Policing
• Per user rate-limiting, some overlap
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 12
Introduction
• A Controller programs remotely how packets
should be treated when received on Clients interfaces
• Remote PBR: redirect packet in VRF X
• Remote PBR: redirect packet to @IP X BGP FS
• Remote QoS: DSCP Marking client
• Remote QoS: Policing (rate-limiter)
• Remote ACL: Policing to 0 bps
BGP FS BGP
client
Data Redirect
UDP/TCP/ICMP
IPv4/v6 Remark
L2
BGP
RL / Drop
BGP FS
controller
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 13
Introduction: Rule is Description and Action
• BGP is used to program remotely a rule made of:
• A traffic description (v4/v6 L3/L4)
• An action Traffic Description Action
dst:2001:4:5::23/128 redirect-in-VRF Dirty
• Traffic received on client (ingress only today)
UDP:123 Size: 800-1500 rate-limit 0 bps
matching the Description will be applied
dst:1.2.3.4 SYN redirect-to-IP 20.2.3.4
the Action
src:4.0.0.1 TCP80 mark DSCP ef
BGP FS
client
Data
UDP/TCP
IPv4/v6 BGP FS
L2 controller
BGP FS
rule
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 14
BGP FlowSpec Components
Controller
• Injects rules remotely in the clients
• Needs to implement Control Plane (CP) at the minimum
• Examples of BGP FS Controllers:
• router (ASR9000, CRS, NCS 6000, XR 12000, …)
• server (ExaBGP, YABGP, Open Day Light, Arbor SP, …)
• virtual router (XRv 9000)
CP CP
DP BGP FS
BGP FS controller
client
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 15
BGP FlowSpec Components
Client
• Receives rules from Controller(s) and programs the match/actions in hardware
• Needs to implement both Control Plane (CP) and Data Plane (DP)
• Examples of BGP FS Clients:
• router (ASR 9000, CRS, NCS 6000, ASR 1000, CSR 1000v…)
CP CP
DP BGP FS
BGP FS controller
client
L2
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 16
BGP FlowSpec Components
Route-Reflector
• Receives rules from Controller(s) and distributes them to Clients
• Usually Control Plane only, doesn’t (need to) program the rules locally
BGP FS
• Examples of BGP FS Router-Reflector: RR
• ASR 9000, CRS, NCS 6000 or XRv 9000
CP
• ASR 1000, CSR 1000v
BGP FS
client
CP
DP
CP
CP CP BGP FS
DP DP controller
BGP FS BGP FS
client client
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 17
BGP FlowSpec
Uni-Directional
• BGP FS is not bi-directional
• One way arrow from Controller to Client no feedback loop
• Need other mechanism to collect counters / stats and measure the impact of the
rule on traffic
CP CP
DP
BGP FS BGP FS
client controller
NC/XML
Show commands
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 18
BGP FlowSpec Session
Internal / External
• BGP FlowSpec follows the same rules than “traditional” BGP
• Rules received from eBGP are sent to other eBGP peers
• Rules received from eBGP are sent to iBGP peers
• Rules received from iBGP are sent to eBGP peers
• Rules received from iBGP are not sent to other iBGP peers unless the router is
configured as a route-reflector
iBGP iBGP
eBGP eBGP
CP
BGP FS BGP FS BGP FS BGP FS BGP FS
client client client client controller
AS X AS Y AS Z
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 19
BGP FlowSpec
Protocol Description
RFC 5575
Dissemination of Flow Specification Rules
• Why using BGP?
• Simple to extend by adding a new NLRI
• MP_REACH_NLRI / MP_UNREACH_NLRI
• Already used for every other kind of technology
• IPv4, IPv6, VPN, Multicast, Labels, MAC addresses, EVPN, …
• Point to multipoint with Route-Reflectors
• Inter-domain support
• Networking engineers and architects understand perfectly BGP
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 21
RFC 5575
Dissemination of Flow Specification Rules: Traffic Matching
• NLRI defined (AFI=1, SAFI=133) to describe the traffic of interest
1. Destination IP Address
2. Source IP Address
3. IP Protocol Type Length
4. Port Address Family Identifier (AFI) 2 octets
5. Destination port Subsequent Address Family Identifier (SAFI) 1 octet
6. Source Port Length of Next Hop Network Address 1 octet
7. ICMP Type Network Address of Next Hop Variable
8. ICMP Code Reserved 1 octet
9. TCP Flags
Network Layer Reachability Information (NLRI) Variable
10. Packet length
11. DSCP
The MP_REACH_NLRI – RFC 4760
12. Fragment
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 22
RFC 5575
Dissemination of Flow Specification Rules: Traffic Matching
IPv4 Version IHL ToS Total Length
Not matched:
Identification Flags Frag Offset
- MPLS labels number
TTL Protocol Header Checksum
- MAC address
Source Address
- L5-7 data like
- HTTP URL
Destination Address
- Cookie
Options Padding
- DNS requests…
TCP Source Port Destination Port UDP Source Port Destination Port
Sequence Number Length Checksum
Ack Number Data
H lgh Res C bit Window
Checksum Urgent ICMP Type Code Checksum
Options Quench
Data Data
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
RFC 5575
Dissemination of Flow Specification Rules: Traffic Actions
• Traffic Action is defined in extended-communities (RFC4360)
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 24
RFC 7674
Clarification of the Flowspec Redirect Extended Community
• Following Redirect actions are supported since IOS XR 5.2.0
Note: the IPv4 RT ( a.b.c.d : value ) is not the the redirect to IP action
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 25
IETF Drafts
Extensions for RFC5575: IETF Drafts
• On top of the RFC implementation, IOS XR supports:
• IPv6 extensions: draft-ietf-idr-flow-spec-v6-03
• Redirect IP extension: draft-simpson-idr-flowspec-redirect-02
• IBGP extension: draft-ietf-idr-bgp-flowspec-oid-01
• Persistence Support: draft-uttaro-idr-bgp-persistence-02 (in IOS XR5.2.2)
• HA/NSR Support
• Max-prefix
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 26
IETF Drafts
Extensions for RFC5575: IETF Drafts
• On top of the former list, IOS XE supports:
•draft-ietf-idr-flowspec-interfaceset-03
New Extended community to inform remote router where (interface) to apply the rule
Not supported on XR
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 27
For Your
Reference
IETF Drafts
Extensions for RFC5575: Unsupported IETF Drafts
• Other drafts are under work in the IDR group but not supported in IOS XR:
• Carrying Label Information for BGP FlowSpec: draft-ietf-idr-bgp-flowspec-label-01
• Dissemination of Flow Specification Rules for L2 VPN: draft-ietf-idr-flowspec-l2vpn-05
• BGP Flow Specification Filter for MPLS Label: draft-ietf-idr-flowspec-mpls-match-01
• BGP Flow Specification Packet-Rate Action: draft-ietf-idr-flowspec-packet-rate-01
• Flowspec Indirection-id Redirect: draft-ietf-idr-flowspec-path-redirect-01
• Dissemination of Flow Specification Rules: draft-ietf-idr-rfc5575bis-01
• Inter-provider Propagation of BGP Flow specification Rules:
draft-bashir-idr-inter-provider-flowspec-actions-00
• Populate to FIB Action for FlowSpec: draft-li-idr-flowspec-populate-to-fib-00
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 28
For Your
Cisco Routers BGP FS Implementation Reference
Client QoS
ACL
• What is YOUR scale requirement ?
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 32
IOS XR Implementation Data
Intf x
Application on Interface IPv4/v6
Data
Intf1.x
IPv4/v6
Data
IPv4/v6
Data
BE100.x
IPv4/v6
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 33
BGP FlowSpec with 6PE
• Network with legacy devices not supported dual-stack are leveraging 6PE to
transport IPv6 over MPLS
• When packets are received on PE routers, they are encapsulated in MPLS labels
• ASR9000 will be able to apply BGP FS rules on the P-PE interface receiving 6PE
labelled packets and match in the IPv6 Header (L3 and L4)
• Works also with VPNv4 and VPNv6 IPv6
PE payload
IPv6 hdr
IPv6 IPv6
payload payload
BGP FS
IPv6 hdr IPv6 hdr rule
6PE label 6PE label
LSP label
Internet v6 PE P PE Access
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 34
IOS XR Interface Disabled
rtrA BGP FlowSpec Enabled
BGP FlowSpec Disabled
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 36
Use-cases:
DDoS Mitigation
DDoS Attacks
• No longer necessary to explain the risk
• Distributed Denial of Service (DDoS) is a lucrative activity for attackers
• ISP, Hosting Services, Enterprises: it can jeopardize your business
Everyone is at risk
• 2017:
• More sophisticated
• Less volumetric
• But still very high
Source: http://www.digitalattackmap.com/
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 38
DDoS Attacks
• Denial of Service attacks are of different natures:
• Application-layer attacks
• Detected and handled by Firewalls, IDS or at the Server level
• Volumetric attacks (including Protocols attacks)
• Can NOT be mitigated in datacenter or server farm (too late)
• Should be handled in the backbone or at the border
Web Web
Server Cache
IPS/IDS Firewall
Edge
The Internet
Core
Peering DC
Transit
DPI Database
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 39
DDoS Attacks Mitigation
• BGP FS was initially designed with DDoS Mitigation use-case in mind
• Distributed attack received from all transit and peering points
• We can use a mitigation system in a ASR9000/VSM card or an appliance
connected to your IOS-XR router
• We differentiate arbitrarily three DDoS attack families:
• Stateless Amplification
• Stateless L3 / L4 / others
• Stateful / up-to-L7 on application resources
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 40
Different Business, Different Targets
DataCenter and Hosting DataCenter
Web Web
Server Cache
! !
!
DC ! !
Edge Firewall
The Internet
Peering !
Transit Core Database
Enterprise
Agg PE Fw IPS/IDS DNS, Mail,
! ! ! ERP, SAN, …
!
! !
! Residential
! ! ! ! DPI
! !
! ! ! ! ! !
! ! ! ! ! !
! ! ! ! ! !
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 41
Use-cases:
DDoS Mitigation
Amplification Attacks
DDoS Mitigation with BGP FS
Amplification Attacks 101
• Stateless attacks are not using a full handshake and are based on spoofed
source addresses
• Amplification attacks using vulnerable protocols on high bandwidth servers
– DNS
Much larger reply
– NTP
– CharGen
– SNMP
2.1.1.1
– SSDP
– RIPv1
– Port Mapper
Small request
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 43
DDoS Mitigation with BGP FS
Amplification Attacks Always Trendy
• Victims
• #1 Online Gaming
• #2 Criminal demonstration
• #3 Extortion
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 44
DDoS Mitigation with BGP FS
Amplification Attacks Always Trendy Source: Akamai State of the Internet 2017
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 45
DDoS Mitigation with BGP FS
Amplification Attacks Always Trendy
Source: https://www.shadowserver.org/
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 46
DDoS Mitigation with BGP FS
Rate-limiting / Filtering Amplification Attacks
<100Gbps
800Gbps / LC
Data
Length
2.1.1.1
Data
2000B
2.1.1.1
Data
1500B Match: dest-IP: 2.1.1.1
+ frag field set
UDP 123
Action: rate-limit 0bps
IPv4 BGP FS
controller
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 48
Use-cases:
DDoS Mitigation
L3/L4 Attacks
DDoS Mitigation with BGP FS
Rate-limiting / Filtering Stateless Attacks: L3/L4 Protocol Attacks
• Generic family covering non-amplified stateless streams like ICMP flood
• Source address could be forged or not (botnet members are corrupted hosts)
2.1.1.1
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 50
DDoS Mitigation with BGP FS
Rate-limiting / Filtering Stateless Attacks: L3/L4 Protocol Attacks
• L3/L4 attacks can be also filter at the edge router via BGP FS
• Same principles than previous use-case
2.1.1.1
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 51
Use-cases:
DDoS Mitigation
Stateful Attacks
DDoS Mitigation with BGP FS
Addressing Stateful Attacks
• More advanced attacks using Botnets or even real users (LOIC) needs to be
addressed differently by a specific scrubbing device. Examples:
• HTTP: bots mimicking the behavior of a real web browser
• TCP SYN
• SSL
• SIP
• … Requests
2.1.1.1
Replies
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 53
DDoS Mitigation with BGP FS
Addressing Stateful Attacks
• BGP FlowSpec will be used to program a different action here
• Diversion to a next-hop address
• Diversion to a different VRF
2.1.1.1
192.168.9.2
7.7.7.7
• Detection of the attack itself is out of the scope of this short demo
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 56
Demo
Rate-limiting and Redirect Attacks Traffic w/ BGP FlowSpec
• First attack is identified as a TCP 80 SYN with very large packet size
• We will use BGP FS to divert the TCP 80 traffic targeted to 7.7.7.7 into the TMS
192.168.9.2
TCP 80 SYN
7.7.7.7
192.168.9.2
7.7.7.7
UDP 123
Match:
src-port: UDP 123
+ size 300-B1000B
Action: rate-limit 0bps
BGP FS
controller
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 58
Demo
Rate-limiting and Redirect Attacks w/
BGP FlowSpec
http://bit.ly/2rYSKY9
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 60
Arbor SP Solution
Dynamic Black-list Offload with BGP FlowSpec
1• A countermeasure is activated
and detects an offender
2• TMS instructs the ASR9000 via 1
Flowspec to program an ACL for offender victim
the src-@ or the pair src-@+dst-@
For one minute
src-@ dst-@
3• After 1min, the ACL is removed.
If the offender is seen by the
countermeasure again, ACL will be
programmed for 5min, and then 5
Match: src-IP: 2.1.1.1
min, again and again 3
Action: drop 2
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
• No “drop” in BGP Flowspec actions, just a policer to 0 bps
• In DDoS attack context what could be the benefits of rate-limiting to X bps
instead of 0 bps
• X bps will drop packets randomly (legitimate or malicious ones equally), creating
difficult troubleshooting situation
• 0 bps is advised
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 62
DDoS Mitigation with BGP FS
Benefits
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 63
Improving Existing DDoS
Mitigation Models
DDoS Mitigation Models
Network Design
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 65
IP-only Network w/ Distributed TMS
Currently deployed
• A static route for 10.51.51.51 is defined on routers M and J pointing to local TMS
static
10.51.51.51/32
10.2.1.2
Te0/0/0/0.1
.2
2.1.1.0/24 10.2.1.0/30
IGP J
SA1 SA2 rtrA nh:rtrI J Te0/0/0/0.2
10.1.1.0/30 10.1.2.0/30 10.2.2.0/30 .2
M
I F Victim
10.51.51.51/32
10.1.1.2 2.1.1.1
static L H E C
M
2.1.1.0/24
2.1.1.0/24 K G D B A
rtrA nh:rtrK
IGP IP Network
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 66
IP-only Network w/ Distributed TMS
Currently deployed
BGP BGP
2.1.1.1/32 BGP 2.1.1.1/32
10.51.51.51 10.51.51.51
2.1.1.1/32
Te0/0/0/0.1
.2 nh:10.51.51.51 10.2.1.0/30
J J
SA1 SA2 Te0/0/0/0.2
10.1.1.0/30 10.1.2.0/30 10.2.2.0/30 .2
Collector
M
I F Victim
2.1.1.1
L H E C
M
2.1.1.0/24
K G D B A
BGP BGP
2.1.1.1/32 2.1.1.1/32
10.51.51.51 10.51.51.51
static static Te0/0/0/0.1
.2 10.2.1.0/30
10.51.51.51/32 10.51.51.51/32
10.1.1.2
J 10.2.1.2 J
SA1 SA2 Te0/0/0/0.2
10.1.1.0/30 10.1.2.0/30 10.2.2.0/30 .2
2.1.1.1/32
M
10.51.51.51
nh:10.2.1.2
I F Victim
2.1.1.1
L H E C
M
2.1.1.0/24
2.1.1.1/32 K G D B A
10.51.51.51
nh:10.1.1.2
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 68
IP-only Network w/ Distributed TMS
Currently deployed
• With the specific route received we now have to deal with a routing loop for the
legit traffic going out of the TMS device. We need solutions to prevent it
BGP static
2.1.1.1/32 10.51.51.51/32
10.51.51.51 10.2.1.2
BGP
2.1.1.1/32
10.51.51.51 Te0/0/0/0.1 .2
.2
static 10.2.1.0/30
10.51.51.51/32 J
10.1.1.2 BE1.1 BE1.2 Te0/0/0/0.2
10.1.1.0/30 10.1.2.0/30 10.2.2.0/30
L
M
K I
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 69
IP-only Network w/ Distributed TMS
Solution to Avoid the Routing Loop (without BGP FS)
• Define an VRF-Lite Clean and assigned the egress TMS interfaces to it
• We need two sub-interfaces to the core, one in GRT, one in the clean VRF
• In the clean VRF, to pick the best path to the destination, we need the full IGP table
IGP
Te-0/0/0/0.2 Te-0/0/0/0.2
K K
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 70
IP-only Network w/ Distributed TMS
BGP FlowSpec Improvement: Granularity
• BGP FS defines precisely the flow to divert to the local scrubbing device
Rule: dest-IP: 2.1.1.1
Rule: dest-IP: 2.1.1.1
+ dest-port: 80
+ dest-port: 80
Action: NH: 10.1.1.2
Action: NH: 10.2.1.2
BGP FS Te0/0/0/0.1
advertisement 10.2.1.0/30
J J
SA1 SA2 Te0/0/0/0.2
10.1.1.0/30 10.1.2.0/30 10.2.2.0/30 .2
FS
M controller
I F Victim
2.1.1.1
L H E C
M
2.1.1.0/24
K G D B A
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 71
IP-only Network w/ Distributed TMS
BGP FlowSpec Improvement: No VRF-Lite needed
• BGP FlowSpec is activated on Te0/0/0/1, dirty traffic targeted to 2.1.1.1:80 is
forwarded to the scrubbing device address 10.2.1.2
• BGP FlowSpec is deactivated on port te0/0/0/0.2, clean traffic from the
scrubbing device is routed naturally via IGP route 2.1.1.0/24 to router I
2.1.1.0/24
.2 rtrA nh:rtrI
BGP FlowSpec
BGP FlowSpec Te0/0/0/0.1
Te0/0/0/1 10.2.1.0/30 .2 Match: dest-IP: 2.1.1.1
Match: dest-IP: 2.1.1.1 + dest-port: 80
+ dest-port: 80 J Action: NH: 10.1.1.2
BE1.1
10.1.1.0/30
BE1.2
10.1.2.0/30
Action: NH: 10.2.1.2 Te0/0/0/0.2 L
10.2.2.0/30
Te0/0/0/3
2.1.1.0/24 M
rtrA nh:rtrI Te0/0/0/1
I K
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 72
Other Use-Cases
Other BGP FS Use-Cases
Unequal Load-Balancing
CGSE+
B
10.0.16.0/20 30Gbps
10.0.1.0/24 10Gbps
A
10.0.0.0/24 10Gbps
The Internet
ISM
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 74
Other BGP FS Use-Cases
Unequal Load-Balancing
B
10.0.16.0/20 30Gbps
10.0.1.0/24 10Gbps
A
10.0.0.0/24 10Gbps
The Internet
ISM
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 75
Other BGP FS Use-Cases
Unequal Load-Balancing
• This approach allows fine tuning of the traffic in the NAT engines, advertising
one prefix with one NH or another
Rule: src-IP: 10.0.16.0/20
Action: IP NH CGSE+
B
10.0.16.0/20 30Gbps
10.0.1.0/24 10Gbps
A
10.0.0.0/24 10Gbps
The Internet
ISM
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 76
Other BGP FS Use-Cases
Low QoS Priority Traffic for DDoS Attacks
• Important back-up is using 3 Gbps of traffic
• Simultaneously, a DDoS attack starts and is Scrubbing
diverted to the scrubbing center Center
S
• Links are not saturated
6G
L H C 3G Victim
2G M 3G 2.1.1.1
2G K G B A
2G
3G
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 77
Other BGP FS Use-Cases
Low QoS Priority Traffic for DDoS Attacks
• The attack intensity increases
• Links are congested, it impacts internal traffic Scrubbing
Center
S
8G
10G L H C 2G Victim
4G M 2G 2.1.1.1
4G K G B A
4G
3G
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 78
Other BGP FS Use-Cases
Low QoS Priority Traffic for DDoS Attacks w/ FlowSpec
• BGP FS rule forces the route leaking in VRF-Dirty and positioning a DSCP field
Scrubbing
Center
BGP FS
7G
10G L H C 3G Victim
4G M 3G 2.1.1.1
4G K G B A
4G
3G
Routers will dropped attack traffic in priority in
case of congestion based on this DSCP field
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 79
Other BGP FS Use-Cases
Transit AS Policing
Victim
20G 2.1.1.1
10G
20G
AS Transit AS Customer
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 80
Other BGP FS Use-Cases
Transit AS Policing
Victim
20G 2.1.1.1
10G
20G
AS Transit AS Customer
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 81
Other BGP FS Use-Cases
Give the Power to the Victim
eBGP FS
iBGP eBGP iBGP
Victim
20G 2.1.1.1
10G
20G
AS Transit AS Customer
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 82
Other BGP FS Use-Cases
Enterprise PBR
MPLS Internet
C D
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 83
Other BGP FS Use-Cases
Enterprise PBR: Security Classification
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 84
Other BGP FS Use-Cases
Enterprise PBR: “SD-WAN”
MPLS Internet
C D
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 85
BGP FlowSpec Configuration
Configuring BGP FlowSpec on IOS XR Routers
Overview of the Configuration Steps
• On Client
disable
local-install
flowspec specific
interface-all
interfaces
• On Controller
flowspec
class-map policy-map
service-policy pbr
C3PL model
Note: all examples in following slides are equally valid for IPv4 and IPv6
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 87
Configuring BGP FlowSpec on IOS XR Routers
Signalization: Use of a new Address-Family flowspec
Controller Client
router bgp 1 router bgp 1
bgp router-id 6.6.6.6 bgp router-id 3.3.3.3
address-family ipv4 flowspec address-family ipv4 flowspec
! !
neighbor-group ibgp-flowspec neighbor-group ibgp-flowspec
remote-as 1 remote-as 1
update-source loopbook0 update-source loopback0
address-family ipv4 flowspec address-family ipv4 flowspec
! !
! neighbor 25.2.1.11
neighbor 25.2.1.3 use neighbor-group ibgp-flowspec
use neighbor-group ibgp-flowspec !
! !
neighbor 25.2.1.4 flowspec Install all rules
use neighbor-group ibgp-flowspec local-install interface-all
! ! on all interfaces
!
flowspec
address-family ipv4
service-policy type pbr FS
Advertise
policy FS
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 88
Configuring BGP FlowSpec on IOS XR Routers
Configuring Rules on the Controller
class-map type traffic match-all match-UDP53
match destination-port 53
match protocol udp
end-class-map
!
class-map type traffic match-all match-src-ipv4-addr
match destination-address ipv4 25.1.104.0 255.255.255.0
end-class-map
!
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 89
For Your
Reference
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 90
Configuration Demo
http://bit.ly/bgpfs-config
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 91
Configuring BGP FlowSpec on IOS XR Routers
Configuring a Type 1 Match “Destination Address”
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 92
Configuring BGP FlowSpec on IOS XR Routers
Mixing Several Matching Statements
class-map type traffic match-all MATCHING-RULE1
match source-port 10 20 30-40 50-52 60-70
match protocol udp
match dscp ef
match packet length 10-100 102-200 202-400 402-1500
match destination-port 80
match destination-address ipv4 11.200.4.0 255.255.255.0
end-class-map
Application FS Rule
Drop = Police at 0bps
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 95
Configuring BGP FlowSpec on IOS XR Routers
Configuring an Action: Redirection
• If the ingress interface is in the Global Routing Table, the flowspec rule should
be advertised via an “address-family IPv4 flowspec”
• Redirection to an NH address implies the egress interface is in the GRT too
• Redirection to a different VRF can not specify the destination address, a second
lookup in this target VRF will happen to the destination address of the packet
AF ipv4 FS rtrA AF ipv4 FS rtrA
1.2.3.2/30 1.2.3.2/30
Action: Action:
Redirect 1.2.3.2 Redirect VRF Blue
VRF
GRT
Blue
GRT GRT
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 96
Configuring BGP FlowSpec on IOS XR Routers
Configuring an Action: Example of a Redirection to an IP Address
Controller Configuration Client View
RP/0/RSP0/CPU0:Client#show bgp ipv4 flowspec
policy-map type pbr TEST <SNIP>
class type traffic MATCHING-RULE1 Status codes: s suppressed, d damped, h history, * valid, > best
redirect nexthop 25.3.9.3 i - internal, r RIB-failure, S stale, N Nexthop-
! discard
class type traffic class-default Origin codes: i - IGP, e - EGP, ? - incomplete
! Network Next Hop Metric LocPrf Weight
end-policy-map Path
! *>iDest:25.1.102.1/32,Proto:=17,Length:>=500&<=1550/128
traffic MATCHING-RULE1 25.3.9.3 100 0 i
class-map type traffic match-all MATCHING-RULE1
match protocol udp Processed 1 prefixes, 1 paths
match packet length 500-1550
match destination-address ipv4 25.1.102.1 RP/0/RSP0/CPU0:Client#show flowspec afi-all detail
255.255.255.255
end-class-map AFI: IPv4
! Flow :Dest:25.1.102.1/32,Proto:=17,Length:>=500&<=1550
Actions :Nexthop: 25.3.9.3 (bgp.1)
Statistics (packets/bytes)
Matched : 0/0
Dropped : 0/0
RP/0/RSP0/CPU0:Client#
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 97
For Your
Reference
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 98
Configuring BGP FlowSpec on IOS XR Routers
Gotchas with Redirect Action
• A rule is advertised from controller only if the configured NH is reachable
• Not necessary reachable on the client side but mandatory on the controller side
Contr Client
iBGP FS
✖
RP/0/0/CPU0:XRv2-demo#sh bgp ipv4 flowspec neighbors 10.0.0.1 detail | i "(Long|LLGR)"
Mon May 11 16:07:53.845 UTC
Long-lived Graceful Restart Capability advertised
Advertised Long-lived Stale time 360 seconds
Remaining LLGR stalepath time 2
RP/0/0/CPU0:XRv2-demo#sh bgp ipv4 flowspec neighbors 10.0.0.1 detail | i "(Long|LLGR)"
Mon May 11 16:08:01.285 UTC
Long-lived Graceful Restart Capability advertised
Advertised Long-lived Stale time 360 seconds
Long-lived Graceful Restart not in effect as Graceful Restart capability not received
RP/0/0/CPU0:XRv2-demo#sh flowspec ipv4 detail
Mon May 11 16:08:04.615 UTC
RP/0/0/CPU0:XRv2-demo#
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 104
BGP FS Controller Redundancy
• No Controller to Controller protocol to sync the rules advertisement
rule A
rule B
Ctrl rule C
rule D
rule A
rule B
rule C
Client ?
rule D
rule B
Ctrl rule D
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 105
BGP FS Controller Redundancy
• If a controller is lost, the rules are not temporarily removed and re-installed
rule A
rule B
Ctrl rule C
rule D
rule A
rule B
rule C
Client
rule D
✖
Ctrl
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 106
For Your
Reference
Order of preference
Type 3 IPv4 protocol
• The algorithm starts by comparing Type 4 IPv4 source or destination port
the left-most components of the Type 5 IPv4 destination port
rules. Type 6 IPv4 Source port
Type 7 IPv4 ICMP type
• If the types differ, the rule with lowest
Type 8 IPv4 ICMP code
numeric type value has higher
IPv4 TCP flags (2 bytes
precedence (and thus will match Type 9
include reserved bits)
before) than the rule that doesn't Type 10 IPv4 Packet length
contain that component type. Type 11 IPv4 DSCP
Type 12 IPv4 fragmentation bits
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 107
For Your
Reference
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 108
For Your
Reference
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 110
NLRI Filtering
Configuration
prefix-set ALLOW-FLOW
1.1.1.0/24 ge 32 • Server advertises two BGP FS rules:
end-set • Destination 1.1.1.1/32
!
route-policy ALLOW-FLOW-POLICY • Destination 1.1.2.1/32
if destination-prefix in ALLOW-FLOW then
pass
endif RP/0/RP0/CPU0:Client#sh flowspec ipv4 detail
end-policy AFI: IPv4
! Flow :Dest:1.1.1.1/32
router bgp 65117 Actions :Traffic-rate: 0 bps (bgp.1)
neighbor 25.2.1.14 RP/0/RP0/CPU0:Client#
remote-as 65117
update-source GigabitEthernet0/0/0/0
address-family ipv4 flowspec
route-policy ALLOW-FLOW-POLICY in
Only the 1.1.1.1/32 rule is accepted
! and configured.
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 111
Consistency Checking
Example: TCP with ICMP Code
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 112
For Your
Reference
Consistency Checking
Other Examples
class-map type traffic match-all c22 class-map type traffic match-all c23
match protocol icmp match protocol icmp
match tcp-flag 16 match destination-port 10
end-class-map end-class-map
RP/0/0/CPU0:CONTROLLER#show flowspec vrf foo2 ipv4 internal RP/0/0/CPU0:CONTROLLER#show flowspec vrf foo3 ipv4 internal
VRF: foo2 AFI: IPv4 VRF: foo3 AFI: IPv4
Flow :Proto:=1,TCPFlags:=0x10 Flow :Proto:=1,DPort:=10
Actions :DSCP: af11 (policy.1.p22.c22) Actions :DSCP: af11 (policy.1.p23.c23)
<... SNIP ...> <... SNIP ...>
Sequence: 1024 Sequence: 1024
Match Unsupported: TCP flags with non-TCP protocol Match Unsupported: Port with non-TCP/UDP protocol
Synced: FALSE Synced: FALSE
<... SNIP ...> <... SNIP ...>
Statistics (packets/bytes) Statistics (packets/bytes)
Matched : 0/0 Matched : 0/0
Transmitted : 0/0 Transmitted : 0/0
Dropped : 0/0 Dropped : 0/0
RP/0/0/CPU0:CONTROLLER# RP/0/0/CPU0:CONTROLLER#
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 113
Checking Counters with Netconf/XML
<<<SNIP>>>
<FlowTable>
• Proprietary models are available <Flow>
<Naming>
for configuration and monitoring <FlowNotation>
Dest:25.1.104.0/24
</FlowNotation>
</Naming>
<FlowStatistics>
<Classified>
<rpc message-id="101" <Packets>
xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> 21946725652
<get> </Packets>
<filter> <Bytes>
<Operational> 13958117514672
<FlowSpec></FlowSpec> </Bytes>
</Operational> </Classified>
</filter> <Dropped>
</get> <Packets>
</rpc>]]>]]> 21946488774
</Packets>
<Bytes>
13957966860264
</Bytes>
</Dropped>
</FlowStatistics>
</Flow>
<<</SNIP>>>
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 114
Netflow Sampling vs BGP flowspec
• Even if a BGP flowspec rule drops the packets, they are sampled and handled
by the linecard CPU.
Attack still detected
RP/0/RSP0/CPU0:Client#sh run int hundredGigE 0/0/0/0
interface HundredGigE0/0/0/0
description *** to Boca ***
cdp
ipv4 address 25.1.9.4 255.255.255.0
load-interval 30
flow ipv4 monitor MON-MAP-IP sampler SAM-MAP ingress
!
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 115
Netflow Sampling vs BGP flowspec
• Before applying the BGP FlowSpec rules, we check the NF cache:
RP/0/RSP0/CPU0:Client#sh flow monitor MON-MAP-IP cache location 0/0/CPU0
Cache summary for Flow Monitor MON-MAP-IP:
Cache size: 1000000
Current entries: 164916
Flows added: 2043769
<SNIP>
Flows exported 1878853
RP/0/RSP0/CPU0:Client#
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 116
Netflow Sampling vs BGP flowspec
• After applying the BGP FlowSpec rules, we check the NF cache:
RP/0/RSP0/CPU0:Client#sh flow monitor MON-MAP-IP cache location 0/0/CPU0
Cache summary for Flow Monitor MON-MAP-IP:
Cache size: 1000000
Current entries: 12706
Flows added: 1467559
<SNIP>
Flows exported 1454853
RP/0/RSP0/CPU0:Client#
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 117
ACL vs BGP flowspec
• It’s important that ACL is applied before the BGP FlowSpec action.
RP/0/RSP0/CPU0:Client#sh int hundredGigE 0/0/0/1 accounting rates
HundredGigE0/0/0/1
Ingress Egress
Protocol Bits/sec Pkts/sec Bits/sec Pkts/sec
IPV4_UNICAST 5065311000 458150 1000 2
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 118
ACL-Based Fwd (PBR) vs BGP flowspec
• Which one will take precedence ?
Before applying the BGP FS rule, on the Client side:
interface HundredGigE0/0/0/1
ipv4 address 25.1.104.4 255.255.255.0
ipv6 address 2001:25:1:104::4/64
AS 2 AS 1 load-interval 30
ipv4 access-group ABF ingress
XR-Services !
ipv4 access-list ABF
25.2.1.11
10 permit udp any host 25.1.102.1 nexthop1 ipv4 25.3.9.3
20 permit ipv4 any any
!
25.1.9.3 25.1.9.4
.1 Hu0/1/0/0 Hu0/0/0/0
102
25.1.102.3 Boca 25.3.9.3 25.3.9.4 Inter 25.1.104.4
104
Hu0/1/0/0.2 Hu0/0/0/0.2 Hu0/0/0/1
25.4.9.3 25.4.9.4
Hu0/1/0/0.3 Hu0/0/0/0.3
Traffic to 25.1.102.1
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 119
ACL-Based Fwd (PBR) vs BGP flowspec
• BGP FlowSpec action takes precedence over ABF/PBR
After applying the rule, traffic follows the BGP FlowSpec Redirect action.
RP/0/RSP0/CPU0:Client#sh flowspec ipv4 detail
AFI: IPv4
AS 2 AS 1 Flow
:Dest:25.1.102.1/32,Proto:=17,Length:>=500&<=1550
XR-Services Actions :Nexthop: 25.4.9.3 (bgp.1)
Statistics (packets/bytes)
25.2.1.11 Matched : 2217686/3104760400
Dropped : 0/0
RP/0/RSP0/CPU0:Client#
25.1.9.3 25.1.9.4
.1 Hu0/1/0/0 Hu0/0/0/0
102
25.1.102.3 Boca 25.3.9.3 25.3.9.4 Inter 25.1.104.4
104
Hu0/1/0/0.2 Hu0/0/0/0.2 Hu0/0/0/1
25.4.9.3 25.4.9.4
Hu0/1/0/0.3 Hu0/0/0/0.3
Traffic to 25.1.102.1
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 120
Caveats and Limitations
Too Late ?
Upstream Link Saturated
Victim
50G 10G
TenGE
Upstream Customer
Provider
Controller
FS rule
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 122
Configuring a Type 4 Match “Source or Dest Ports”
• We can receive Type4 messages on client but can not generate it on the
controller due to C3PL limitation
RP/0/0/CPU0:Ctrl(config)#show config failed
<SNIP>
class-map type traffic match-any MATCH-TYPE-4
match source-port 123
match destination-port 123
end-class-map
!
!!% Policy manager does not support this feature: Match all is the only mode supported
for match type "source-port" in class-map type "traffic"
End
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 123
Rate-limiter Shared per NPU
• A policer action will be applied at the NPU level and not at the port level
• Ex: you receive a 50Mbps police action, and FS is activated on three ports
• Te0/1/0/18 is assigned to one NPU
• Te0/1/0/10 and Te0/1/0/11 are assigned to a different NPU
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 125
ICMP Lists and Ranges
• FlowSpec rules for ICMP can only support one type and code
• No support for lists or ranges
• Decoded but not programmed in hardware
RP/0/RSP0/CPU0:Client#sh bgp ipv4 flowspec
Network Next Hop Metric LocPrf Weight Path
*>iICMPType:=1|=2|=3|=4|=5,ICMPCode:=1/112
0.0.0.0 100 0 i
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 127
Per Interface Selection
• Today implementation is binary, BGP FS applied or not applied on an interface
• XR: No current way to decide which FS rule should be applied on which
interface
• XE: interface-set draft is supported
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 128
Conclusion
BGP FlowSpec in SP Security
• Very powerful addition to your countermeasure tools
• Large adoption now in the industry
• Interoperable, Standard-based solution to remotely program actions on precisely
identified flows
• Particularly useful in DDoS mitigation architectures
• Filtering the stateless attacks on the Edge router, it offloads the scrubbing devices
• Allow redirection of only the attack traffic into the scrubbing device
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 130
Cisco Spark
Questions?
Use Cisco Spark to communicate
with the speaker after the session
How
1. Find this session in the Cisco Live Mobile App
2. Click “Join the Discussion”
3. Install Spark or go directly to the space
4. Enter messages/questions in the space
cs.co/ciscolivebot#BRKSPG-3012
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
• Please complete your Online Complete Your Online
Session Evaluations after each
session
Session Evaluation
• Complete 4 Session Evaluations
& the Overall Conference
Evaluation (available from
Thursday) to receive your Cisco
Live T-shirt
• All surveys can be completed via
the Cisco Live Mobile App or the
Communication Stations
Don’t forget: Cisco Live sessions will be available
for viewing on-demand after the event at
www.ciscolive.com/global/on-demand-library/.
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Continue Your Education
• Demos in the Cisco campus
• Walk-in Self-Paced Labs
• Lunch & Learn
• Meet the Engineer 1:1 meetings
• Related sessions
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 133
Thank you
Back-Up Slides
Other Use-Cases
DDoS Mitigation Models
Centralized
• A central point in the network is dedicated for hosting scrubbing devices
Peering
Scrubbing Center
Victim
Transit
Core
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 137
DDoS Mitigation Models
Centralized
• Traffic target to the victim is diverted to this place for analysis
Peering
Scrubbing Center
Victim
Transit
Core
Note: asymmetric traffic, i2o traffic doesn’t go through the scrubbing center
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 138
DDoS Mitigation Models
Distributed
• We install scrubbers at the edge of the backbone to tackle the attack as early as
possible Peering
Victim
Transit
Core
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 139
DDoS Mitigation Models
Mixed
• Specific attacks can be handled in the central point or to off-load the edge
systems Peering
Scrubbing Center
Victim
Transit
Core
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 140
L3VPN Network w/ Scrubbing Center
Currently deployed
• 2.1.1.1 is victim of a large size SYN attack. Traffic is transported in the GRT
or in a VRF “Internet”
2.1.1.0/24 J
IGP rtrA nh:rtrI
S
Collector
RR I F Victim
2.1.1.1
L H E C
M
2.1.1.0/24
2.1.1.0/24 K G D B A
rtrA nh:rtrK
L3VPN Network
IGP
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 141
L3VPN Network w/ Scrubbing Center
Currently deployed
IGP
2.1.1.0/24 @rtrA 0.0.0.0/0
MP-BGP
• VRF Dirty is configured on J and M nh:rtrI nh Router S
M
VRF
GRT
• MP-BGP is configured too, Dirty
default route is advertised static 10.51.51.51/32
VRF dirty @TMS
from @TMS in VRF Dirty J
a NH in VRF Dirty.
If matched, traffic will M
M
leak into this VRF Dirty 0.0.0.0/0
MP-BGP
nh Router S
• Now, traffic to 2.1.1.1 static 10.51.51.51/32
GRT
VRF
VRF dirty @TMS Dirty
uses the IGP route
IGP
2.1.1.0/24 @rtrA
2.1.1.0/24 nh:rtrK
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 142
L3VPN Network w/ Scrubbing Center
Currently deployed
0.0.0.0/0
MP-BGP
• A more specific 2.1.1.1/32 route nh Router S
M
BGP
is advertised via BGP and learnt 2.1.1.1/32
GRT
VRF
10.51.51.51 Dirty
in the GRT with NH the dummy
10.51.51.51/32
route 10.51.51.51 static VRF dirty @TMS
J
• A recursive lookup triggers the
S
leaking into VRF Dirty
MP-BGP VRF Dirty
RR RR 0.0.0.0/0 nh: Rtr S
IPv4 vpnv4
2.1.1.1/32
nh:10.51.51.51
Collector
M
M
BGP
2.1.1.1/32 0.0.0.0/0
10.51.51.51 nh Router S
MP-BGP
• Now attack traffic is
static 10.51.51.51/32 VRF
in VRF Dirty and VRF dirty @TMS GRT
Dirty
attracted to Router S
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 143
L3VPN Network w/ Scrubbing Center
Currently deployed
• CP advertises a BGP route for 2.1.1.1/32 with next-hop the dummy 10.51.51.51
BGP
2.1.1.1/32
10.51.51.51
@TMS
static
10.51.51.51/32
Collector J VRF dirty
nh: @TMS
BGP RR S
IPv4
2.1.1.1/32 I F Victim
nh:10.51.51.51
2.1.1.1
L H E C
M
K G D B A
BGP
2.1.1.1/32
10.51.51.51
static
10.51.51.51/32
VRF dirty
nh: @TMS
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 144
L3VPN Network w/ Scrubbing Center
Currently deployed
• Traffic with a VRF label Dirty is dragged to router S
• Router S is pushing unlabeled traffic to the TMS via an interface in VRF Dirty
@TMS
• Clean traffic is received in Te0/0/0/0.1: dirty
GRT and naturally routed S
Te0/0/0/0.2: clean
to the victim
1 label
F
2 labels 2 labels
E C Victim
2.1.1.1
2.1.1.0/24
D B A
Te0/1/0/0
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 145
L3VPN Network w/ Scrubbing Center
Improved with BGP FlowSpec
• BGP FlowSpec inject rules to redirect attack traffic into VRF dirty
• No more dummy route needed Collector
VRF dirty
• Only a default route in dirty VRF SrcIP:*
0.0.0.0/0
TCP SYN
is needed to reach the scrubber Dst:2.1.1.1/32 nh: @TMS
Size > 200B
J
• More granular “matching” parameters: Redirect
VRF dirty
only the packets with specific
RR
protocol/port/packet-size/etc IPv4 I
VRF dirty
are diverted in Dirty VRF 0.0.0.0/0
nh: @TMS
L H
M
K G
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 146
L3VPN Network w/ Scrubbing Center
Improved with BGP FlowSpec
static
VRF dirty
0.0.0.0/0
BGP FS nh: @TMS
Rule: dest-IP: 2.1.1.1
TCP SYN > 200B @TMS
Controller Action: NH: VRF Dirty
J
RR S
BGP FS
IPv4
Rule: dest-IP: 2.1.1.1
TCP SYN > 200B
I F Victim
Action: NH: VRF Dirty
2.1.1.1
L H E C
M
K G D B A
static
VRF dirty
0.0.0.0/0
nh: @TMS
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 147
Other BGP FS Use-Cases
Low QoS Priority Traffic for DDoS Attacks
• Important back-up is using 3 Gbps of traffic
Scrubbing Center
• Simultaneously, a DDoS attack starts and is
diverted to the scrubbing center S
• Links are not saturated
6G
L H C 3G Victim
2G M 3G 2.1.1.1
2G K G B A
2G
3G
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 148
Other BGP FS Use-Cases
Low QoS Priority Traffic for DDoS Attacks
• The attack intensity increases
Scrubbing Center
• Links are congested, it impacts internal traffic
S
8G
10G L H C 2G Victim
4G M 2G 2.1.1.1
4G K G B A
4G
3G
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 149
Other BGP FS Use-Cases
Low QoS Priority Traffic for DDoS Attacks w/ Flowspec
• BGP FS rule forces the route leaking in VRF-Dirty and positioning a DSCP field
BGP FS
7G
10G L H C 3G Victim
4G M 3G 2.1.1.1
4G K G B A
4G
3G
Routers will dropped attack traffic in priority in
case of congestion based on this DSCP field
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 150
Back-Up Slides
Configuration
For Your
Reference
<SNIP>
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 152
For Your
Reference
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 153
For Your
Reference
AFI: IPv4
NLRI (Hex dump) : 0x03010001118106
Actions :Traffic-rate: 100000 bps (bgp.1)
RP/0/RP0/CPU0:Client#
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 155
For Your
Reference
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 156
For Your
Reference
Option Byte
End And Len 0 Lt “<“ Gt “>” Eq “=“
81 1 0 00 0 0 0 1
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 157
For Your
Reference
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 158
For Your
Reference
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 159
For Your
Reference
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 160
For Your
Reference
Bitmask
0 0 0 lf ff isf df
0a 0 0 0 1 0 1 0
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 161
For Your
Reference
In this case, we used 2-byte long ASN for the Route Target definition.
It’s transported with extended community 0x8008
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 162
For Your
Reference
In this case, we used 4-byte long ASN for the Route Target definition.
It’s transported with extended community 0x8208
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 163
Back-Up Slides
Monitoring
Show Commands to Check BGP Flowspec Operation
• First, we verify the BGP session for the address-family Flowspec
RP/0/RP0/CPU0:Client#show bgp ipv4 flowspec
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 165
Configuring BGP FlowSpec on IOS XR Routers
Verifying the Session Establishment (on Client)
RP/0/RP0/CPU0:Client#sh bgp ipv4 flowspec summary
RP/0/RP0/CPU0:Client#
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 166
Show Commands
• Then, we can get more details for this particular rule
RP/0/RP0/CPU0:Client#show bgp ipv4 flowspec SPort:=80/24 detail
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 167
Show Commands
• Globally, we verify which interfaces are enable for FlowSpec
RP/0/RP0/CPU0:Client#show policy-map transient targets type pbr
RP/0/RP0/CPU0:Client#
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 168
Show Commands
• We verify also how are reconstructed these policies
RP/0/RP0/CPU0:Client#show policy-map transient type pbr pmap-name
__bgpfs_default_IPv4
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 169
Show Commands
• Globally, we verify which interfaces are enable for FlowSpec
RP/0/RP0/CPU0:Client#show flowspec afi-all detail
AFI: IPv4
Flow :SPort:=80
Actions :Traffic-rate: 314152 bps (bgp.1)
Statistics (packets/bytes)
Matched : 0/0
Transmitted : 0/0
Dropped : 0/0
RP/0/RP0/CPU0:Client#
AFI: IPv4
NLRI (Hex dump) : 0x068150
Actions :Traffic-rate: 314152 bps (bgp.1)
RP/0/RP0/CPU0:Client#
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 170
Show Commands
RP/0/RP0/CPU0:Client#show flowspec ipv4 internal
AFI: IPv4
Flow :SPort:=80
Actions :Traffic-rate: 314152 bps (bgp.1)
Client Version: 0
Unsupported: FALSE
RT:
VRF Name Cfg: 0x00
RT Cfg: 0x00
RT Registered: 0x00
RT Resolved: 0x00
Class handles:
Handle [0]: 300000007600000a
Class Handle Version: 1
Sequence: 1024
Synced: TRUE
Match Unsupported: None
Ref Count: 1
Last Error: 0:No error
Last Batch: 9
Statistics (packets/bytes)
Matched : 0/0
Transmitted : 0/0
Dropped : 0/0
RP/0/RP0/CPU0:Client# © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 171
Show Commands
• On a CRS client, we check the TCAM usage on the linecard
RP/0/RP0/CPU0:CRS-3#show contr pse tcam summary location 0/0/CPU0
<SNIP>
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 172
Show Commands
• On a ASR9000 client, we can also check the TCAM entries in some extend
RP/0/RSP0/CPU0:ASR9000#sh prm server tcam summary all PBR np0 location 0/0/CPU0
Node: 0/0/CPU0:
----------------------------------------------------------------
TCAM summary for NP0:
RP/0/RSP0/CPU0:ASR9000#
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 173
Show Commands
• On a NCS6000 client too
attach location 0/1/CPU0
pbtm_show -n 0 -s
On the Client:
- debug flowspec all
- show flowspec trace manager event error
- show flowspec trace client event error
- show flowspec client internal
- show logging | inc FLOW
- show flowspec vrf all afi-all summary internal
- show flowspec vrf all afi-all internal
- show tech flowspec
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 175
Show Commands
• To measure the traffic matched, no SNMP but CLI and Netconf/XML.
RP/0/RP0/CPU0:Client#show flowspec ipv4 detail
AFI: IPv4
Flow :Dest:25.1.104.0/24
Actions :Traffic-rate: 100000 bps (bgp.1)
Statistics (packets/bytes)
Matched : 21946725652/13958117514672
Transmitted : 236878/150654408
Dropped : 21946488774/13957966860264
Flow :Proto:=17,DPort:=53
Actions :Traffic-rate: 1234000000 bps (bgp.1)
Statistics (packets/bytes)
Matched : 0/0
Transmitted : 0/0
Dropped : 0/0
RP/0/RP0/CPU0:Client#
Counters for each rule are available per VRF / address-family, not per interface.
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 176
eBGP FlowSpec router bgp 1
neighbor 25.2.1.3 Controller
remote-as 2
update-source GigabitEthernet0/0/0/0
address-family ipv4 flowspec
route-policy pass-all in
route-policy pass-all out
next-hop-unchanged
!
neighbor 25.2.1.4
remote-as 1
update-source GigabitEthernet0/0/0/0
Client eBGP address-family ipv4 flowspec
Client iBGP
router bgp 2
address-family ipv4 flowspec
XR-Services router bgp 1
address-family ipv4 flowspec
!
!
neighbor 25.2.1.11
neighbor 25.2.1.10
remote-as 1
remote-as 1
update-source TenGigE0/2/0/8
update-source TenGigE0/2/0/6
address-family ipv4 unicast
address-family ipv4 unicast
!
!
address-family ipv4 flowspec
address-family ipv4 flowspec
route-policy pass-all in
route-policy pass-all out Client Client !
!
validation disable
!
!
!
AS 2 AS 1
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 177
eBGP FlowSpec: Validate Disable
Without the “Validate disable”, a check on AS Path is done and the route is not
accepted.
RP/0/RP0/CPU0:Client#sh bgp ipv4 flowspec Dest:25.1.104.1/32,Proto:=17,Length:>=500&<=1550/128 detail
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 178
eBGP FlowSpec: Next-Hop Unchanged
• Without the “NH unchanged” configuration, the NH action will not work on eBGP
• NH will be, by default, positioned as the peer address
XR-Services
25.2.1.11
25.2.1.3
Client Client
102 104
Hu0/0/0/0 Hu0/1/0/0 Hu0/0/0/0 Hu0/0/0/1
25.1.9.3 25.1.9.4
AS 2 AS 1
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 179
eBGP FlowSpec: Next-Hop Unchanged
Controller eBGP Client
policy-map type pbr TEST RP/0/RP0/CPU0:Client#sh bgp ipv4 flowspec
class type traffic MATCHING-RULE1 <SNIP>
redirect nexthop 25.3.9.4 Network Next Hop Metric LocPrf Weight Path
! *> Dest:25.1.102.1/32,Proto:=17,Length:>=500&<=1550/128
class type traffic class-default 25.2.1.11 0 1 i
!
end-policy-map Processed 1 prefixes, 1 paths
RP/0/RP0/CPU0:Client#
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 180
IOS XR Implementation
Application on Interface
• Uses the PBR infrastructure with similar performance penalty than other PBR
features like ABF. Performance cost will vary depending upon the action
• DSCP marking will be least expensive
• redirect action pointing to recursive TE tunnel path being most expensive
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 181
Back-Up Slides
3rd Party
Controller
BGP FlowSpec with 3rd Party Apps
• BGP FlowSpec is based on IETF standard
• It can interoperate with non-Cisco devices compliant to the standards
• Following list in offering a few controllers examples and is non-exhaustive
• Arbor SP
• ExaBGP
• YABGP
• Open Day Light
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 183
Using Arbor SP
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 184
Using Arbor SP
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 185
Using Arbor SP
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 186
Using Arbor SP
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 187
Using Arbor SP
BRKSPG-3012 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 188
For Your
Reference
Using ExaBGP
flow {
route name-of-the-route {
match {
source 10.0.0.1/32;
destination 192.168.0.1/32;
neighbor 10.0.0.1 { port =80 =8080;
description "xrv 5.2.0"; destination-port >8080&<8088 =3128;
router-id 192.168.2.26; source-port >1024;
local-address 192.168.2.26; protocol [ tcp udp ];
local-as 65000; packet-length >200&<300 >400&<500;
#fragment not-a-fragment;
peer-as 65000;
fragment [ first-fragment last-fragment ];
graceful-restart 5; icmp-type [ unreachable echo-request echo-reply ];
icmp-code [ host-unreachable network-unreachable ];
flow { tcp-flags [ urgent rst ];
route name-of-the-route { dscp [ 10 20 ];
match { ...
<<<description>>> }
} then {
then { ... #rate-limit 9600;
#discard;
<<<action>>>
redirect 65500:12345;
} #redirect 1.2.3.4:5678;
} community [30740:0 30740:30740];
#extended-community [ origin:2345:6.7.8.9 origin:2.3.4.5:6789 ];
}
}
}
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
<flowspec> For Your
<source-ports> Reference
Using Open Day Light <op>greater-than end-of-list</op>
<value>1024</value>
<flowspec-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-flowspec"> </source-ports>
<route-key>flow1</route-key> </flowspec>
<flowspec> <flowspec>
<destination-prefix>192.168.0.1/32</destination-prefix> <types>
</flowspec> <op>equals end-of-list</op>
<flowspec> <value>0</value>
<source-prefix>10.0.0.1/32</source-prefix> </types>
</flowspec> </flowspec>
<flowspec> <flowspec>
<protocol-ips> <codes>
<op>equals end-of-list</op> <op>equals end-of-list</op>
<value>6</value> <value>0</value>
</protocol-ips> </codes>
</flowspec> </flowspec>
<flowspec> <flowspec>
<ports> <tcp-flags>
<op>equals end-of-list</op> <op>match end-of-list</op>
<value>80</value> <value>32</value>
</ports> </tcp-flags>
</flowspec> </flowspec>
<flowspec> <flowspec>
<destination-ports> <packet-lengths>
<op>greater-than</op> <op>greater-than</op>
<value>8080</value> <value>400</value>
</destination-ports> </packet-lengths>
<destination-ports> <packet-lengths>
<op>and-bit less-than end-of-list</op> <op>and-bit less-than end-of-list</op>
<value>8088</value> <value>500</value>
</destination-ports> </packet-lengths>
</flowspec> </flowspec>
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public