{"id":13430,"date":"2024-01-30T11:29:31","date_gmt":"2024-01-30T14:29:31","guid":{"rendered":"https:\/\/made4it.com.br\/what-and-flowspec-how-to-use-flowspec-to-mitigate-ddos-attacks\/"},"modified":"2024-02-15T09:19:15","modified_gmt":"2024-02-15T12:19:15","slug":"what-and-flowspec-how-to-use-flowspec-to-mitigate-ddos-attacks","status":"publish","type":"post","link":"https:\/\/made4it.com.br\/en\/what-and-flowspec-how-to-use-flowspec-to-mitigate-ddos-attacks\/","title":{"rendered":"What is FlowSpec? How to use FlowSpec to mitigate DDoS attacks?"},"content":{"rendered":"\n<p>Today we&#8217;re going to talk a bit about BGP Flowspec and its effectiveness in mitigating DDoS attacks.  <\/p>\n\n<h2 class=\"wp-block-heading\"><strong>What is Flowspec?<\/strong> <\/h2>\n\n<p><strong>BGP Flow Specification (Flowspec)<\/strong> is defined in <strong>RFC 5575<\/strong><em>(Dissemination of Flow Specification Rules)<\/em>,<em> <\/em>defines how <strong>Flowspec<\/strong> is used to distribute flow rules through the BGP protocol.  <\/p>\n\n<p>Basically, <strong>Flowspec<\/strong> is an extension of the BGP protocol that allows routers to apply rules such as dynamic ACLs or dynamic firewall rules to specific types of traffic. These rules can be based on a variety of criteria, including source, destination, protocol, port and so on.  <\/p>\n\n<p>Below is a table with all the possibilities for classifying Flowspec traffic:  <\/p>\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>BGP Flowspec NLRI Type<\/strong> <\/td><td><strong>QoS Match Fields<\/strong> <\/td><\/tr><tr><td>Type 1  <\/td><td>Destination IP \/ IPv6 address  <\/td><\/tr><tr><td>Type 2  <\/td><td>Source IP \/ IPv6 address  <\/td><\/tr><tr><td>Type 3  <\/td><td>IP \/ IPv6 Protocol  <\/td><\/tr><tr><td>Type 4  <\/td><td>Source or destination port  <\/td><\/tr><tr><td>Type 5  <\/td><td>Destination port  <\/td><\/tr><tr><td>Type 6  <\/td><td>Source port  <\/td><\/tr><tr><td>Type 7  <\/td><td>ICMP Type <\/td><\/tr><tr><td>Type 8  <\/td><td>ICMP Code  <\/td><\/tr><tr><td>Type 9  <\/td><td>TCP flags  <\/td><\/tr><tr><td>Type 10  <\/td><td>Packet length  <\/td><\/tr><tr><td>Type 11  <\/td><td>DSCP  <\/td><\/tr><tr><td>Type 12  <\/td><td>Fragmentation bits  <\/td><\/tr><\/tbody><\/table><\/figure>\n\n<p>These types of classification can also be combined, for example:  <\/p>\n\n<p>Flow with Source 8.8.8.8\/32 source UDP port 53.  <\/p>\n\n<p>Based on the traffic classifications above (from the table or a combination thereof as in the example), we can take the following actions:  <\/p>\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Type<\/strong> <\/td><td><strong>Description<\/strong> <\/td><td><strong>PBR Action<\/strong> <\/td><\/tr><tr><td>0x8006  <\/td><td>traffic-rate  <\/td><td>Drop | Police  <\/td><\/tr><tr><td>0x8007  <\/td><td>traffic-action  <\/td><td>Terminal Action + Sampling  <\/td><\/tr><tr><td>0x8008  <\/td><td>redirect-vrf  <\/td><td>Redirect VRF  <\/td><\/tr><tr><td>0x8009  <\/td><td>traffic-marking  <\/td><td>Set DSCP  <\/td><\/tr><tr><td>0x0800  <\/td><td>Redirect IP NH  <\/td><td>Redirect IPv4 or IPv6 Next-Hop  <\/td><\/tr><\/tbody><\/table><\/figure>\n\n<h2 class=\"wp-block-heading\"><strong>How does Flowspec work?<\/strong> <\/h2>\n\n<figure data-wp-context=\"{&quot;imageId&quot;:&quot;69da60647e350&quot;}\" data-wp-interactive=\"core\/image\" class=\"wp-block-image size-full is-style-default wp-lightbox-container\"><img fetchpriority=\"high\" decoding=\"async\" width=\"666\" height=\"508\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/made4it.com.br\/wp-content\/uploads\/2024\/01\/1-3.png\" alt=\"What is Flowspec?  \" class=\"wp-image-13300\" srcset=\"https:\/\/made4it.com.br\/wp-content\/uploads\/2024\/01\/1-3.png 666w, https:\/\/made4it.com.br\/wp-content\/uploads\/2024\/01\/1-3-300x229.png 300w\" sizes=\"(max-width: 666px) 100vw, 666px\" \/><button\n\t\t\tclass=\"lightbox-trigger\"\n\t\t\ttype=\"button\"\n\t\t\taria-haspopup=\"dialog\"\n\t\t\taria-label=\"Enlarge image: What is Flowspec?  \"\n\t\t\tdata-wp-init=\"callbacks.initTriggerButton\"\n\t\t\tdata-wp-on-async--click=\"actions.showLightbox\"\n\t\t\tdata-wp-style--right=\"state.imageButtonRight\"\n\t\t\tdata-wp-style--top=\"state.imageButtonTop\"\n\t\t>\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewBox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\" \/>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure>\n\n<p>For <strong>FlowSpec <\/strong>to work, it is necessary to close the BGP FlowSpec sessions between the BGP Router called in the Edge Topology and the Server\/Router that generates the FlowSpec rules, which in our topology is Made4Flow.  <\/p>\n\n<p>In this way, <strong>FlowSpec <\/strong>works by sending a special BGP message to the router. This message contains a list of flow rules that the router must apply. Flow rules can be applied to all flows that pass through the router or only to specific flows, just as in a firewall rule you can choose the firewall rule you can choose which flow you want to apply an action to.  <\/p>\n\n<p>If your Operator or Transit supports  <strong>FlowSpec<\/strong>it is important to request the sessions  <strong>BGP FlowSpec<\/strong>so we can send the rules of  <strong>FlowSpec  <\/strong>to be applied directly to your operator&#8217;s equipment, so that malicious traffic will not reach our equipment, thus avoiding overloading your links.  <\/p>\n\n<h2 class=\"wp-block-heading\"><strong>How can FlowSpec help against DDoS attacks?<\/strong> <\/h2>\n\n<p>To use <strong>FlowSpec to mitigate DDoS attacks<\/strong>, you need to use an attack detection tool that generates <strong>FlowSpec <\/strong>rules, such as <strong>\n  <a href=\"https:\/\/made4flow.com.br\/\" target=\"_blank\" rel=\"noopener\" title=\"\">Made4Flow<\/a>\n<\/strong>.  <\/p>\n\n<p>When the <strong>Netflow Network Analyzer detects a DDoS attack<\/strong>, it generates a special BGP message that contains the flow rules needed to mitigate the attack. This message is then sent to the router, which applies the rules and prevents malicious traffic from reaching its final destination, as shown in the example below, where we see a blocking rule for a destination IP and ICMP type 0 or 8:  <\/p>\n\n<figure data-wp-context=\"{&quot;imageId&quot;:&quot;69da60647e8de&quot;}\" data-wp-interactive=\"core\/image\" class=\"wp-block-image size-full is-resized wp-lightbox-container\"><img decoding=\"async\" width=\"624\" height=\"296\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/made4it.com.br\/wp-content\/uploads\/2024\/01\/2-3.png\" alt=\"What is Flowspec?  \" class=\"wp-image-13303\" style=\"width:631px;height:auto\" srcset=\"https:\/\/made4it.com.br\/wp-content\/uploads\/2024\/01\/2-3.png 624w, https:\/\/made4it.com.br\/wp-content\/uploads\/2024\/01\/2-3-300x142.png 300w\" sizes=\"(max-width: 624px) 100vw, 624px\" \/><button\n\t\t\tclass=\"lightbox-trigger\"\n\t\t\ttype=\"button\"\n\t\t\taria-haspopup=\"dialog\"\n\t\t\taria-label=\"Enlarge image: What is Flowspec?  \"\n\t\t\tdata-wp-init=\"callbacks.initTriggerButton\"\n\t\t\tdata-wp-on-async--click=\"actions.showLightbox\"\n\t\t\tdata-wp-style--right=\"state.imageButtonRight\"\n\t\t\tdata-wp-style--top=\"state.imageButtonTop\"\n\t\t>\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewBox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\" \/>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure>\n\n<p>Another way to use <strong>FlowSpec to mitigate DDoS attacks<\/strong> is to use <strong>FlowSpec <\/strong>to <strong>limit the rate of traffic that can be sent to a given destination<\/strong>. This can help prevent a <strong>DDoS <\/strong>attack from saturating the destination&#8217;s bandwidth, as in the example below:  <\/p>\n\n<figure data-wp-context=\"{&quot;imageId&quot;:&quot;69da60647ed54&quot;}\" data-wp-interactive=\"core\/image\" class=\"wp-block-image size-full wp-lightbox-container\"><img decoding=\"async\" width=\"624\" height=\"239\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/made4it.com.br\/wp-content\/uploads\/2024\/01\/3-2.png\" alt=\"What is Flowspec?  \" class=\"wp-image-13306\" srcset=\"https:\/\/made4it.com.br\/wp-content\/uploads\/2024\/01\/3-2.png 624w, https:\/\/made4it.com.br\/wp-content\/uploads\/2024\/01\/3-2-300x115.png 300w\" sizes=\"(max-width: 624px) 100vw, 624px\" \/><button\n\t\t\tclass=\"lightbox-trigger\"\n\t\t\ttype=\"button\"\n\t\t\taria-haspopup=\"dialog\"\n\t\t\taria-label=\"Enlarge image: What is Flowspec?  \"\n\t\t\tdata-wp-init=\"callbacks.initTriggerButton\"\n\t\t\tdata-wp-on-async--click=\"actions.showLightbox\"\n\t\t\tdata-wp-style--right=\"state.imageButtonRight\"\n\t\t\tdata-wp-style--top=\"state.imageButtonTop\"\n\t\t>\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewBox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\" \/>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure>\n\n<p>As we saw in the examples above, <strong>FlowSpec <\/strong>sends rules to drop or <strong><em>rate-limit<\/em><\/strong> the attacked prefixes or IP(s). In this way, we ensure that the <strong>DDoS attack does not pass from our BGP\/Borda router into the network<\/strong>. For <strong>FlowSpec to be more effective against DDoS attacks<\/strong>, it is important to establish a <strong>BGP FlowSpec<\/strong> session  with their operators, thus increasing the effectiveness of the protection and the blocking can be done directly on the equipment and Routers of your operator and the attack preventing packets and traffic from reaching your equipment preventing your routers from suffering from high CPU, link overload and even loss of communication with your equipment.  <\/p>\n\n<p>Unfortunately, not all operators offer <strong>BGP FlowSpec<\/strong> sessions. Check with your operators and, if possible, set up <strong>BGP FlowSpec <\/strong>sessions so that if you experience DDoS attacks, you can reduce the impact on your network and increase your protection by creating the rules directly on your routers.  <\/p>\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n<p><strong>BGP FlowSpec<\/strong> is an effective tool that can be used to <strong>mitigate DDoS attacks of all sizes<\/strong>. Using <strong>FlowSpec<\/strong>, network administrators can <strong>direct DDoS traffic to a mitigation point or limit the rate of traffic that can be sent to a particular destination<\/strong>.  <\/p>\n\n<p>Stay tuned for the next few articles, as we&#8217;ll be talking about how to configure <strong>BGP FlowSpec<\/strong> sessions on different manufacturers such as <strong>Huawei, Juniper, Cisco, Nokia and various other models and brands<\/strong>.  <\/p>\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-vivid-cyan-blue-background-color has-background wp-element-button\" href=\"https:\/\/made4flow.com.br\/\" target=\"_blank\" rel=\"noreferrer noopener\">Get to know Made4Flow<\/a><\/div>\n<\/div>\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"218\" src=\"https:\/\/made4it.com.br\/wp-content\/uploads\/2024\/01\/4-2.png\" alt=\"What is Flowspec?  \" class=\"wp-image-13309\" srcset=\"https:\/\/made4it.com.br\/wp-content\/uploads\/2024\/01\/4-2.png 800w, https:\/\/made4it.com.br\/wp-content\/uploads\/2024\/01\/4-2-300x82.png 300w, https:\/\/made4it.com.br\/wp-content\/uploads\/2024\/01\/4-2-768x209.png 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Basically, Flowspec is an extension of the BGP protocol that allows routers to apply rules such as dynamic ACLs or dynamic firewall rules to specific types of traffic. These rules can be based on a variety of criteria, including source, destination, protocol, port and so on.  <\/p>\n","protected":false},"author":13,"featured_media":13313,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"postBodyCss":"","postBodyMargin":[],"postBodyPadding":[],"postBodyBackground":{"backgroundType":"classic","gradient":""},"footnotes":""},"categories":[317,320,778,779,730,327],"tags":[780,362,781],"class_list":["post-13430","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-about-made4flow","category-bgp-en","category-ddos-en","category-flowspec-en","category-made4flow-en","category-netflow-en","tag-flowspec-en","tag-made4flow-en","tag-what-is-flowspec"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/made4it.com.br\/en\/wp-json\/wp\/v2\/posts\/13430","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/made4it.com.br\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/made4it.com.br\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/made4it.com.br\/en\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/made4it.com.br\/en\/wp-json\/wp\/v2\/comments?post=13430"}],"version-history":[{"count":3,"href":"https:\/\/made4it.com.br\/en\/wp-json\/wp\/v2\/posts\/13430\/revisions"}],"predecessor-version":[{"id":13433,"href":"https:\/\/made4it.com.br\/en\/wp-json\/wp\/v2\/posts\/13430\/revisions\/13433"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/made4it.com.br\/en\/wp-json\/wp\/v2\/media\/13313"}],"wp:attachment":[{"href":"https:\/\/made4it.com.br\/en\/wp-json\/wp\/v2\/media?parent=13430"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/made4it.com.br\/en\/wp-json\/wp\/v2\/categories?post=13430"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/made4it.com.br\/en\/wp-json\/wp\/v2\/tags?post=13430"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}