Sunday, September 22, 2013

Understanding Spanning-Tree Root-Port Election

The STP Root Por selections follows the following sequence of FOUR conditions:

1. Lower Root Bridge ID
2. Lower Path Cost to the Root bridge.
3. Lower sending Bridge ID
4. Lower Sending Port ID
Lab1:
case-1-1.png
The root path cost on both fa0/1 and fa0/2 (SW4) is the same
First before looking the port-ID ,SW4 looks the BID of SW2 and SW3 (the neighbors swiches of SW4),SW2 has (advertises) a better BID than SW3 ,The BID= priority+mac address, here since the priority of SW2 and SW3 is the same=32769 , the mac address wil be used ,the mac address of SW2(0010.11BA.32CB) is lower than the mac address of SW3 (0060.7011.98C3) thus fa0/2 receives a better BID of BPDUs so fa0/2 will the root port:

SW2#show spanning-tree
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 4097
Address 000A.F3CC.3EA1
Cost 19
Port 1(FastEthernet0/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 0010.11BA.32CB
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/2            Desg FWD 19        128.2    P2p
Fa0/1            Root FWD 19        128.1    P2p

SW3#show spanning-tree
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 4097
Address 000A.F3CC.3EA1
Cost 19
Port 2(FastEthernet0/2)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 0060.7011.98C3
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/2            Root FWD 19        128.2    P2p
Fa0/1            Desg FWD 19        128.1    P2p

Now let's configure the BID of SW3 to be better than the BID of SW2:

SW3(config)#spanning-tree vlan 1 priority 8192

Now the BID of SW3 is 8193:0060.7011.98C3 as shown by the show spann of SW3 below and the BID of SW2 is 32769:0010.11BA.32CB ,so fa0/1 receives a better BID from SW3 thus fa0/1 is the root port for SW4 as shown by the show spann on SW4 below:

SW3(config)#do show spann
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 4097
Address 000A.F3CC.3EA1
Cost 19
Port 2(FastEthernet0/2)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 8193 (priority 8192 sys-id-ext 1)
Address 0060.7011.98C3
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/2            Root FWD 19        128.2    P2p
Fa0/1            Desg FWD 19        128.1    P2p

SW4#show spanning-tree
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 4097
Address 000A.F3CC.3EA1
Cost 38
Port 1(FastEthernet0/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 0060.2F98.0E5A
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/2            Altn FWD 19        128.2    P2p
Fa0/1            Root FWD 19        128.1    P2p

Lab2:
case2.pngSW1 is the root bridge,Remember all ports of a root bridge are a designated ports not a Root Ports as shown by the following output:

SW1(config)#do show spa
VLAN0001
  Spanning tree enabled protocol rstp
  Root ID    Priority    24577
             Address     0006.2A94.4A8D
             This bridge is the root
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    24577  (priority 24576 sys-id-ext 1)
             Address     0006.2A94.4A8D
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1            Desg FWD 19        128.1    P2p
Fa0/10           Desg FWD 19        128.10   P2p

let's see with SW2:

SW2 chooses Fa0/10 as a Root Port and fa0/1 as a Bolocked Port.
how SW2 chooses fa0/10 as a Root Port?

SW2 needs to pick a single Root Port to reach the Root Bridge SW1 .After electing SW1 as the Root Bridge, SW2 evaluates Root Path Cost. Because both SW2:fa0/1 and SW2:fa0/10 have the same cost toward the Root Bridge, there is a tie. To break the tie, SW2 considers the Sending BID that it is receiving over both links.But both ports are connected to the same bridge,causing SW2 to receive the same Sending BID on both links. This results in another tie.Finally, SW2 evaluates the Port ID received in Configuration BPDUs on both ports. SW2:fa0/1 is receiving a Port ID of SW1:fa0/10, and SW2:fa0/10 is receiving a Port ID of SW1:fa0/1. SW2 chooses the lower value for a Root Port, finally fa0/10 is the root port while fa0/1 is a blocked port.
So it is the received values that are used here. SW2 does not evaluate its own BID and Port ID; it is looking at the values contained in the BPDUs being received from SW1.

SW2(config)#do show spann
VLAN0001
  Spanning tree enabled protocol rstp
  Root ID    Priority    24577
             Address     0006.2A94.4A8D
             Cost        19
             Port        10(FastEthernet0/10)
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     00D0.FF26.2375
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1            Altn BLK 19        128.1    P2p
Fa0/10           Root FWD 19        128.10   P2p

The Port-ID is the priority of the port+the interface number
To ensure that fa0/1 becomes the Root Port,we will increase the priority of fa0/10 of SW1:

SW1(config)#int fa0/1
SW1(config-if)#spanning-tree vlan 1 port-priority ?
  <0-240>  port priority in increments of 16
SW1(config-if)#spanning-tree vlan 1 port-priority 240

verify the priority of fa0/1 on SW1:
SW1(config-if)#do show span
VLAN0001
  Spanning tree enabled protocol rstp
  Root ID    Priority    24577
             Address     0006.2A94.4A8D
             This bridge is the root
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    24577  (priority 24576 sys-id-ext 1)
             Address     0006.2A94.4A8D
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1            Desg FWD 19        240.1    P2p
Fa0/10           Desg FWD 19        128.10   P2p

As expected ,On SW2 now fa0/1 is the Root Port and fa0/10 is the Blocked port because now fa0/1 receives the lowest port-ID 128 from the port fa0/10 and fa0/10 receives the port-ID 240.1 from the port fa0/1 as shown by the following output:

SW2#show spanning-tree 
VLAN0001
  Spanning tree enabled protocol rstp
  Root ID    Priority    24577
             Address     0006.2A94.4A8D
             Cost        19
             Port        1(FastEthernet0/1)
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     00D0.FF26.2375
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1            Root FWD 19        128.1    P2p
Fa0/10           Altn BLK 19        128.10   P2p

Lab3:
case3.png
SW1 is the root bridge and it's connected to SW2 via a Hub:

SW1 is the root bridge,we know that all ports of a Root Bridge are in Designated roles as shown in the following output:

SW1#show spanning-tree 
VLAN0001
  Spanning tree enabled protocol rstp
  Root ID    Priority    24577
             Address     00E0.B0D2.5A23
             This bridge is the root
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    24577  (priority 24576 sys-id-ext 1)
             Address     00E0.B0D2.5A23
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1            Desg FWD 19        128.1    Shr


Let's see on SW2,fa0/2 is the Root Port while fa0/3 is a Blocked Port:
SW2#show spanning-tree 
VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    24577
             Address     00E0.B0D2.5A23
             Cost        19
             Port        2(FastEthernet0/2)
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     00D0.BA83.2AA4
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/2            Root FWD 19        128.2    Shr
Fa0/3            Altn BLK 19        128.3    Shr

Let's look SW2 which is the interesting case.
SW2 needs to select one Root Port.After electing SW1 as the Root Bridge, SW2 evaluates Root Path Cost. Because both SW2:fa0/2 and SW2:fa0/3 have the same cost toward the Root Bridge, there is a tie. To break the tie, SW2 considers the Sending BID that it receives over both links.But both ports are connected to the same Root Bridge, which causes SW2 to receive the same Sending BID on both links. There is another tie. SW2 evaluates the Port ID received in Configuration BPDUs on both ports. SW2:fa0/2 is receiving a Port ID 128.1 of SW1:fa0/1, and SW2:fa0/3 is receiving a Port ID 128.1 of SW1:fa0/1. There is a tie because the sender Port ID is the same from SW1 which is 128.1 on both ports of SW2. To override the tie, SW2 will evaluate its own local Port ID values (the lower Port ID will be the Root Port),so fa0/2 is RP and fa0/3 is BP.
Notice that the condition: "Using the Local Port ID Value As a Tie-Breaker "is not included in the four conditions described above.
 
STP Root port selection becomes:

1. Lower Root Bridge ID
2. Lower Path Cost to the Root bridge.
3. Lower sending Bridge ID
4. Lower Sending Port ID
5. Lower Local port-id

the fifth tie breaker is the local Switch port-id, the lowest is prefered.
This is the only case where the local Port ID is used.

To ensure that fa0/3 becomes the root port we will either increase the port-priority of fa0/2 or decrease the port-priority of fa0/3:

Let' go:

SW2(config)#int fa0/3
SW2(config-if)#spanning-tree vlan 1 port-priority 16

Now fa0/3 is the Root port and fa0/2 is the Blocked Port as shown by the following output:

Switch#show spanning-tree 
VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    24577
             Address     00E0.B0D2.5A23
             Cost        19
             Port        3(FastEthernet0/3)
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     00D0.BA83.2AA4
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/2            Altn BLK 19        128.2    Shr
Fa0/3            Root FWD 19        16.3     Shr


Notice when connecting the Switch with a Hub the link Type displayed in the show spanning-tree which is Shr.

By definition:
RSTP uses three Link Types. 
-Point-to-Point Link - This is connected to another switch. If a switchport is operating at full duplex and is receiving Hellos, then it is a Point-to-Point Link.
-Shared Link - This is connected to something like a hub. Hellos are being received but it is operating at half duplex.
-Edge - This is connected to an end-device. Equivalent to PortFast in traditional 802.1d.

Thursday, September 12, 2013

保罗盖帝十问

保罗盖帝(J.Paul Getty)(1892-1976),美国人,是1957年世界首富,靠石油起家,但真正将他推上世界首富的宝座的,其实是股票。
在1929年代美国股市崩溃,引发了世界经济大萧条,股价跌至令人难以思议的低水平,保罗盖帝采取了反向投资策略,大胆的吸购股票,买进后就不再卖出,他当时所收购的石油股,在往后的三十年中,增值数百倍、数千倍,使他成为世界首富。
油股价逊油藏
他所收购的都是石油股。他的理由是,作为一名石油开发者,他最熟悉的就是石油业。
他根据上市石油公司的资料,计算出来,这些石油公司所拥有的油田,石油蕴藏量庞大无比,如果开发出来,可以取得惊人的利润,当时石油公司的股价,只等于石油蕴藏量价值的数十分之一而已,他觉得不可思议。
而且发现这是一个千载难逢的投资机会,于是静悄悄地在股市吸购石油股,直到控制这些石油公司为止。
他在买进这些石油公司的股票,就不再卖出,这些股票的价格,跟着石油公司盈利的持续上升,增值数百倍至数千倍不等,使他富可敌国。
保罗盖帝将他的投资心得,写成多本书,其中一本《如何致富》(How To Be Rich),影响了我一生。
我在60年代中期,无意间买到这本小书,读了其中一篇文章<华尔街投资者>(The Wall Street Inverstor)对于他所提到的股票投资理论,心服口服,从此“择善而囤机”坚决遵行,数十年如一日,从未改弦易辙。
这几年来,我持续不断的写《分享集》,又出版了《30年股票投资心得》一书,其实是受此书的影响——与读者分享我的投资心得,希望读者受惠,就好像我那本《如何致富》,使我一生受惠一样。
《如何致富》由60年代起成为我的案头书,不时加以翻阅,以温习保罗盖帝的投资心得,以免受到大马股市浓郁的投机气氛的影响而偏离正道。
这本小书,收集19篇文章,其中一篇<华尔街投资者>,只有短短的15页,我读了无数次,几乎可以背出来,到现在还在重读,我只读此篇,其余18篇从来没有读过第二次。
好的文章,一篇就够了,如果能吸收其精华,可以使你一生受惠。
我就是一个典型的例子,数十年来,我读过不下百本中英文股票投资经典,没一本有如此深刻的印象。
《华尔街投资者》塑造投资理念
1.反向:股票是应在股市低沉时才买进的。
2.买股票就是买公司的资产与业务。
3.只有长期投资才有可能在股市赚钱。
4.投机是麻烦的开始。
我在60年代中期,开始研究及投资股票,在开始阶段,我也好像许多投资者那样,把注意力集中在股市的波动上,认为准确预测股市动向,是股票投资成功的主要因素,我也相信,炒股贴士是快速致富的最佳法门。
投机难赚大钱
所以,我到外打听炒股的消息,同时贴身跟踪股市的发展,企图通过投机赚大钱。
但是,经过几年在股市中抢进杀出,时亏时赚,结算一下,反而亏本,更糟糕的是,精神受尽了煎熬,真是赔了夫人又折兵。
就在我对股票投资之道,苦苦思索的时刻,我读了《华尔街投资者》,几乎喊出来“我找到了”。这篇文章,使我对投资之道“悟道”,走上了投资正道。
满意答案才买
保罗盖帝说,在买时股票之前,每一名投资者都要回答十个问题,只有得到满意的答案时才应该买进,这十个问题为:
1.公司的历史反映它是不是一家坚实及信誉卓著的公司,是否拥有能干、有效率及经验丰富的管理层?
2.公司所生产的产品,或是所提供的服务,是不是在可以预见的将来,继续有需求?
3.公司所从事的行业,是否过于“拥挤”?公司是否具有竞争能力?
4.公司是否有远见的策略,不从事过分及危险性的扩展?
5.公司的账目,是否经得起严格及公正审计师的查账?
6.公司是否有令人满意的业绩纪录?
7.公司是否定期派发合理的股息?如果偶然停发股息,是否有合乎情理的理由?
8.公司的长短期债务,是否在安全的范围内?
9.在过去数年中,公司股价是否波动激烈,而又难以解释?
10.每股净资产价值是否高过股价?
保罗盖帝坚持,除非你能对这“十问”找到满意的答案,你就不应买进其股票。
他信心十足的说:经过严格筛选的股票,是最好的投资。
长期的持有,可以致富。
他本身就是一个最好的例子。
●冷眼 股市基本面大师
Related Posts Plugin for WordPress, Blogger...