20
Calculating an 802.1d Spanning-T r e e T o po lo gy By Keith Bogart Learn in g@ C isc o T S T rain in g T eam A s an in stru c tor, I en j oy teac hin g stu d en ts how the 8 0 2 .1d S p an n in g-T ree p rotoc ol w ork s an d en l ighten in g those stu d en ts to the p oin t w here I c an d raw a top ol ogy d iagram on a w hiteb oard an d , n o m atter how c om p l ex , the stu d en ts c an ev en tu al l y f igu re ou t the S p an n in g-T ree rol e an d state of al l sw itc hes in that d iagram . T hat is the sam e k n ow l ed ge I w ill n ow attem p t to im p art to you , the read er, in this w hitep ap er. T here are m an y f ac ets to the 8 0 2 .1d S p an n in g-T ree p rotoc ol w hic h I w on ’ t c ov er in this p ap er. T here are m an y en han c em en ts to the p rotoc ol to m ak e it c on v erge q u ic k er an d d etec t f ail u res f aster. T his p ap er is n ot m ean t to d esc rib e those f eatu res. T he goal of this p ap er is v ery sim p l e, af ter read in g this, the l earn er shou ld b e ab l e to l ook at an y top ol ogy d iagram of LA N S w itc hes an d ( giv en the ap p rop riate in f orm ation ab ou t eac h sw itc h) he/ she shou ld b e ab l e to d eterm in e the f ol l ow in g: 1. W hic h sw itc h w ill b e the S p an n in g-T ree R oot Brid ge 2 . W hic h sw itc h w ill b e the sec on d ary R oot Brid ge in the ev en t that the p rim ary R oot Brid ge f ail s 3 . W hic h sw itc hp orts are in the F orw ard in g – D esign ated state 4. W hic h sw itc hp orts are in the F orw ard in g – R oot P ort state 5 . W hic h sw itc hp orts are in the Bl oc k in g – Non -D esign ated state I’ m al so goin g to start w ith the assu m p tion that the read er is al read y aw are of w hy the 8 0 2 .1d S p an n in g-T ree p rotoc ol is n eed ed in Layer-2 sw itc hed en v iron m en ts. In short, S p an n in g-T ree w as d ev el op ed to b l oc k b rid gin g l oop s. In its sim p l est term s, a b rid gin g l oop sim p l y m ean s that a b road c ast f ram e c an b e f l ood ed ou t of on e sw itc h an d , d u e to the c ab l in g in the top ol ogy, ev en tu al l y f in d its w ay b ac k to that v ery sam e sw itc h. T his is a l oop . T his is b ad an d I’ m goin g to assu m e at this p oin t that you u n d erstan d w hy it is b ad . S o l et’ s start w ith the b asic s. T o b egin , m an y tim es in this p ap er I w ill u se the term s “ b rid ge” an d “ sw itc h” in terc han geab l y. W hil e there are d istin c t d if f eren c es b etw een b rid ges an d sw itc hes, those d if f eren c es are irrel ev an t f rom a S p an n in g-T ree p ersp ec tiv e. A l l C isc o sw itc hes ru n the 8 0 2 .1d S p an n in g-T ree p rotoc ol on an y ac tiv e V LA N b y d ef au l t. T here is n othin g you n eed to d o m an u al l y to tu rn it on . T he on l y req u irem en t that the sw itc h has is that the V LA N is “ ac tiv e” m ean in g that there are on e or m ore p orts that are U P /U P an d in that V LA N. T his p ort c ou ld b e a S w itc hp ort or a V LA N T ru n k , it d oesn ’ t m atter to S p an n in g-T ree. If a V LA N ex ists on a sw itc h b u t that sw itc h

Calculating an 802.1d Spanning-Tree Operations_Rev-014-KB

Embed Size (px)

DESCRIPTION

Calculating an 802.1d Spanning-Tree Operations_Rev-014-KB

Citation preview

Page 1: Calculating an 802.1d Spanning-Tree Operations_Rev-014-KB

Calculating an 802.1d Spanning-T r e e T o po lo gy By Keith Bogart Learn in g@ C isc o T S T rain in g T eam A s an in stru c tor, I en j oy teac hin g stu d en ts how the 8 0 2 .1d S p an n in g-T ree p rotoc ol w ork s an d en l ighten in g those stu d en ts to the p oin t w here I c an d raw a top ol ogy d iagram on a w hiteb oard an d , n o m atter how c om p l ex , the stu d en ts c an ev en tu al l y f igu re ou t the S p an n in g-T ree rol e an d state of al l sw itc hes in that d iagram . T hat is the sam e k n ow l ed ge I w il l n ow attem p t to im p art to you , the read er, in this w hitep ap er. T here are m an y f ac ets to the 8 0 2 .1d S p an n in g-T ree p rotoc ol w hic h I w on ’ t c ov er in this p ap er. T here are m an y en han c em en ts to the p rotoc ol to m ak e it c on v erge q u ic k er an d d etec t f ail u res f aster. T his p ap er is n ot m ean t to d esc rib e those f eatu res. T he goal of this p ap er is v ery sim p l e, af ter read in g this, the l earn er shou l d b e ab l e to l ook at an y top ol ogy d iagram of LA N S w itc hes an d ( giv en the ap p rop riate in f orm ation ab ou t eac h sw itc h) he/ she shou l d b e ab l e to d eterm in e the f ol l ow in g:

1. W hic h sw itc h w il l b e the S p an n in g-T ree R oot Brid ge 2 . W hic h sw itc h w il l b e the sec on d ary R oot Brid ge in the ev en t that the p rim ary

