5 Replies Latest reply: Apr 27, 2012 2:26 PM by Gar RSS

    The "spanning-tree cost" command


      Hi All,


      Regarding the "spanning-tree cost" (as described here - http://www.cisco.com/en/US/docs/switches/lan/catalyst3750/software/release/12.2_55_se/commmand/reference/cli3.html#wp1945601 )


      I understand that it allows you to manually change the cost of a switchport. e.g. to change a 100Mbps port from default cost of 19 to, say 25.


      What I do not know though, is whether or not BOTH ports on the link need to be manually configured to the same value?


      I would guess that if they were not changed, then when BPDUs are exchanged, incorrect information would propogate, especially in the case of RSTP, where BPDUs are exchanged between switches, and not just propogated downstream from the Root Switch.



      My NetAcademy coursework says as attached:



      In addition, my second screenshot states the Cost of Path BPDU field, and how it is adjusted by each switch.

      I wonder how this field as affected by a difference in spanning-tree cost on opposite links.


      For example if SW1-Fa0/2 was set to spanning-tree cost 25, and SW2-F/a02 was the other end of the link with spanning-tree cost as default of 19, surely SW2-F/a02 would take the Cost of Path given by SW1 and add the cost based on it;s own configuration.

      Would the conflicting figures come into play if the STP topology changed, and one end of the link was advertising one value for the link, and the other end was advertising another, resulting in inconsistent values for the link?

        • 1. Re: The "spanning-tree cost" command

          I think Cost is added when BPDU is received on interface and not when it leaves.

          so adjusting cost of STP on interface is just for incoming BPDU on that interface.

          • 2. Re: The "spanning-tree cost" command
            Scott Morris - CCDE/4xCCIE/2xJNCIE

            Correct, it is an incoming manipulation.  So it'll affect the local decisions on the receiving switch as well as any further downstream switches.



            • 3. Re: The "spanning-tree cost" command

              Thanks for the replies guys.

              As I understand it, a Switch sends the BPDU with the it's total cost to root included, and then the receiving switch adds it's cost over the link it received the BPDU on, to work out the total cost to get back to the Root based on this.


              My ultimate question though, is with two adjacent ports operating at an actual bandwidth of 100 Mbps (so default cost of 19), would using the "spanning-tree cost" command on ONE of the ports, to manually change the cost to say 25, have any kind of ill effect on Spanning Tree convergence?

              Or would it simply mean that over that link, it would simply result in the cost 19 port being Designated, and the cost 25 port being Blocked (if we're talking legacy STP, not say RSTP)?

              Is this the main reason for using "spanning-tree cost"?To engineer the use of one port as designated, not the adjacent?

              • 4. Re: The "spanning-tree cost" command

                spanning-tree cost interface sub-command is just for STP manipulation as an additonal admin tool.  if for some reason you want to have traffic go this way and not that way, you have several tools to make it so;

                which of tool to use ? it probably depends on topology and situation.

                • 5. Re: The "spanning-tree cost" command

                  Thanks Martin. In such a case of manipulation, you would I guess purposely NOT configure both ends of a link to have the same cost, so as to make sure one end of a link became a DP, and not the other? Hence making my original question/statement of it causing STP conflicts inaccurate. It's just used to manipulate the eletion of adjacent ports over one another in DP/BP situations?


                  Thanks for the replies everyone.