Organize knowledge exchange network

1, the switch receives a data frame behavior

  The switch receives a data frame
    to view the source MAC address, is compared with the MAC address table (CAM), look passive MAC address entries
      are: see if the MAC entry into the binding interface and the interface to the same
        same: refresh timer (300s) Find a destination MAC
        is not the same: re-binding interface refresh timer, looks up the destination MAC address
      no: MAC address learning and bind directly into the interface, refresh timer, searches for the destination MAC
    looks up the destination MAC address
      are: Check the destination MAC binding whether the same interface into the interface (this interface out again from this interface away from)
        the same: to discard
        different: forwarding
      no: flooding (the data transmitted from all other interfaces into other external interface)


2, when a host moves from one port to another switch port, MAC address table of a switch what happens

  When a host is removed from the switch port, the switch detects a physical link Down, thus clearing the host MAC address entries from the MAC address table. Once the host port connected to another switch, the switch detects the new physical link corresponding to the port UP. After the host sends a packet, the switch learns the MAC address of the host and the mapping of the new port, and added to the MAC address table.

3, STP

  work process

    1, a root bridge election

      Election based on: BID

      Election based STP root bridge is the bridge ID, each switch will be STP is a bridge ID (Bridge ID). Bridge consists of a bridge priority ID (Bridge Priority) and 48 16-bit MAC address. In the STP network bridge priority is configurable in the range from 0 to 65535, the default value is 32768. The highest priority device (bridge ID minimum) will be elected as the root bridge. If the priority is the same, it will compare the MAC address, the MAC address is smaller priority.
Mai after the switch starts since the beginning of the spanning tree convergence calculation. By default, when all the switches started considers itself the root bridge, all its ports are designated ports, so BPDU packets can be forwarded through all ports. After receiving BPDU packets on the peer switch will compare their root bridge ID BPDU of the bridge and its own ID. If the bridge ID BPDU packets received low priority, the receiving switch continues to advertise its own configuration BPDU packets to the neighbor switch. If the bridge ID BPDU packets received higher priority, the switch modifies the root bridge ID field its own BPDU packet, declared the new root bridge.

    2, each non-root switch to elect a root port

      Election by: the RFC root path cost (higher bandwidth and costs less), the peer BID, the PID of the end, this end of the PID (port priority + port number)

      Each port has a port switch overhead (Port Cost) parameter, which represents the cost value of the port to send data, i.e., the cost of a port. STP think a port to receive data from no overhead. Bandwidth costs of ports and port-related, the higher the bandwidth, the smaller overhead. From one path to the root bridge to the non-root bridge may be multiple, each path has a total cost value, the cost value is the sum of all of the output ports of the port cost of the path, i.e., the root path cost RPC (Root Path Cost ). Non-root bridge to determine the shortest path to the root bridge, and generates an acyclic tree network according to the root path cost. Root path cost of the root bridge is zero.
Under normal circumstances, there will be a corporate network switching equipment from multiple vendors, Huawei X7 series switches support a variety of STP path cost calculation standard to provide maximum compatibility. By default, Huawei X7 series switches used to calculate the path cost based on IEEE 802.1t.
Each port has a running STP switch port ID, port ID is constituted by port priority and port number. The port priority is in the range from 0 to 240 in steps of 16, i.e., the value must be a multiple of 16. By default, the port priority is 128. Port ID (port ID) can be used to determine the port role.
Each non-root bridge must elect a root port. Root port is the closest port of a root bridge, this is a recent measure by the cumulative cost to determine the root path, that is the root of the smallest cumulative path cost of a port is the root port. After a port receives a BPDU packet, extracting the value of the BPDU packets accumulated root path cost field, together with the port itself is the total path cost of the root path costs. If the ports have the same root path calculation accumulated two or more of the overhead obtained, then choose to receive the minimum BID sender port as a root port.
If the two or more ports are connected to the same switch, the sender selects the minimum PID that port as a root port. If the interface on the same two or more ports are connected to the same switch via the Hub, select the PID in the port of the switch as the smallest root port.

    3, each link / collision domain to elect a designated port (DESI)

      Electoral authority: the local BID, local PID

      Inhibit other port (either their own or other devices) on the network to send the BPDU port, the port is designated segment. Each segment should have a designated port, all ports on the root bridge are designated ports (unless the root bridge exists on the physical loop).