R oot Brid ge f ail s 3 . W hic h sw itc hp orts are in the F orw ard in g – D esign ated state 4. W hic h sw itc hp orts are in the F orw ard in g – R oot P ort state 5 . W hic h sw itc hp orts are in the Bl oc k in g – Non -D esign ated state

I’ m al so goin g to start w ith the assu m p tion that the read er is al read y aw are of w hy the 8 0 2 .1d S p an n in g-T ree p rotoc ol is n eed ed in Layer-2 sw itc hed en v iron m en ts. In short, S p an n in g-T ree w as d ev el op ed to b l oc k b rid gin g l oop s. In its sim p l est term s, a b rid gin g l oop sim p l y m ean s that a b road c ast f ram e c an b e f l ood ed ou t of on e sw itc h an d , d u e to the c ab l in g in the top ol ogy, ev en tu al l y f in d its w ay b ac k to that v ery sam e sw itc h. T his is a l oop . T his is b ad an d I’ m goin g to assu m e at this p oin t that you u n d erstan d w hy it is b ad . S o l et’ s start w ith the b asic s. T o b egin , m an y tim es in this p ap er I w il l u se the term s “ b rid ge” an d “ sw itc h” in terc han geab l y. W hil e there are d istin c t d if f eren c es b etw een b rid ges an d sw itc hes, those d if f eren c es are irrel ev an t f rom a S p an n in g-T ree p ersp ec tiv e. A l l C isc o sw itc hes ru n the 8 0 2 .1d S p an n in g-T ree p rotoc ol on an y ac tiv e V LA N b y d ef au l t. T here is n othin g you n eed to d o m an u al l y to tu rn it on . T he on l y req u irem en t that the sw itc h has is that the V LA N is “ ac tiv e” … m ean in g that there are on e or m ore p orts that are U P / U P an d in that V LA N. T his p ort c ou l d b e a S w itc hp ort or a V LA N T ru n k , it d oesn ’ t m atter to S p an n in g-T ree. If a V LA N ex ists on a sw itc h b u t that sw itc h

Page 2: Calculating an 802.1d Spanning-Tree Operations_Rev-014-KB

d oesn ’ t hav e an y V LA N T ru n k s ( IS L or 8 0 2 .1q , it d oesn ’ t m atter) c arryin g that V LA N, an d there are n o S w itc hp orts c on f igu red to b e in that V LA N ( p orts c on n ec ted to an ed ge d ev ic e su c h as a l ap top , P C , or S erv er) then the C P U of that sw itc h w il l c on sid er that V LA N to b e In ac tiv e an d ign ore it f rom a S p an n in g-T ree p ersp ec tiv e. Keep in m in d that b ec au se IS L an d 8 0 2 .1q V LA N T ru n k s c arry al l V LA Ns b y d ef au l t, a sin gl e, f u n c tion al V LA N T ru n k w il l al so m eet the c riteria of m ak in g V LA Ns ac tiv e. Let’ s start w ith the p rem ise that you hav e the f ol l ow in g sim p l e top ol ogy:

In the top ol ogy ab ov e, the sw itc h c on sid ers V LA N-1 to b e ‘ ac tiv e’ b ec au se p ort 3 / 1 is c on f igu red to b e in this V LA N an d this is ac tu al l y c on n ec ted to a l iv e d ev ic e. T he m om en t that p ort 3 / 1 c om es u p at l ayer-2 , the C P U in this sw itc h w il l b egin to c al c u l ate the 8 0 2 .1d S p an n in g-T ree p rotoc ol f or V LA N-1. Notic e that in this sim p l e d raw in g there is n o b rid gin g l oop so tec hn ic al l y sp eak in g, S p an n in g-T ree as a p rotoc ol is n ot n eed ed . In real ity, it w ou l d j u st b e ad d ition al ov erhead f or the C P U on this sw itc h to ru n S p an n in g-T ree. H ow ev er, u n l ess you are ab sol u tel y su re that there w il l n ev er b e an other sw itc h c on n ec ted to this on e, an d there w il l n ev er b e an y p ossib il ity of a b rid gin g l oop , it’ s b etter to j u st l eav e S p an n in g-T ree tu rn ed on as a saf egu ard again st f u tu re l oop s. Spanning-T r e e B r id ge -I D T he f irst thin g the C P U d oes in an y sw itc h w hen startin g the S p an n in g-T ree p rotoc ol is to d eterm in e a d esc rip tiv e id en tif ier f or itsel f . T his id en tif ier is c al l ed the Brid ge-Id . T his Brid ge-ID is f req u en tl y u sed in the S p an n in g-T ree p roc ess w hen tw o or m ore sw itc hes are “ f ightin g it ou t” an d tryin g to d eterm in e w ho is b etter than the other on e. I’ l l tal k m ore ab ou t that in a m om en t. T hin k of the Brid ge-Id as b ein g sim il ar to the n am e of the sw itc h. In stead of the sw itc h c al l in g ou t, “ H ey, m y n am e is T om ” it u ses a Brid ge-Id in stead . A S p an n in g-T ree Brid ge-ID c on tain s tw o p iec es of in f orm ation , a Brid ge P riority v al u e an d a M A C A d d ress. T hese tw o v al u es p u t together are c al l ed the Brid ge-ID . T he Brid ge-P riority, u n l ess m an u al l y c han ged , is al w ays the d ef au l t v al u e of 3 2 , 7 68 . S o w hether you b ou ght a sw itc h tw en ty years ago that on l y has f ou r p orts, or you b ou ght the l atest $ 2 0 0 , 0 0 0 .0 0 sw itc h w ith al l the b el l s an d w histl es, they w il l al w ays hav e the sam e Brid ge P riority of 3 2 , 7 68 . T hat b ein g the c ase, the on e v al u e you c an al w ays c ou n t on b ein g u n iq u e f rom on e sw itc h/ b rid ge to the n ex t is the M A C A d d ress. S o the c om b in ation of the Brid ge P riority an d Brid ge M A C A d d ress w il l al w ays resu l t in a u n iq u e Brid ge-ID f or eac h an d ev ery sw itc h.

