STP will prevent a network loop that was created on the edge ports in most of the cases. When the switch starts every port is waiting for STP BPDUs for 3 seconds. If no BPDUs are received on the port it is assumed that and end device resides there, it transitions to edge port and goes in forwarding state. Every edge port continues sending out STP BPDUs every 2 seconds. As soon as an edge port starts receiving BPDUs it will automaticaly transition to non-edge port and this will also trigger an STP topology change. In the scenarios you described the switch will start receiving its own BPDUs on both ports as soon as the loop is created. Both ports will transition to non-edge. The switch will put one of the ports - the one with lower priority in discarding state and this will prevent the loop. The port will remain in discarding state for as long as the switch is receiving the BPDUs on it.This is the reason why it is generally recommended to enable STP even if you don't have separate redundant links (meshed links) between switches which could create a loop. For example when all you uplinks are link-aggregations. STP can be used simply for preventing local loops.This will not work only if the device which creates the loop -for example the VOIP phone from your example or some cheap unmanaged switch drops the STP BPDUs for some reason while forwarding all other broadcast/multicasts between both ports. In such case STP cannot recognize the loop indeed.STP may also fail to detect loops through edge ports that enforce port-access authentication like 802.1x, mac-auth. In port-access user mode the port will only accept incoming packets with source MAC of the authenticated user and may drop STP BPDUs.For this reason on Aruba switches you can have loop-protect on the edge ports as an additional protection against local loops.
At Aruba, we believe that the most dynamic customer experiences happen at the Edge. Our mission is to deliver innovative solutions that harness data at the Edge to drive powerful business outcomes.
© Copyright 2021 Hewlett Packard Enterprise Development LPAll Rights Reserved.