Designated ports election is first compared the cumulative path costs, the total cost of the minimum root path to the port is designated ports. If the same root path cost accumulated, where the bridge port ID of the switch comparison, where the minimum bridge ID ports are elected as the designated port. If it comes out through the cumulative root path cost and location of the bridge ID elections are more port ID, port ID smallest was elected as designated ports.

    4, blocking non-root, non-designated port (ALTE)

      After network convergence, only the root port and designated port can forward data. Other port is ready port is blocked, can not forward data, from the designated switch can receive only the network segment to a BPDU, and in order to monitor the state of the link.

  Port Status

    disabled: disabled, does not deal with not forward BPDU packets, or forward user traffic
    blocking: blocking state, receive and process BPDU, not forward BPDU, or forward user traffic
    listening: listening state, forward BPDU, not forward user traffic
    learning: learning state, a MAC address table may be constructed in accordance with the received user traffic, but not forward user traffic
    forwarding: forwarding state, both forward user traffic is also forwarded BPDU

    The port is no longer the root port or designated port jumps blocked
    port disabled or link fails jumps disabled
    port becomes the root port or designated port when listening becomes from blocking, experience 20s
    port initialization from a disabled state to the blocked state
    listener to learn 15s, 15s forwarded to learn

  In STP BPDU message field: P ID : protocol identifier PVI : protocol version identification (STP default 0) 2 RSTP B PDUs the Type : BPDU type: Configuration BPDU, TCN BPDU (Topology Change Notice)
   
   
   

      Configuration BPDU includes a bridge parameter ID, and the port ID, path cost. STP protocol in the switch transmitting the BPDU fingers to the root switch election, and determining the role and status of each switch port. During initialization, each bridge sends configuration BPDU. After the network topology is stable, only the root bridge sends a BPDU, other switches after receiving a BPDU coming upstream, will send its own configuration BPDU

      TCN BPDU means downstream switch detects the topology change notification to the upstream when a topology change


   The Flags : identification: TCA (topology change acknowledgment), TC (topology changes)
   Root ID : root bridge ID
   the RPC : root path cost
   BID : bridge ID of the bridge priority and MAC address of
   the PID : Port ID of the port priority + port identifier
   Age the message : information survival time, if the configuration BPDU is the root bridge issue, the message Age is 0. Otherwise, Message Age is transmitted from the root bridge to the bridge receives a BPDU current total time including a transmission delay like. In actual implementation, each of the configuration BPDU packet through a switch, Message Age increases. 1
   max Age : maximum timeout, default 20s, refers to the BPDU aging time, this value can be tampered with by the command on the root bridge. Max Age configured by transmitting the BPDU, Max Age can ensure consistency in the entire network. After the non-root bridge receives a BPDU packet, the packet will Message Age Max Age and compared: if Message Age Max Age less, the non-root bridge will continue to forward the BPDU packets. If the Message Age greater than Max Age, the configuration BPDU packets to be aged. The non-root bridge discards the configuration BPDU, and that the network diameter is too large, leading to the root bridge connection failure
   Hello Time : Default 2s transmitting a BPDU, refers to a transmission device running STP configuration BPDU interval, with detecting whether there is a fault in the link. Every switch sends the Hello Time BPDU packets to the configuration around the switch, to confirm whether there is a link fault. When the network is stable, the value is valid only modify the root bridge.
   fwd delay: Forward delay, default 15s

  STP topology change process

    Root bridge failure : non-root bridge will begin after aging BPDU root bridge re-election

      In a stable STP topology, the non-root bridge receives a BPDU from the root bridge on a regular basis. If the root bridge fails, it stops sending BPDU packets, the downstream switch will not receive a BPDU from the root bridge. If the downstream switch has not received BPDU packets, the timer will time out Max Age (Max Age default value of 20 seconds), thereby resulting in failure of the received BPDU message, this time, the non-root switch sends the configuration to each other BPDU packets, re-election of a new root bridge. Root bridge failure will lead to the recovery time of about 50 seconds, the recovery time is about equal to the Max Age plus twice the Forward Delay convergence time

    Direct link (direct to root bridge) failure : preliminary port into the root port, a new root port in the forwarding state to return to the 30s

      In this embodiment, SWA and SWB are interconnected using two links, one of which is the active link, the other one is the standby link. After normal spanning tree convergence is detected if the root SWB link port of a physical failure occurs, it will migrate to the Alternate port Listening, Learning, Forwarding state, after the Forward Delay twice to return to the forwarding state

    Non-direct link failure : forwarding state to be restored to the 50s (max age + twice the forward delay)

      In the present embodiment, the link between the SWA SWB not some trouble has occurred (non-physical layer fault), SWB thus never receive a BPDU from the SWA. At this point, SWB SWA considers the root bridge is no longer valid, and began to send BPDU packets to the SWC, SWC inform themselves as the new root bridge. SWC will continue to receive a BPDU from the original root bridge, and therefore will ignore a BPDU SWB sent. Since the SWC's Alternate ports can no longer receive BPDU packets contain the original root bridge ID's. After its Max Age timer expires, SWC will switch Alternate port as the designated port and forwards the message to SWB BPDU from its root port. SWB give up claim to be the root bridge and began to converge port is the root port. After the non-direct link failure, due to the need to wait for Max Age plus twice the Forward Delay time, ports need about 50 seconds to return to the forwarding state

    Topology changes lead to mac address table error : to go through the default mac address entry aging time 300s, transmitted properly during this period

      In a switched network, the switch MAC address table dependent forwarding data frames. By default, the aging time of MAC address entries is 300 seconds. If spanning tree topology changes, the path switch forwards data will be with the change, this time not timely entry will be aged out of the MAC address forwarding table lead to errors, it is necessary to update the MAC address table after the topology changes item.