Page 3: Calculating an 802.1d Spanning-Tree Operations_Rev-014-KB

Spanning-T r e e R o o t B r id ge E l e c t io n Nex t, ev ery V LA N that is ac tiv e an d ru n n in g S p an n in g-T ree w il l hav e a sin gl e b rid ge/ sw itc h ac tin g as the R oot Brid ge f or that V LA N. T his hap p en s v ia an el ec tion p roc ess that I’ l l d esc rib e in a m om en t. A l l the sw itc hes w il l in itial l y ex c han ge sp ec ial S p an n in g-T ree P D U s ( p rotoc ol d ata u n its) that are c al l ed BP D U s ( Brid ge P rotoc ol D ata U n its) . A BP D U is j u st an other k in d of E thern et f ram e b u t in this c ase it c arries in f orm ation that S p an n in g-T ree n eed s to c al c u l ate the top ol ogy. P C s, S erv ers, R ou ters, etc w il l al so rec eiv e a BP D U if they are c on n ec ted to a sw itc h b u t, b ec au se these d ev ic es d on ’ t typ ic al l y ru n the 8 0 2 .1d S p an n in g-T ree p rotoc ol they w il l d isc ard these f ram es. T he R oot Brid ge w ithin S p an n in g-T ree has a f ew , v ery im p ortan t task s su c h as:

1. It is the on l y sw itc h ( w hen ru n n in g 8 0 2 .1d S T P ) that is resp on sib l e f or gen eratin g n ew BP D U s. A l l other sw itc hes in the top ol ogy w il l sim p l y rec eiv e BP D U s f rom the R oot Brid ge an d then f orw ard them on to other, d ow n stream sw itc hes. If the R oot Brid ge tem p oraril y stop s c reatin g BP D U s ( m ayb e b ec au se the C P U is too b u sy ru n n in g other p rotoc ol s) al l other sw itc hes w il l b e sil en t.

2 . It c on trol s the v ariou s tim ers that S p an n in g-T ree u ses. 3 . It in f orm s the Layer-2 sw itc hed top ol ogy of som ethin g c al l ed , “ top ol ogy

c han ges” ( n ot c ov ered in this p ap er) . W hen a n ew sw itc h c om es on l in e an d d eterm in es that it n eed s to ru n the 8 0 2 .1d S p an n in g-T ree p rotoc ol f or on e or m ore V LA Ns, it is n ot in itial l y aw are of the top ol ogy. It d oesn ’ t k n ow if it is the on l y sw itc h in the top ol ogy or if there are p oten tial l y hu n d red s of other sw itc hes in the top ol ogy. Not k n ow in g this in f orm ation , the sw itc h tak es the saf est c ou rse of ac tion an d im m ed iatel y b egin s f l ood in g the top ol ogy w ith its ow n BP D U s an d ad v ertisin g itsel f as the S p an n in g-T ree R oot Brid ge. H ow ex ac tl y d oes it d o this? T ak e a l ook at the S n if f er trac e b el ow of a BP D U :

Page 4: Calculating an 802.1d Spanning-Tree Operations_Rev-014-KB

T he S n if f er trac e ab ov e d oesn ’ t show the en tire BP D U b u t I’ v e highl ighted tw o im p ortan t sec tion s. F irst n otic e the “ S en d in g Brid ge Id ” . T his is the sam e as the Brid ge-Id I j u st d esc rib ed . T he p riority show n here as 8 0 0 0 is real l y a hex ad ec im al n u m b er. Better p u t, it w ou l d d isp l ay as 0 x 8 0 0 0 w hic h ( w hen c on v erted to d ec im al ) is 3 2 , 7 68 . T he M A C ad d ress of this sw itc h is 0 0 -40 -0 B-A 0 -0 9 -A 2 . T he f in al n u m b er of 8 0 0 5 is n ot tec hn ic al l y p art of the Brid ge-ID . T his n u m b er rep resen ts an other d esc rip tiv e id en tif ier c al l ed the P ort-ID . T his is a u n iq u e n u m b er rep resen tin g the p ort or in terf ac e w hic h is tran sm ittin g this BP D U . M ore on that l ater. T he other highl ighted f iel d in the BP D U tel l s the w hol e w orl d w ho the S p an n in g-T ree R oot Brid ge is f or this V LA N. In this c ase, this sw itc h is ad v ertisin g itsel f as the R oot Brid ge. In the w orl d of S p an n in g-T ree, there c an on l y b e on e R oot Brid ge p er V LA N. A s m en tion ed p rev iou sl y, sw itc hes that d on ’ t in itial l y u n d erstan d the top ol ogy w il l gen erate BP D U s an d c l aim to tak e on this rol e. Bu t as soon as sw itc hes rec eiv e BP D U s f rom other sw itc hes in the top ol ogy, then an el ec tion p roc ess m u st tak e p l ac e to d eterm in e w ho the ‘ real ’ R oot Brid ge shou l d b e. T he R oot Brid ge el ec tion p roc ess is v ery sim p l e. S w itc hes sim p l y l ook f or the sw itc h that has the n u m eric al l y l ow est Brid ge-ID an d el ec t that sw itc h to b e the S p an n in g-T ree R oot Brid ge. Keep in g in m in d that a Brid ge-ID is tec hn ic al l y c om p osed of tw o su b -f iel d s ( Brid ge-P riority an d M A C A d d ress) the el ec tion p roc ess hap p en s as f ol l ow s:

