ā12-12-2024 10:16 AM
If I connect a cable between 2 ports on the same switch loop will come, if so how to avoid the loop even if it is done by mistake?Any particular commands to avoid this issue for future?
ā12-12-2024 10:24 AM
most switches use spanning tree protocol to detect and stop loops. But at the expense of ~30 seconds for the link up. The command spanning-tree portfast can be used to basically bypass the detection, but it can then cause loops.
These are the global commands we set on access switches and if someone plugs in a switch or loops a wire it will shut down the port. This keeps you from needing to add on all ports, and if you do set a trunk or uplink can disable portfast on that one.
spanning-tree portfast default
spanning-tree portfast bpduguard default
spanning-tree loopguard default
ā12-12-2024 10:25 AM
Spanning tree will take care of it, but you can take additional measure like configure BPDU Guard on access ports, configure broadcast storm control etc.
ā12-12-2024 10:28 AM
only under the interface config
spanning tree bpduguard enable
MHM
ā12-12-2024 10:31 AM
So what is the difference between these 3 commands
spanning-tree portfast bpduguard default
spanning-tree loopguard default
spanning tree bpduguard enable
ā12-12-2024 10:36 AM
these config in global and make all port of SW portfast protect with portfast and this not correct
the port connect SW to SW need to be NOT portfast and NOT bpduguard
MHM
ā12-12-2024 12:26 PM
@13jobsp90 wrote:
If I connect a cable between 2 ports on the same switch loop will come, if so how to avoid the loop even if it is done by mistake?Any particular commands to avoid this issue for future?
That's the purpose of STP, i.e. to block L2 loops.
However, to avoid edge ports waiting for STP to unblock them, the portfast option is used, but this does expose the switch to a L2 loop forming and rendering the L2 domain unusable. (I believe portfast allowing a loop is more of a problem for STP vs. rapid-STP, but don't quote me. [Oh, and rapid-STP is "better" than non-rapid, so highly recommend non-rapid not be used.]) There are some other STP options to try to mitigate the L2 forming on a port, as mentioned in some of the other replies.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide