Beruflich Dokumente
Kultur Dokumente
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
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 gT 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 geID . 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.
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 :
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-
em b er w
oot Brid
er. I n S p
o th e r to
hen
ge?
a n n
s e e
tw
T
in
w
g it ou t to d eterm in e w ho w ou l d b e
ge-Id s an d the l o w es t v al u e w as the
p a r in g tw o o r m o r e v a lu e s a g a in s t
t v a lu e a lw a y s w in s .
e e d
M b
0 M
0 0 M
o f lin k
p s E thern et
b p s F astE thern et
b p s G igab it E thern et
C o st
10 0
19
4
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 .
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:
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 ;
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 gT ree u ses c ost to ref l ec t the b an d w id th of a l in k .
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 ) .
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:
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 geID .
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.
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.
2 .
3 .
4 .
h ic h
h ic h
W h ic h
W h ic h
sta te ?
W
sw
p o
p o
p o
itc
r t(
r t(
r t(
h
s)
s)
s)
w ill
w ill
w ill
w ill
b e
b e
b e
b e
th
S
S
S
e S
p a n
p a n
p a n
p a n
n in
n in
n in
n in
g -T
g -T
g -T
g -T
r e e
r e e
r e e
r e
R
D
N
e R o
o o t P
e s ig n
o n -D
o t B r
o r ts
a te d
e s ig n
id g e ?
a n d in th e F o r w a r d in g s ta te ?
P o r ts a n d in th e F o r w a r d in g s ta te ?
a te d P o r ts a n d in th e B lo c k in g
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.
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 ;
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.
Solutions to Exercises