1. A l l b rid ges ex c han ge BP D U s w ith eac h other. 2 . T he Brid ge P riority v al u e w il l f irst b e v iew ed an d c om p ared .

Page 5: Calculating an 802.1d Spanning-Tree Operations_Rev-014-KB

3 . If on e b rid ge has a n u m eric al l y l ow er Brid ge P riority than al l the others, the el ec tion p roc ess w il l stop an d that b rid ge w il l b e el ec ted the S p an n in g-T ree R oot Brid ge.

4. If al l the Brid ge P riority v al u es are id en tic al , the sw itc hes w il l then c om p are eac h other’ s M A C A d d resses.

5 . Bec au se eac h b rid ge is gu aran teed to hav e a u n iq u e M A C A d d ress, on e of them w il l b e n u m eric al l y l ow er than al l the others an d that b rid ge w il l b e el ec ted the S p an n in g-T ree R oot Brid ge.

S o in the top ol ogy b el ow , w hic h sw itc h d o you b el iev e w ou l d en d u p b ec om in g the R oot Brid ge?

H op ef u l l y you an sw ered the b rid ge/ sw itc h w ith a p riority of 3 0 , 7 68 . R em em b er to al w ays c om p are the Brid ge P riority v al u es f irst. O n l y if tw o or m ore of them are id en tic al w il l you n eed to m ov e on to c om p arin g M A C ad d resses. A n d al w ays read M A C ad d resses f rom l ef t-to-right. S o if the b rid ge p riority v al u es H A D al l b een id en tic al , w hic h sw itc h w ou l d hav e w on ? T he sw itc h w ith M A C ad d ress 0 4-0 0 -0 0 -c c -12 -7 7 w ou l d hav e w on . A n d you w ou l d hav e k n ow n this af ter c om p arin g on l y the third n u m b er ( 0 4-0) . T here w ou l d hav e b een n o n eed to c on tin u e c om p arin g the d igits in the rest of the M A C ad d resses b ec au se the “ 0 ” af ter the “ 0 4” is d ef in itel y l ow er than 0 4-1 or 0 4-8 . A t this p oin t, the R oot Brid ge n o l on ger n eed s to p roc eed in an y f u rther el ec tion s. It w il l start gen eratin g an d tran sm ittin g BP D U s ou t ev ery p ort/ in terf ac e it has in V LA N-1. If this sw itc h al so b ec am e the R oot Brid ge f or other V LA Ns it w ou l d gen erate BP D U s f or those other V LA Ns as w el l . A sw itc h c an b e a R oot Brid ge f or m ore than on e V LA N. A s a m atter of f ac t, if al l the sw itc hes w ere l ef t to their d ef au l t v al u es, w hic hev er sw itc h b ec am e the R oot Brid ge f or V LA N-1 w ou l d al so, b y d ef au l t, b e the R oot Brid ge f or V LA N-2 , V LA N-3 , an d so on .

Page 6: Calculating an 802.1d Spanning-Tree Operations_Rev-014-KB

O n e rem ain in g f ac t ab ou t the R oot Brid ge is that al l the p orts it has in this p artic u l ar V LA N ( in c l u d in g V LA N T ru n k s) w il l b e p l ac ed in the F orw ard in g-D esign ated rol e. M ore on that in a m om en t. Spanning-T r e e R o o t P o r t s and C o s t T he other sw itc hes that l ost the R oot Brid ge el ec tion hav e som e m ore w ork to d o b ef ore the S p an n in g-T ree p rotoc ol is stab il iz ed . E v ery p ort that is p artic ip atin g in S p an n in g-T ree ( b asic al l y, ev ery p ort that is “ u p ” ) w il l ev en tu al l y en d u p in on e of three S p an n in g-T ree p ort rol es:

1. R oot P ort 2 . D esign ated P ort 3 . Non -D esign ated ( Bl oc k in g) P ort

T he n ex t step that eac h sw itc h ( except f or the R oot Brid ge) d eterm in es is w hic h of its p orts w il l b ec om e the R oot P ort. F or eac h ac tiv e V LA N on a sw itc h, that sw itc h w il l hav e on l y o n e R oot P ort. T he R oot Brid ge itsel f has n o R oot P orts. T he R oot P ort is that p ort on the sw itc h that has the f astest p ath b ac k to the R oot Brid ge. Look at an ex am p l e b el ow :

