{"id":813,"date":"2011-09-05T12:22:00","date_gmt":"2011-09-05T04:22:00","guid":{"rendered":"http:\/\/note.systw.net\/note\/?p=813"},"modified":"2023-11-05T12:24:46","modified_gmt":"2023-11-05T04:24:46","slug":"802-1w-rstp","status":"publish","type":"post","link":"https:\/\/systw.net\/note\/archives\/813","title":{"rendered":"802.1w RSTP"},"content":{"rendered":"\n<p>RSTP(Rapid Spanning Tree Protocol)<br>IEEE 802.1w , \u65bc2001\u5e74\u63d0\u51fa<br>ps:<br>RSTP includes features equivalent to Cisco PortFast, UplinkFast, and BackboneFast for faster network reconvergence.<\/p>\n\n\n\n<p><strong>convergence much faster<\/strong><br>1. \u6536\u6582\u901f\u5ea6\u6700\u5feb\u53ef\u52301sec<br>2. \u5728Blocking state port\u4e0d\u9808\u75282\u500d\u7684Forward Delay\u6642\u9593\u5373\u53ef\u76f4\u63a5\u8b8a\u6210Forward state<br>ex:<br>1. edge port\u53ef\u4ee5\u76f4\u63a5\u8fdb\u5165forward state and no delay<br>2. \u7576root port\u70baBlocking status,\u4e14new root port\u6240\u63a5\u4e4bdesignated port\u70baForwarding status\uff0c\u5247new root port \u53ef\u7acb\u5373\u6210\u70baForwarding status<br>3. non-edge port\u7684designated port\uff0c\u53ef\u8207neighbor bridge\u9032\u884cPA handshake\u800c\u5feb\u901f\u6210\u70baForwarding status<\/p>\n\n\n\n<p><strong>RSTP\u5c0dSTP\u7684\u6539\u9032<\/strong>\u3000<br>1<br>STP\u6536\u6582\u4e3b\u8981\u4f9d\u8d56port status<br>RSTP\u6536\u6582\u4e3b\u8981\u4f9d\u8d56port type<br>2<br>STP port state\u6539\u8b8a,\u9700\u4f9d\u8cf4timer\u8d85\u6642<br>RSTP port state\u6539\u8b8a,\u662f\u4e3b\u52d5\u5354\u5546<br>3(\u5f85\u78ba\u8a8d)&nbsp;<br>STP\u4e2d\u7684non-root bridge\u53ea\u80fdrelay\u7684hello bpdu<br>RSTP\u4e2d\u7684non-root bridge\u6703\u4e3b\u52d5\u767chello bpdu\u3000<\/p>\n\n\n\n<p><strong>RSTP\u76f8\u5bb9\u6027<\/strong><br>RPVST+(Rapid PVST+)<br>\u3000by using RSTP as the underlying mechanism for the Cisco-proprietary PVST+<br>MST(Multiple Spanning Tree)<br>\u3000RSTP also is used as part of the IEEE 802.1s MST operation.<br>\u3000RSTP operates consistently in each, but replicating RSTP as multiple instances requires different approaches.<\/p>\n\n\n\n<p>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;<\/p>\n\n\n\n<p><strong>root bridge<\/strong><br>The root bridge in a network using RSTP is elected just as with 802.1D(by the lowest&nbsp;Bridge ID)&nbsp;<\/p>\n\n\n\n<p><strong>RSTP port roles<\/strong><br>After all switches agree on the identity of the root, the following port roles are determined:<br><strong>Root port<\/strong>(This is identical to 802.1D)<br>\u3000\u4fdd\u6301forward state<br><strong>Alternate port<\/strong><br>\u3000A port that has an alternative path to the root, different from the path the root port takes.<br>\u3000This path is less desirable than that of the root port.<br>ex:<br>an access-layer switch with two uplink ports; one becomes the root port, and the other is an alternate port.<br><strong>Designated port<\/strong>&nbsp;(This is identical to 802.1D)<br>\u3000\u4fdd\u6301forward state<br><strong>Backup port<\/strong><br>\u3000\u5099\u63f4\u7684designated port<br>\u3000A port that provides a redundant (but less desirable) connection to a segment where another switch port(deesignated port) already connects.<\/p>\n\n\n\n<p><strong>RSTP port states<\/strong><br>1. After the role is determined, each port can be given a state that determines what it does with incoming data.<br>2. RSTP defines port states only according to what the port does with incoming frames.<br>(Naturally, if incoming frames are ignored or dropped, so are outgoing frames.)<br>Any port role can have any of these port states:<br><strong>Discarding<\/strong>(=Disabled, Blocking,Listening states)<br>\u30001.Incoming frames simply are dropped;<br>\u30002.no MAC addresses are learned.<br><strong>Learning<\/strong>(\u66ab\u6642\u6027\u5b78\u7fd2)<br>\u30001. Incoming frames are dropped,<br>\u30002. but MAC addresses are learned.<br><strong>Forwarding<\/strong>(\u53ea\u89816\u79d2\u5373\u53ef\u9032\u5165\u6b64\u72c0\u614b)<br>\u30001. Incoming frames are forwarded<br>\u30002. according to MAC addresses that have been (and are being) learned<br>ps:<br>discarding state combines the 802.1D Disabled, Blocking,Listening states because all three did not effectively forward anything.<br>ps:<br>The Listening state is not needed because RSTP quickly can negotiate a state change without listening for BPDUs first.<\/p>\n\n\n\n<p>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;<\/p>\n\n\n\n<p><strong>BPDU<\/strong><br>1. RSTP uses the 802.1D BPDU format for backward compatibility.<br>2. The sending switch port identifies itself by its RSTP role and state<br>3. RSTP BPDU is ver2 ,802.1D BPDUs is ver0<\/p>\n\n\n\n<p><strong>some previously unused bits in the Message Type field are used.<\/strong><br>stp:flags(1byte):<br>\u300000000000:topology change(\u6709\u67b6\u69cb\u8b8a\u66f4\u65d7\u6a19)<br>\u300010000000:topology change ack(\u67b6\u69cb\u8b8a\u66f4\u56de\u8986\u65d7)<br>rstp:flags(1byte):<br>\u300000000000:\u540cstp<br>\u300000000001\u70baProposal message<br>\u300000000[00]0:\u70baport role\u5982\u4e0b<br>\u3000\u3000[00] unknown<br>\u3000\u3000[01] alternate\/backup port<br>\u3000\u3000[10] root port<br>\u3000\u3000[11] designate port<br>\u300000010000:\u70baLearning state<br>\u300000100000:\u70baforwarding state<br>\u300001000000:\u70baagreement message<br>\u300010000000:\u540cstp<\/p>\n\n\n\n<p><strong>BPDU\u904b\u4f5c<\/strong><br>BPDUs are sent out every switch port at Hello Time intervals, regardless of whether BPDUs are received from the root.<br>ps:<br>any switch anywhere in the network can play an active role in maintaining the topology\u3000<\/p>\n\n\n\n<p><strong>BPDU\u907a\u5931<\/strong><br>When 3 BPDUs(3 Hello intervals) are missed in a row&nbsp;(default 6sec)<br>\u30001. neighbor switch is presumed to be down,<br>\u30002. all information related to the port leading to the neighbor immediately is aged out.<br>ps:<br>the Max Age timer interval (default 20 seconds) for 802.1D,\u624d\u80fd\u66f4\u65b0BPDU<\/p>\n\n\n\n<p><strong>\u4e0d\u540c\u7248\u672cBPDU\u8655\u7406<\/strong><br>RSTP can coexist with switches still using 802.1D<br>Each port attempts to operate according to the STP BPDU that is received.<br>ps:<br>802.1D STP\u7121\u6cd5\u8fa8\u8b58RSTP\u7684BPDU<br>ex:<br>when an 802.1D BPDU is received on a port, that port begins to operate according to the 802.1D rules.<\/p>\n\n\n\n<p><strong>\u6539\u8b8aSTP\u6642\u7684\u904b\u4f5c<\/strong><br>each port has a measure that locks the protocol in use, in case BPDUs from both 802.1D and RSTP are received within a short time frame.<br>This can occur if the switches in a network are being migrated from one STP type to another. Instead of flapping or toggling the STP type during a migration, the switch holds the protocol type for the duration of a migration delay timer.<br>After this timer expires, the port is free to change protocols if needed.<\/p>\n\n\n\n<p>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;<\/p>\n\n\n\n<p><strong>RSTP Convergency<\/strong><br>When a switch first joins the topology (perhaps it was just powered up) or has detected a failure in the existing topology, RSTP requires it to base its forwarding decisions on the type of port<br>ps:<br>RSTP\u900f\u904eport type\u53ef\u5feb\u901f\u6536\u6582\u4e0d\u4f9d\u8cf4timer,\u4f46STP\u8981\u5feb\u901f\u6536\u6582\u53ea\u80fd\u4f9d\u8cf4timer<br>ps:<br>RSTP takes a different approach when a switch needs to decide how to participate in the tree topology.<\/p>\n\n\n\n<p><br><strong>Port Types<\/strong><br>Every switch port can be considered one of the following types:<br>Edge port:\u53ef\u5feb\u901f\u8f49\u79fb,\u4e0d\u6703\u6536\u5230\u4efb\u4f55bpdu,\u4e5f\u5c31\u662f\u63a5\u5230hub\u6216pc<br>nonedge port:\u5728\u9019\u88e1\u6307\u5168\u96d9\u5de5\u7684switch\u9593\u9023\u7dda<br>\u3000Root port<br>\u3000Point-to-point port:\u53ef\u5feb\u901f\u8f49\u79fb<\/p>\n\n\n\n<p><br><strong>Edge port<\/strong><br>1.A port at the &#8220;edge&#8221; of the network, where only a single host connects.<br>ps:this has been identified by enabling the STP PortFast feature. RSTP keeps the PortFast concept for familiarity.<br>2.the port cannot form a loop as it connects to one host, so it can be placed immediately in the Forwarding state.<br>ps:<br>if a BPDU ever is received on an edge port<br>\u30001.the port immediately loses its edge port status<br>\u30002.topology change be triggered(a nonedge port transitions to the Forwarding state)&nbsp;<br><strong>Root port<\/strong><br>1. The port that has the best cost to the root of the STP instance.<br>2. Only one root port can be selected and active at any time, although alternative paths to the root can exist through other ports.<br>3. If alternative paths are detected, those ports are as alternative root ports and immediately can be placed in the Forwarding state when the existing root port fails.<br><strong>Point-to-point port(designated port)<\/strong><br>1. Any port that connects to another switch and becomes a designated port.<br>2. A quick handshake with the neighboring switch, rather than a timer expiration, decides the port state.<br>3. BPDUs are exchanged back and forth in the form of a proposal and an agreement.<br>4. One switch proposes that its port becomes a designated port; if the other switch agrees, it replies with an agreement message.<\/p>\n\n\n\n<p>&#8230;<\/p>\n\n\n\n<p><strong>Point-to-point ports\u7684\u7522\u751f\u65b9\u5f0f<\/strong><br>automatically be determined by the duplex mode in use<br>Full-duplex ports<br>\u30001 point to point port(p2p)<br>\u3000because only two switches can be present on the link.<br>\u30002.STP convergence can occur quickly over a p2p link through RSTP handshake messages<br>Half-duplex ports<br>\u30001 not point-to-point ports\/shared port.<br>\u3000because a shared medium with possibly more than two switches present.<br>\u30002.the traditional 802.1D style convergence must be used. This results in a slower response<\/p>\n\n\n\n<p><br><strong>RSTP\u6536\u6582\u539f\u7406<\/strong><br>propagation of handshakes over point-to-point links<br>step1<br>When a switch needs to make an STP decision,a handshake is made with the nearest neighbor.<br>step2<br>When that is successful, the handshake sequence is moved to the next switch and the next, as an ever-expanding wave moving toward the network&#8217;s edges.<\/p>\n\n\n\n<p><br><strong>Synchronization concept<\/strong><br>To participate in RSTP convergence, a switch must decide the state of each of its ports.<br>1. Nonedge ports begin in the Discarding state.<br>2. After BPDUs(PA handshake) are exchanged between the switch and its neighbor, the Root Bridge can be identified.<br>3. If a port receives a superior BPDU from a neighbor, that port becomes the root port<\/p>\n\n\n\n<p><strong>PA handshake<\/strong><br>For each nonedge port, the switch exchanges a proposal-agreement handshake(a configuration BPDU) to decide the state of each end of the link<br>ps:\u7576non-edge port\u5f9eblocking\u6210\u70baforwarding\u72c0\u614b,\u624d\u6703\u904b\u4f5cPA handshake<\/p>\n\n\n\n<p><strong>Synchronization process<\/strong><br>Each switch assumes that its port should become the designated port for the segment, and a proposal message is sent to the neighbor suggesting this.<br>\u6b65\u9a5f\u5982\u4e0b<br>1<br>switch(DP)\u50b3\u9001Proposal message(BPDU flag 00000001)\u5230neighbor switch(root port)<br>ps:switch all Nonedge ports begin in the Discarding state.<br>2<br>neighbor switch\u505a\u4ee5\u4e0b\u4e8b<br>All nonedge ports immediately are moved into the Discarding (blocking) state<br>neighbor switch(root port)\u50b3\u56deagreement message(BPDU flag 01000000)\u7d66switch(DP)<br>3<br>switch\u7684designated port\u548cneighbor switch\u7684root port\u9032\u5165Forwarding state,\u53ef\u958b\u59cbforwarding<br>4<br>\u82e5neighbor switch\u9084\u6709\u5c1a\u672a\u505aPA\u4ea4\u63e1\u4e4bswitch,\u5247neighbor switch\u505a\u70ba\u6b65\u9a5f1\u4e2d\u7684switch<br>ps:<br>This creates a moving &#8220;wave&#8221; of synchronizing switches, which quickly can decide to start forwarding on their links only if their neighbors agree<br>ps:<br>the entire convergence process happens quickly, at the speed of BPDU transmission,without the use of any timers<\/p>\n\n\n\n<p>\u63a5\u6536agreement message\u7570\u5e38\u6642<br>Suppose that the neighboring switch does not understand RSTP or has a problem replying.<br>The sending switch then must become overly cautious and must begin playing by the 802.1D rules &#8211; the port must be moved through the legacy Listening and Learning states (using the Forward Delay timer) before moving to the Forwarding state.<\/p>\n\n\n\n<p>&#8230;<\/p>\n\n\n\n<p><strong>TC(topology change)<\/strong><br>RSTP detects a topology change only when a nonedge port transitions to the Forwarding state.<br>topology changes are detected only so that bridging tables can be updated and corrected as hosts appear first on a failed port and then on a different functioning port.<\/p>\n\n\n\n<p><strong>TC\u7684\u8655\u7406<\/strong><br>a switch must propagate news of the change to other switches in the network so that they can correct their bridging tables, too.<br>This process is similar to the convergence and synchronization mechanism;<br>TC messages propagate through the network in an ever-expanding wave<\/p>\n\n\n\n<p><strong>TC\u7684\u6b65\u9a5f<\/strong><br>1.<br>The switch send BPDUs(with their TC bit set) out all the nonedge designated ports<br>This is done until the TC timer expires, after 2 intervals of the Hello time<br>\u7528\u9014:This notifies neighboring switches of the new link and the topology change.<br>2.<br>The swich all MAC addresses associated with the nonedge designated ports are flushed from the CAM table.<br>\u7528\u9014:This forces the addresses to be relearned after the change, in case hosts now<br>appear on a different link<br>3.<br>All neighboring switches that receive the TC messages,\u505a\u4ee5\u4e0b\u5169\u4ef6\u4e8b<br>\u30003.1 flush the MAC-addr learned on all ports except the one that received the TC message<br>\u30003.2 \u6210\u70bastep1\u4e2d\u7684switch , send TC messages out their nonedge designated ports, and so on.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>RSTP(Rapid Spanning Tree Proto &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"","fifu_image_alt":"","_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[26],"tags":[],"class_list":["post-813","post","type-post","status-publish","format-standard","hentry","category-osi-layer2"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts\/813","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/comments?post=813"}],"version-history":[{"count":0,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts\/813\/revisions"}],"wp:attachment":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/media?parent=813"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/categories?post=813"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/tags?post=813"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}