In the present embodiment, MAC address entries SWB through port defined in the GigabitEthernet can reach the host A 0/0/3, the host can be reached through port GigabitEthernet 0/0/1 B. Since SWC root port failure, resulting in the spanning tree topology converges again, after the completion of the spanning tree topology converges, from host A to host B frame still can not reach the destination. This is because the MAC address aging time is 300 seconds, the frames sent to the host A host B arrives SWB, SWB will continue to forward the data frame through port GigabitEthernet 0/0/1

      拓扑变化过程中,根桥通过TCN BPDU报文获知生成树拓扑里发生了故障。根桥生成TC用来通知其他交换机加速老化现有的         MAC地址表项。
      拓扑变更以及MAC地址表项更新的具体过程如下:
      1. SWC感知到网络拓扑发生变化后,会不间断地向SWB发送TCN
      BPDU报文。
      2. SWB收到SWC发来的TCN BPDU报文后,会把配置BPDU报文中的 Flags的TCA位设置1,然后发送给SWC,告知SWC停止发       送TCN BPDU报文。
      3. SWB向根桥转发TCN BPDU报文。
      4. SWA把配置BPDU报文中的Flags的TC位设置为1后发送,通知下游设备把MAC地址表项的老化时间由默认的300秒修改为           Forwarding Delay的时间(默认为15秒)。
      5. 最多等待15秒之后,SWB中的错误映射关系会被自动清除。此后, SWB就能通过G0/0/2端口把从主机A到主机B的帧正确地         进行转发

4、根桥产生故障后,其他交换机会被选举为根桥。那么原来的根桥恢复正常之后,网络又会发生什么变化

  如果生成树网络里面根桥发生了故障,则其它交换机中优先级最高的交换机会被选举为新的根桥。如果原来根桥再次激活,则网络又会根据BID来重新选举新的根桥

5、端口开销和根路径开销的区别是什么?

  根路径开销是到根桥的路径的总开销,而端口开销指的是交换机端口的开销

 


 




  

 

 

 

 

Guess you like

Origin blog.csdn.net/weixin_43955429/article/details/89855826