In the d raw in g ab ov e, b oth Bob an d C in d y c an d riv e d irec tl y to the airp ort. Bob c an d riv e d irec tl y d ow n K-street an d it w il l tak e him 12 -m in u tes to reac h the airp ort. C in d y c an d riv e d irec tl y d ow n M -S treet an d it w il l tak e her on l y 5 -m in u tes. Bu t they are al so b oth c on n ec ted to L-street. U n l ess som eon e c on n ec ted to L-street ad v ertises that this is a v iab l e p ath to the airp ort, n either Bob n or C in d y w il l ev en c on sid er d riv in g on L-street. A f ter al l , w ou l d y o u d riv e d ow n a d ark al l ey if you w eren ’ t su re it l ed to w here you w an ted to go? S o as a c ou rtesy, b oth Bob an d C in d y ad v ertise to eac h other ( al on g L-

Page 7: Calculating an 802.1d Spanning-Tree Operations_Rev-014-KB

S treet) the p aths they k n ow ab ou t to the airp ort. If Bob an d C in d y k n ew ab ou t m u l tip l e w ays to get to the airp ort, they w ou l d on l y in f orm eac h other of the b est w ay ( the f astest) . Notic e that w hen Bob shou ts to C in d y that he c an get to the airp ort in 12 -m in u tes, he d oesn ’ t tel l her ab ou t the 6-ad d ition al m in u tes it w ou l d tak e f or her to trav el ac ross L-S treet. H e on l y tel l s her ab ou t H IS p ersp ec tiv e. A n d f rom Bob ’ s p ersp ec tiv e, he on l y k n ow s that K-street l ead s to the airp ort. Lik ew ise, w hen C in d y shou ts ou t, “ H ey , I h a v e a w a y to th e a i r po r t o v er h er e a n d i t o n l y ta k es m e f i v e m i n u tes ” she al so d oesn ’ t tak e in to c on sid eration the six m in u tes it w ou l d tak e Bob to d riv e to her on L-S treet. Both Bob an d C in d y n ow k n ow they eac h hav e tw o p ossib l e w ays to get to the airp ort. F or Bob , on e w ay w il l tak e a total of 12 -m in u tes ( al on g K-street) . T he other w ay ( al on g L-street) w il l ac tu al l y tak e l ess tim e… a c om b in ed total of 11-m in u tes. S o ev en thou gh Bob is d irec tl y c on n ec ted to the airp ort v ia K-street, it w ou l d ac tu al l y b e f aster f or him to get there b y f irst d riv in g d ow n L-street, throu gh C in d y’ s hou se, an d then al on g M -street. S o Bob w ou l d c hoose his c on n ec tion to L-street as his R oot P ort. C in d y’ s d irec t c on n ec tion al on g M -street is stil l the f astest w ay f or her to get to the airp ort so this c on n ec tion w il l b e sel ec ted as her R oot P ort. T his ex am p l e u sed d riv in g an d tim e ex p ressed in m in u tes to m ak e a p oin t. Bu t w hat ab ou t sw itc hes? H ow d o they d ec id e how “ f ast” they c an get to the R oot Brid ge? E l ec tron s c an trav el f rom on e sw itc h u p to the R oot Brid ge in m ic rosec on d s… is that the v al u e u sed ? No. In S p an n in g-T ree term in ol ogy the sp eed of a l in k is rep resen ted b y a n u m eric al v al u e c al l ed , “ C o s t ” . Y ou d on ’ t n eed to k n ow the ex ac t f orm u l a u sed to d eriv e c ost b u t you shou l d k n ow that c ost is d irec tl y rel ated to b an d w id th. T he higher the b an d w id th on a l in k , the l ow er the v al u e of its c ost. R em em b er w hen tw o or m ore b rid ges w ere “ f ightin g it ou t” to d eterm in e w ho w ou l d b e the R oot Brid ge? T hey c om p ared eac h other’ s Brid ge-Id ’ s an d the l o w es t v al u e w as the w in n er. I n S p a n n i n g T r e e , w h e n e v e r y o u a r e c o m p a r i n g t w o o r m o r e v a l u e s a g a i n s t e a c h o t h e r t o s e e w h i c h o n e i s “ b e t t e r ” t h e l o w e s t v a l u e a l w a y s w i n s . U sin g that sam e ru l e f or c ost, you c an hop ef u l l y u n d erstan d w hy a higher b an d w id th l in k tran sl ates to a l ow er c ost. T he l ow er the n u m b er the b etter it is. S o w hil e a 10 -M b p s E thern et l in k has a c ost of 10 0 … a G igab it E thern et l in k has a c ost of on l y 4. T hese are the c ost v al u es you shou l d m em oriz e:

S p e e d o f l i n k C o s t 10 M b p s E thern et 10 0 10 0 M b p s F astE thern et 19 10 0 0 M b p s G igab it E thern et 4

T he other ru l e regard in g c ost you n eed to m em oriz e is this:

Page 8: Calculating an 802.1d Spanning-Tree Operations_Rev-014-KB

A switch will always advertise its perceived cost to the R oot B ridg e to its n eig hb ors. Let’ s l ook at the f ol l ow in g ex am p l e:

F rom the R oot Brid ge’ s p ersp ec tiv e it d oesn ’ t c ost an ythin g to reac h itsel f . S o the R oot Brid ge al w ays ad v ertises BP D U s w ith an in itial c ost of z ero. A n other w ay of l ook in g at it; if som eon e ask ed you , “ W h en y o u ’ r e a t th e a i r po r t, h o w m a n y m i n u tes d o es i t ta k e y o u to d r i v e to th e a i r po r t ? ” Y ou ’ d p rob ab l y f irst sc ratc h you r head an d assu m e this w as a tric k q u estion . Bu t the hon est an sw er w ou l d b e, “ I f I ’ m a l r ea d y A T th e a i r po r t i t d o es n ’ t ta k e m e a n y ti m e a t a l l b eca u s e I ’ m a l r ea d y T H E R E , s o th e a n s w er i s z er o m i n u tes ” . W hen Brid ge-A rec eiv es this BP D U w ith a c ost of z ero, it rec eiv es it on in terf ac e G igab it E thern et 4/ 1. Kn ow in g that this is a G igab it E thern et in terf ac e it c al c u l ates its l oc al c ost v al u e f or this p ort ( a v al u e of 4) an d ad d s it to the c ost in the BP D U . Now the total c ost f or Brid ge-A to reac h the R oot Brid ge is 4. C on sid erin g this is the on l y p ath it k n ow s ab ou t to the R oot Brid ge it w il l ad v ertise this c ost ou t p ort 5 / 2 so Brid ge-B c an l earn ab ou t it. S im il arl y, w hen Brid ge-B rec eiv es this BP D U w ith a c ost of z ero, it rec eiv es it on in terf ac e F astE thern et 3 / 1. Kn ow in g that this is a F astE thern et in terf ac e it c al c u l ates its l oc al c ost v al u e f or this p ort ( a v al u e of 19 ) an d ad d s it to the c ost in the BP D U . Now the total c ost f or Brid ge-B to reac h the R oot Brid ge is 19 .

