这篇阅读笔记主要是阅读文章过程中的一些摘录和总结,主要以英文呈现,因为我觉得强行把英文翻译为中文,麻烦且不说,还会丢失一些信息。不过后面考虑到要给小组成员共享,渐渐写成中文。
Basic Switch Operation, by Joann Zimmerman, Charles E. Spurgeon
- Ethernet switches perform their linking function by bridging Ethernet frames between Ethernet segments. To do this, they copy Ethernet frames from one switch port to another, based on the Media Access Control (MAC) addresses in the Ethernet frames.
- Ethernet switches are designed so that their operations are invisible to the devices on the network, which explains why this approach to linking networks is also called transparent bridging. “Transparent” means that when you connect a switch to an Ethernet system, no changes are made in the Ethernet frames that are bridged. The switch will automatically begin working without requiring any configuration on the switch or any changes on the part of the computers connected to the Ethernet network, making the operation of the switch transparent to them.
- every port on a switch has a unique factory-assigned MAC address.
However, unlike a normal Ethernet device that accepts only frames addressed directed to it, the Ethernet interface located in each port of a switch runs in promiscuous mode. In this mode, the interface is programmed to receive all frames it sees on that port, not just the frames that are being sent to the MAC address of the Ethernet interface on that switch port.
1. How switch works?
1.1 Address learning
- When switch receives a frame, records the port ID and its corresponding station MAC. This end up a forwarding database.
- This database(forwarding database) is used by the switch to make a packet forwarding decision in a process called adaptive filtering. Without an address database, the switch would have to send traffic received on any given port out all other ports to ensure that it reached its destination (so call flooding).
1.2 Traffic Filtering
- Each port in the switch has the ability to hold frames in memory, before transmitting them onto the Ethernet cable connected to the port.
- A frame will only be sent to its destined port, other ports will not see this frame. This switch logic keeps traffic isolated to only those ethernet cables/segments, prevents flow of unnecessary trafiic on other segments.
1.3 Frame Flooding
- Switches automatically delete entries in their forwarding database after a period of time – typically 5 mins – if they do not see any frames from a station. This keeps the forwarding database from growing full of stale entries that useless.
- When recieves a unknown destination address frame, just flood it to all other ports.
1.4 Broadcast and Multicast Traffic
- Enable broadcast and multicast, so that a frame can be sent to a group of stations.
- Group address always begin with a specific bit pattern defined in the Ethernet standard.
- The Ethernet software, also called “interface driver” software, programs the interface to accept frames sent to the group address, so that the interface is now a member of that group. The Ethernet interface address assigned at the factory is called a unicast address, and any given Ethernet interface can receive unicast frames and multicast frames.
1.4.1 Broadcast and multicast forwarding
- Multicast is more complicated and expensive than broadcast. Stations should tell if they want the multicast frames. And then switches just forward the frames to the indicated ports.
- Broadcast and Multicast usage: 发现新地址,新开机station动态注册地址。
- In large LAN, broadcast and multicast may cause heavy traffic.
Solution:
* Limit the total number of stations linked to a single networks;
* Divide into VLAN
2. Combining Switches
2.1 Forwarding Loops
- 多个交换机组成的大型Ethernet中,可能出现Loops,and then packets will circulate endlessly around the loop, building up to very high levels of traffic and causing an overload && causing the network to be fully occupied with sending broadcast, multicast, and unknown frames, and it becomes very difficult for stations to send actual traffic.
3. Spanning Tree Protocol
3.1. Spanning tree packets
- 生成树协议的操作基于Bridge Protocol Data Units, or BPDUs. Each BPDU packet is sent to a destination multicast address that has been assigned to spanning tree operation.
3.2. Choosing a root bridge
- 每个交换机都有个system MAC. BridgeID = priority + system MAC. BID最小的,选作STP算法的根节点。
3.3. Choosing the least-cost path
- 每个BPDU通过线路时,记录经过的port数量和时间。
3.4. Blocking loop paths
3.5. Spanning tree port states
- States include: disable, blocking, listening, learning, forwarding. 每个状态的作用以及状态之间切换的条件。
- 在快速生成树算法(RSTP)中,增加了新state “edge”,意味着该port直接连接的是终端而非switch,从而允许跳过 listening 和 learning ,直接进入 forwarding 。
3.6. Spanning tree versions
- 802.1D中定义了基本的STP,各厂商都有自己的版本。如 Cisco 的 per-VLAN spanning tree (PVST)
- The 802.1Q standard includes both RSTP and a new version of spanning tree called Multiple Spanning Tree (MST), which is also designed to provide backward compatibility with previous versions. MST is discussed further in Virtual LANs.
4. Switch Performance Issues
- 以太网性能取决于网络的拓扑结构、交换机性能等。
- 当交换机无法及时处理所有port持续接收到的数据时,即性能不足时,会开始丢弃frame,此之谓blocking。
4.1 Packet forwarding performance
- 辅助电路(support circuits) 和 高速缓存都能提高switch的性能,但是贵,所以性能与价格存在 trade-off 。Some less expensive devices may have lower packet forwarding performance, smaller address filtering tables, and smaller buffer memories.
4.2 Switch port memory
- 一般是 store-and-forward 机制。memory越大越好。设计时一般 A common switch design includes a pool of high-speed buffer memory that can be dynamically allocated to individual switch ports as needed.
4.3 Switch CPU & RAM
- 交换机在转发最小以太网帧(64 bytes)时,达到传输速率峰值;And then larger frames will have a lower packet rate per second.
- Latency: is the amount of time it takes to move an Ethernet frame from the receiving port to the transmitting port, assuming that the transmitting port is available and not busy transmitting some other frame.