{"id":13,"date":"2017-05-17T17:27:00","date_gmt":"2017-05-17T17:27:00","guid":{"rendered":"https:\/\/jay-miah.co.uk\/?p=13"},"modified":"2024-11-17T17:35:46","modified_gmt":"2024-11-17T17:35:46","slug":"bpdu-filter-and-its-potential-to-cause-a-network-loop","status":"publish","type":"post","link":"https:\/\/jay-miah.co.uk\/index.php\/bpdu-filter-and-its-potential-to-cause-a-network-loop\/","title":{"rendered":"BPDU Filter and its Potential to Cause a Network Loop"},"content":{"rendered":"\n<p>BPDU Guard, BPDU Filter, Root Guard and Loop Guard are all considered spanning tree security features, they all have different characteristics as to what they protect and how they work. Spanning tree attacks can harm the data-plane at Layer 2 therefore using spanning tree security we can mitigate \u201cMan in the Middle\u201d type attacks, protect against changes in the spanning tree topology, protect the \u201cRoot Bridge\u201d and prevent overall network loops.<\/p>\n\n\n\n<p>Spanning-tree \u201cBPDU Filter\u201d works similar to \u201cBPDU Guard\u201d, as it allows you to block BPDU\u2019s. The major difference is that \u201cBPDU Guard\u201d will place an interface that receives the BPDU into an \u201cerr-disabled\u201d state pretty much protecting the violating port while \u201cBPDU Filter\u201d just \u201cfilters\u201d it leaving the port to stay up. If a user connects a switch on these ports, potentially this will cause a network loop. You must be careful if you are using BPDU filter and this should only be configured on interfaces in \u201cAccess Mode\u201d which connect back to a \u201cHost\u201d device. This should never be configured on interfaces that connect to other switches.<\/p>\n\n\n\n<p>BPDU Filter can be configured globally or on a port by port basis, and there is a difference between the two<\/p>\n\n\n\n<p><strong>Global<\/strong> \u2013 If BPDU filter is enabled globally, then any interface with \u201cPortfast\u201d configured will not send or receive any BPDU\u2019s. However, when the port does receive a BPDU then it will lose its \u201cPortfast\u201d status, disable BPDU Filtering and act as a normal port.<\/p>\n\n\n\n<p><strong>Port by Port<\/strong> \u2013 If BPDU Filter is enabled on a port by port basis, the port will ignore incoming BPDU\u2019s and it will also not send out any BPDU\u2019s. This is the same as disabling spanning tree.<\/p>\n\n\n\n<p><strong>Network Loop example <\/strong><\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color\"><strong>Warning: do not carry out anything outlined in this guide on a live network, and always ensure you have the relevant permissions if you are testing this out for yourself, this should only be done in a lab environment or test network. This document is for the purpose of understanding how the technology works.<\/strong><\/p>\n\n\n\n<p>In the example below we will configure \u201cBPDU Filter\u201d on the switch interfaces individually, then we will connect these ports back to switches. The example will demonstrate a broadcast storm and how the technology is capable of taking down a network if it is used incorrectly. The below has been setup in GNS3, however the same applies to physical kit. Basic network connectivity has been configured and RSTP is blocking \u201cE0\/1\u201d on \u201cSW-2\u201d<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"558\" height=\"280\" src=\"https:\/\/jay-miah.co.uk\/wp-content\/uploads\/2022\/11\/word-image-13-1.png\" alt=\"\" class=\"wp-image-14\"\/><\/figure>\n\n\n\n<p>Lets Begin\u2026<\/p>\n\n\n\n<p><strong>Step 1:<\/strong> lets take a look at the Spanning-tree topology as it looks before we enable BPDU Filter<\/p>\n\n\n\n<p><strong>SW-1<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>show spanning-tree<\/code><\/pre>\n\n\n\n<p>From the output below we can see that the switch is running RSTP, \u201cSW-1\u201d is the root bridge and all the ports on the root are forwarding.<\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" width=\"709\" height=\"429\" class=\"wp-image-15\" src=\"https:\/\/jay-miah.co.uk\/wp-content\/uploads\/2022\/11\/word-image-13-2.jpeg\"><\/p>\n\n\n\n<p><strong>SW-2<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>show spanning-tree<\/code><\/pre>\n\n\n\n<p>On \u201cSW-2\u201d we can see that it is also running RSTP, the MAC address of the root bridge is \u201caabb.cc00.0300\u201d which is the MAC of \u201cSW-1\u201d. Interface \u201cE0\/0\u201d is the root port and \u201cE0\/1\u201d is being blocked to prevent the loop.<\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" width=\"708\" height=\"450\" class=\"wp-image-16\" src=\"https:\/\/jay-miah.co.uk\/wp-content\/uploads\/2022\/11\/word-image-13-3.jpeg\"><\/p>\n\n\n\n<p><strong>Step 2:<\/strong> Lets take a look at the CPU usage of both switches<\/p>\n\n\n\n<p><strong>SW-1<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>show process cpu<\/code><\/pre>\n\n\n\n<p>We can see that they utilization is very low, as we would expect to see.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"141\" src=\"https:\/\/jay-miah.co.uk\/wp-content\/uploads\/2022\/11\/c-users-acitjxm-appdata-local-microsoft-windows-i.jpeg\" alt=\"C:\\Users\\acitjxm\\AppData\\Local\\Microsoft\\Windows\\INetCache\\Content.Word\\3.jpg\" class=\"wp-image-17\"\/><\/figure>\n\n\n\n<p><strong>SW-2<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>show process cpu<\/code><\/pre>\n\n\n\n<p>\u201cSW-2 CPU\u201d utilization is also low<\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" width=\"706\" height=\"186\" class=\"wp-image-18\" src=\"https:\/\/jay-miah.co.uk\/wp-content\/uploads\/2022\/11\/word-image-13-5.jpeg\"><br>As these devices are running of a VM in GNS 3 let\u2019s take a look at the CPU usage of the GNS3 VM.<\/p>\n\n\n\n<p>We can that it is operating normally with a low utilization<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"278\" height=\"88\" src=\"https:\/\/jay-miah.co.uk\/wp-content\/uploads\/2022\/11\/c-users-acitjxm-appdata-local-microsoft-windows-i-1.jpeg\" alt=\"C:\\Users\\acitjxm\\AppData\\Local\\Microsoft\\Windows\\INetCache\\Content.Word\\3.jpg\" class=\"wp-image-19\"\/><\/figure>\n\n\n\n<p><strong>Step 3:<\/strong> Configure BPDU Filter on both switch interfaces.<\/p>\n\n\n\n<p><strong>SW-1<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>conf t\nint e0\/1\nswitchport mode access\nswitchport access vlan 1\nspanning-tree bpdufilter enable\nspanning-tree portfast  (Not required to make BPDU Filter work)<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" width=\"707\" height=\"108\" class=\"wp-image-20\" src=\"https:\/\/jay-miah.co.uk\/wp-content\/uploads\/2022\/11\/word-image-13-7.jpeg\"><\/p>\n\n\n\n<p><strong>SW-2<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>conf t\nint e0\/1\nswitchport mode access\nswitchport access vlan 1\nspanning-tree bpdufilter enable\nspanning-tree portfast (Not required to make BPDU Filter work)<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" width=\"708\" height=\"123\" class=\"wp-image-21\" src=\"https:\/\/jay-miah.co.uk\/wp-content\/uploads\/2022\/11\/word-image-13-8.jpeg\"><\/p>\n\n\n\n<p><strong>Step 4:<\/strong> Lets take a look at the Spanning-tree topology,<\/p>\n\n\n\n<p><strong>SW-1<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>show spanning-tree<\/code><\/pre>\n\n\n\n<p>As \u201cSW-1\u201d was the root bridge initially, nothing has changed on this switch, all ports are still forwarding.<\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" width=\"708\" height=\"423\" class=\"wp-image-22\" src=\"https:\/\/jay-miah.co.uk\/wp-content\/uploads\/2022\/11\/word-image-13-9.jpeg\"><\/p>\n\n\n\n<p><strong>SW-2<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>show spanning-tree<\/code><\/pre>\n\n\n\n<p>On \u201cSW-2\u201d we can see that the Spanning-tree topology has changed, as we are no longer sending and receiving BPDU\u2019s on \u201cE0\/1\u201d the port has transitioned from a blocking state and into a forwarding state. This now means that the port is no longer blocking traffic and there is a loop between the switches. If a broadcast enters the network, it will keep going round and round without any end. On a production network this will mean a network death as thousands of broadcast frames keep looping continuously.<\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" width=\"709\" height=\"443\" class=\"wp-image-23\" src=\"https:\/\/jay-miah.co.uk\/wp-content\/uploads\/2022\/11\/word-image-13-10.jpeg\"><\/p>\n\n\n\n<p><strong>Step 5:<\/strong> Generate some broadcast on the network, from \u201cSW-1\u201d ping \u201cSW-2\u201d<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ping 192.168.1.2<\/code><\/pre>\n\n\n\n<p>The first response is lost due to ARP, which is the broadcast. The network is now going to keep looping this broadcast, and if enough broadcast enters the loop the switches will become unresponsive and experience a high CPU utilisation.<\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" width=\"707\" height=\"82\" class=\"wp-image-24\" src=\"https:\/\/jay-miah.co.uk\/wp-content\/uploads\/2022\/11\/word-image-13-11.jpeg\"><br>From \u201cSW-2\u201d generate more broadcast traffic<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ping 192.168.1.1<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>ping 192.168.10.1<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"708\" height=\"133\" src=\"https:\/\/jay-miah.co.uk\/wp-content\/uploads\/2022\/11\/c-users-acitjxm-appdata-local-microsoft-windows-i-2.jpeg\" alt=\"C:\\Users\\acitjxm\\AppData\\Local\\Microsoft\\Windows\\INetCache\\Content.Word\\11.jpg\" class=\"wp-image-25\"\/><\/figure>\n\n\n\n<p>Both \u201cSW-1\u201d and \u201cSW-2\u201d have become unresponsive, as they are not responding we can\u2019t check the CPU utilization, my expectation is that they will be at 100%, if this was physical kit we might have been able to check.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"711\" height=\"57\" src=\"https:\/\/jay-miah.co.uk\/wp-content\/uploads\/2022\/11\/word-image-13-13.jpeg\" alt=\"\" class=\"wp-image-26\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"707\" height=\"48\" src=\"https:\/\/jay-miah.co.uk\/wp-content\/uploads\/2022\/11\/c-users-acitjxm-appdata-local-microsoft-windows-i-3.jpeg\" alt=\"C:\\Users\\acitjxm\\AppData\\Local\\Microsoft\\Windows\\INetCache\\Content.Word\\13.jpg\" class=\"wp-image-27\"\/><\/figure>\n\n\n\n<p>Looking at the GNS3 VM the CPU has spiked to 100%<\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" width=\"280\" height=\"105\" class=\"wp-image-28\" src=\"https:\/\/jay-miah.co.uk\/wp-content\/uploads\/2022\/11\/word-image-13-15.jpeg\"><br>Also on physical kit, at this point the lights would flash continuously really fast.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"480\" height=\"272\" src=\"https:\/\/jay-miah.co.uk\/wp-content\/uploads\/2017\/05\/Webp.net-gifmaker.gif\" alt=\"\" class=\"wp-image-604\"\/><\/figure>\n\n\n\n<p><strong>Global Configuration Example <\/strong><\/p>\n\n\n\n<p><strong>Step 1. <\/strong>Configure BPDU Filter globally<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>spanning-tree portfast bpdufilter default (GNS3 CMD \u2013 spanning-tree portfast edge bpdufilter default)<\/code><\/pre>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" width=\"709\" height=\"53\" class=\"wp-image-29\" src=\"https:\/\/jay-miah.co.uk\/wp-content\/uploads\/2022\/11\/word-image-13-16.jpeg\"><\/p>\n\n\n\n<p><strong>Step 2.<\/strong> Allow ports to participate in BPDU Filter<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>int e0\/0\nspanning-tree portfast<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"707\" height=\"39\" src=\"https:\/\/jay-miah.co.uk\/wp-content\/uploads\/2022\/11\/word-image-13-17.jpeg\" alt=\"\" class=\"wp-image-30\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>BPDU Guard, BPDU Filter, Root Guard and Loop Guard are all considered spanning tree security features, they all have different characteristics as to what they<\/p>\n","protected":false},"author":1,"featured_media":129,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,6,9],"tags":[19,14,15,20,21,22,16,23,13],"class_list":["post-13","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-network","category-security","category-switching","tag-arp","tag-bpdu","tag-bpdu-filter","tag-broadcast","tag-loop","tag-rstp","tag-spanning-tree","tag-stp","tag-switching"],"_links":{"self":[{"href":"https:\/\/jay-miah.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/13","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jay-miah.co.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jay-miah.co.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jay-miah.co.uk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jay-miah.co.uk\/index.php\/wp-json\/wp\/v2\/comments?post=13"}],"version-history":[{"count":11,"href":"https:\/\/jay-miah.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/13\/revisions"}],"predecessor-version":[{"id":605,"href":"https:\/\/jay-miah.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/13\/revisions\/605"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/jay-miah.co.uk\/index.php\/wp-json\/wp\/v2\/media\/129"}],"wp:attachment":[{"href":"https:\/\/jay-miah.co.uk\/index.php\/wp-json\/wp\/v2\/media?parent=13"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jay-miah.co.uk\/index.php\/wp-json\/wp\/v2\/categories?post=13"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jay-miah.co.uk\/index.php\/wp-json\/wp\/v2\/tags?post=13"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}