Page 9: Calculating an 802.1d Spanning-Tree Operations_Rev-014-KB

Let’ s f oc u s ou r atten tion on Brid ge-B f or a m om en t. It n ot on l y rec eiv ed a BP D U d irec tl y f rom the R oot Brid ge on p ort 3 / 1 w ith an in itial c ost of z ero… b u t m il l isec on d s l ater it rec eiv es an other BP D U on p ort 3 / 2 f rom Brid ge-A . In this BP D U Brid ge-A is ad v ertisin g that it c an reac h the R oot Brid ge w ith a c ost of f ou r. O n c e again , Brid ge-B has to tak e in to ac c ou n t the p ath b etw een itsel f an d Brid ge-A an d ad d that to the eq u ation . T he l oc al in terf ac e c ost of p ort 3 / 2 on Brid ge-B is 19 ( this is a F astE thern et l in k ) . W hen ad d ed to the ad v ertised c ost of 4 f rom Brid ge-A , Brid ge-B n ow k n ow s that it has an al tern ativ e p ath to the R oot Brid ge w ith a c om b in ed total c ost of 2 3 . Brid ge-A m ak es this sam e c al c u l ation b ased on the BP D U that it rec eiv es f rom Brid ge-B an d d eterm in es that its c om b in ed c ost to reac h the R oot Brid ge f rom p ort 5 / 2 w ou l d b e 3 8 .

Page 10: Calculating an 802.1d Spanning-Tree Operations_Rev-014-KB

Both Brid ge-A an d Brid ge- B are n ow aw are that they hav e tw o p aths to the R oot Brid ge. S tic k in g w ith the sam e ru l e that “ l ow est is b etter” Brid ge-A w il l sel ec t p ort 4/ 1 as its R oot P ort an d Brid ge-B w il l sel ec t p ort 3 / 1 as its R oot P ort. A R oot P ort is al w ays in the “ F orw ard in g” state. T his m ean s that this p ort is w id e op en to sen d an d rec eiv e al l typ es of traf f ic . It is “ f orw ard in g” E thern et f ram es. Spanning-T r e e D e s ignat e d P o r t s S o w hat ab ou t the p orts that are n ot R oot P orts? W hat are they? I’ v e al read y m en tion ed that the R oot Brid ge itsel f has n o R oot P orts, so w hat w il l b e the S p an n in g-T ree rol e of p orts on that b rid ge/ sw itc h? A s I’ v e m en tion ed p rev iou sl y, ev ery p ort that is p artic ip atin g in S p an n in g-T ree w il l b ec om e on e of three p ossib l e rol es:

4. R oot P ort 5 . D esign ated P ort 6. Non -D esign ated ( Bl oc k in g) P ort

O n Brid ge-A , w e k n ow that p ort 5 / 2 is n ot the R oot P ort so b y p roc ess of el im in ation it m u st b e either a D esign ated P ort or a Non -D esign ated P ort. Now f or the n ex t ru l e you shou l d m em oriz e: E v er y co l l i s i o n d o m a i n h a s a s i n g l e S pa n n i n g -T r ee D es i g n a ted P o r t. Notic e I u sed the w ord s, “ c ol l ision d om ain ” an d n ot sim p l y “ c ab l e” . In this top ol ogy, c ab l e segm en t-X is c on sid ered a sin gl e c ol l ision d om ain an d so on e of the p orts c on n ec ted to this c ab l e w il l b ec om e a D esign ated P ort:

Bu t in this top ol ogy, ev erythin g c on n ec ted to the H u b is in a sin gl e c ol l ision d om ain as w el l ( c ol l ision d om ain -Y ) an d so on l y on e of the m an y p orts on the sw itc hes c on n ec ted to this H u b w il l en d u p b ec om in g a D esign ated P ort:

Page 11: Calculating an 802.1d Spanning-Tree Operations_Rev-014-KB

S o w hat ex ac tl y is a D esign ated P ort? In its sim p l est term s, a D esign ated P ort is the p ort w ithin that c ol l ision d om ain that has the f astest p ath b ac k to the R oot Brid ge. Let’ s u se ou r airp ort an al ogy again ;

In the d raw in g ab ov e, b oth Bob an d C in d y hav e op en ed their ow n l im ou sin e airp ort serv ic e an d b oth hav e their ow n rou te to the A irp ort. T he airp ort here w ou l d b e an al ogou s to the R oot Brid ge. Bob an d C in d y al so l iv e on the sam e street ( a n eighb orhood w here the sp eed l im it is a m eager 2 5 m il es-p er-hou r) . A sin gl e street c an on l y su p p ort on e l im ou sin e serv ic e ( an al ogou s to the D esign ated P ort c on c ep t) so Bob an d C in d y b oth ad v ertise the f astest p ath they hav e to get to the airp ort b ec au se they w an t to attrac t c u stom ers. Bob ad v ertises that if p eop l e w al k throu gh his f ron t d oor, he c an tak e them to the airp ort at a sp eed of 45 m p h. C in d y ad v ertises that if p eop l e w al k throu gh her f ron t d oor, she c an tak e them to the airp ort at a sp eed of 7 0 m p h. O b v iou sl y the p eop l e on this street w il l u se C in d y’ s Lim ou sin e serv ic e b ec au se she c an get them to the airp ort the f astest. S o on this street, C in d y’ s f ron t d oor w il l b e op en to the p u b l ic an d serv in g as the “ D esign ated P ort” .

Page 12: Calculating an 802.1d Spanning-Tree Operations_Rev-014-KB

Let’ s b rin g the f oc u s b ac k to S p an n in g-T ree term in ol ogy. Y ou n ow k n ow that S p an n in g-T ree u ses “ c ost” to ref l ec t the b an d w id th of a l in k .

In the d raw in g ab ov e, w e see a total of three c ol l ision d om ain s. E ac h c ab l e in this p ic tu re rep resen ts a c ol l ision d om ain . O n the G igab it E thern et c ab l e, w hic h sw itc h d o you thin k has the l ow est c om b in ed c ost to reac h the R oot Brid ge… the R oot Brid ge itsel f or Brid ge-A ? H op ef u l l y you an sw ered the R oot Brid ge. A f ter al l , the R oot Brid ge ad v ertises itsel f w ith a c ost of z ero an d NO T H ING c an b eat that! ! T his m ean s that ev ery p ort on the R oot Brid ge ( in that p artic u l ar V LA N) w il l b e a D esign ated P ort.

H ere’ s an other ru l e of thu m b you c an m em oriz e: O n ce y o u d eter m i n e th e R o o t P o r t o n a ca b l e, y o u ca n a u to m a ti ca l l y g o to th e o th er en d o f th a t ca b l e a n d m a r k th a t po r t o n y o u r to po l o g y d i a g r a m a s a D es i g n a ted P o r t.

Page 13: Calculating an 802.1d Spanning-Tree Operations_Rev-014-KB

S o the on l y c ol l ision d om ain / c ab l e l ef t to d eterm in e in this top ol ogy is the F astE thern et c on n ec tion b etw een Brid ge-A an d Brid ge-B. Both b rid ges w an t to w in this p roc ess b u t there c an b e on l y on e D esign ated P ort p er c ab l e ( c ol l ision d om ain ) . C on sid erin g that S p an n in g-T ree c on sid ers l ow er v al u es to b e b etter, it is l ogic al that ev en thou gh Brid ge-A has tw o c osts to reac h the R oot Brid ge ( a c ost of f ou r on p ort 4/ 1 an d a c ost of 3 8 on p ort 5 / 2 ) it w il l ad v ertise the ab sol u te l ow est c ost it has to Brid ge-B to attem p t to w in this D esign ated P ort el ec tion p roc ess.

In this top ol ogy, Brid ge-A w il l w in an d p ort 5 / 2 w il l b ec om e the D esign ated P ort on this c ab l e. J u st l ik e R oot P orts, D esign ated P orts are al w ays in the “ F orw ard in g” state. W hat ab ou t p ort 3 / 2 on Brid ge-B? By p roc ess of el im in ation w e k n ow it is n ot the R oot P ort… it’ s n ot the D esign ated P ort… so it m u st b e a Non -D esign ated P ort. Non -D esign ated p orts are those sp ec ial p orts w hic h stop the p oten tial b rid gin g l oop . T hey d o this b y goin g in to the “ Bl oc k in g” state. A p ort that is “ Bl oc k in g” is n ot al l ow ed to sen d an y u ser d ata f ram es. In other w ord s, an y f ram es f rom you r l ap top , P C , or S erv er that reac h a Bl oc k in g p ort w il l b e d isc ard ed . T he on l y typ es of E thern et f ram es al l ow ed to b e tran sm itted on a Non -D esign ated / Bl oc k in g p ort are M an agem en t f ram es ( l ik e C D P , V T P , D T P , etc ) .

Page 14: Calculating an 802.1d Spanning-Tree Operations_Rev-014-KB

In the top ol ogy I j u st u sed , ev erythin g w as p retty easy b ec au se the l in k sp eed s ( c osts) w ere d if f eren t. Bu t w hat if I m ad e on e m in or c han ge?

Notic e that the G igab it E thern et l in k b etw een the R oot Brid ge an d Brid ge-A has b een c han ged to a F astE thern et l in k . T his c han ge w ou l d resu l t in the f ol l ow in g n ew c ost v al u es:

Page 15: Calculating an 802.1d Spanning-Tree Operations_Rev-014-KB

A s w e c an see, Brid ge-A stil l show s p ort 4/ 1 as b ein g its R oot P ort b ec au se it has l ess total c ost to u se this p ort to reac h the R oot Brid ge than if it u sed p ort 5 / 2 w ith an aggregated c ost of 3 8 . A n d the sam e hol d s tru e f or Brid ge-B… its R oot P ort hasn ’ t c han ged . Bu t how w il l these sw itc hes d eterm in e w hic h p ort w il l b e the D esign ated P ort on the c ab l e that they b oth share? Both sw itc hes are ad v ertisin g the sam e c ost to eac h other ( a c ost of 19 ) . In this situ ation , w hen tryin g to d eterm in e the D esign ated P ort in a C ol l ision D om ain an d tw o or m ore of the c osts are id en tic al , there is a tie-b reak er that w il l b e u sed … the Brid ge-ID . R ec al l that ev ery Brid ge w il l hav e a u n iq u e Brid ge-ID . J u st as this Brid ge-ID w as in itial l y u sed to d eterm in e the R oot Brid ge, it c an n ow b e u sed again ( w hen the c osts are id en tic al ) to d eterm in e the D esign ated P ort.

Page 16: Calculating an 802.1d Spanning-Tree Operations_Rev-014-KB

Notic e the d if f eren c e! W hen w e p rev iou sl y had a G igab it E thern et l in k b etw een the R oot Brid ge an d Brid ge-A it w as c l ear p ort 5 / 2 on Brid ge-A w as the D esign ated P ort ( b ec au se this b rid ge had a l ow er ad v ertised c ost to the R oot Brid ge than Brid ge-B) . Bu t n ow , b ec au se the c osts are id en tic al Brid ge-B w in s! Brid ge-B’ s Brid ge-Id is l ow er than Brid ge-A ’ s Brid ge-Id . R ec al l that the Brid ge-Id is c om p osed of the Brid ge P riority f ol l ow ed b y the M A C ad d ress. R ight aw ay w e c an see that Brid ge-B has a l ow er Brid ge P riority than Brid ge-A , so w e d on ’ t ev en n eed to c om p are the M A C ad d resses. A t this p oin t, you shou l d n ow b e ab l e to w ork ou t a b asic S p an n in g-T ree T op ol ogy f or you rsel f . T ry it! U se the f ol l ow in g top ol ogy an d see if you c an an sw er these q u estion s ( the sol u tion is at the b ottom of this p ap er) :

1. W h i c h s w i t c h w i l l b e t h e S p a n n i n g -T r e e R o o t B r i d g e ? 2 . W h i c h p o r t ( s ) w i l l b e S p a n n i n g -T r e e R o o t P o r t s a n d i n t h e F o r w a r d i n g s t a t e ? 3 . W h i c h p o r t ( s ) w i l l b e S p a n n i n g -T r e e D e s i g n a t e d P o r t s a n d i n t h e F o r w a r d i n g s t a t e ? 4 . W h i c h p o r t ( s ) w i l l b e S p a n n i n g -T r e e N o n -D e s i g n a t e d P o r t s a n d i n t h e B l o c k i n g

s t a t e ?

Lastl y, there is on e m ore p erm u tation of a top ol ogy that you m ost l ik el y w il l ex p erien c e.

Page 17: Calculating an 802.1d Spanning-Tree Operations_Rev-014-KB

H op ef u l l y, b y this p oin t you u n d erstan d w hy the sw itc h on the l ef t w as el ec ted the R oot Brid ge ( it had a l ow er Brid ge-ID ) . A n d I’ v e ex p l ain ed that al l the p orts on the R oot Brid ge are al w ays D esign ated P orts b ec au se they hav e a c ost of z ero. Norm al l y, the n ex t step in the p roc ess w ou l d b e to d eterm in e the R oot P ort on Brid ge-B an d that w ou l d b e d on e b y tryin g to f igu re ou t w hic h p ort on Brid ge-B had the l ow est c ost b ac k to the R oot Brid ge. Bu t in this p ic tu re, b oth p orts on Brid ge-B hav e the sam e c ost to the R oot Brid ge… a c ost of 19 . I then had m en tion ed that the n ex t tie-b reak er ( w hen the c ost w as id en tic al ) w as to l ook at the Brid ge-ID of you r n eighb or. Bu t the BP D U Brid ge-B rec eiv es on p ort 3 / 2 c on tain s the sam e sen d in g Brid ge-ID ( 3 2 7 68 -0 4-11-11-c c -12 -7 7 ) as the BP D U it rec eiv es on p ort 3 / 1. T here is a f in al tie-b reak er in this situ ation . Let’ s go b ac k to ou r S n if f er trac e of the BP D U ;

W hat you see here is on l y a sm al l p ortion of w hat is c on tain ed w ithin the BP D U b u t I w an t you to p ay sp ec ial atten tion to the highl ighted f iel d . T his f iel d in the BP D U is c al l ed the S en d in g P ort-ID . Not on l y d oes a sw itc h c om e u p w ith a u n iq u e Brid ge-ID to d esc rib e itsel f , b u t it al so assign s a u n iq u e P ort-ID to eac h p ort. W hen tran sm ittin g BP D U s ou t of that p ort it “ tags” that BP D U w ith the sen d in g P ort-ID . A n d j u st as the Brid ge-ID f iel d in a BP D U is ac tu al l y tw o su b -f iel d s ( Brid ge-P riority an d Brid ge M A C A d d ress) the sen d in g P ort-ID f iel d is al so c om p rised of tw o su b -f iel d s, ( P ort P riority an d P ort-ID v al u e) . By d ef au l t, C isc o IO S S w itc hes assign a P ort P riority v al u e of 12 8 to al l p orts. In the ex am p l e ab ov e the v al u e of 8 in “ 8 0 0 5 ” is a hex ad ec im al n u m b er f or P ort P riority that ( w hen tran sl ated in to d ec im al ) ref l ec ts this d ef au l t v al u e of 12 8 . Y ou d on ’ t n eed to k n ow the ex ac t m ec han ism u sed to d eriv e P ort ID s on sw itc hes, b u t you c an f ol l ow this gen eral ru l e: W h en v i ew i n g m u l ti pl e po r ts o n a s w i tch , a l o w er po r t n u m b er w i l l a l s o tr a n s l a te to a l o w er s en d i n g P o r t-I d .

Page 18: Calculating an 802.1d Spanning-Tree Operations_Rev-014-KB

S o in the top ol ogy ab ov e, Brid ge-B w il l sel ec t p ort 3 / 2 as its R oot P ort. N o t i c e , i t d o e s n o t t a k e i n t o c o n s i d e r a t i o n i t s O W N P o r t -I D i n t h i s p r o c e s s . I t o n l y l o o k s a t t h e S e n d i n g P o r t -I D v a l u e s c o n t a i n e d i n t h e B P D U s t h a t i t r e c e i v e s . A n d b y the p roc ess of el im in ation , p ort 3 / 1 m u st go in to the Bl oc k in g state.

Now try an other c ou p l e of ex erc ises an d see how you d o:

Page 19: Calculating an 802.1d Spanning-Tree Operations_Rev-014-KB

Solutions to Exercises

Page 20: Calculating an 802.1d Spanning-Tree Operations_Rev-014-KB