具体的工作流程如下:

(1) 当交换机从某个端口收到一个数据包,它先读取包头中的源MAC地址,这样它就知道源MAC地址的机器是连在哪个端口上的;

(2) 再去读取包头中的目的MAC地址,并在地址表中查找相应的端口;

(3) 如表中有与这目的MAC地址对应的端口,把数据包直接复制到这端口上;

(4) 如表中找不到相应的端口则把数据包广播到所有端口上,当目的机器对源机器回应时,交换机又可以学习一目的MAC地址与哪个端口对应,在下次传送数据时就不再需要对所有端口进行广播了。

 

帧转发过程:

When a frame arrives at a switch port, it is placed into one of the port’s ingress queues.
The queues each can contain frames to be forwarded, with each queue having a different
priority or service level. The switch port then can be fine-tuned so that important frames
get processed and forwarded before less-important frames. This can prevent time-critical
data from being “lost in the shuffle” during a flurry of incoming traffic.
As the ingress queues are serviced and a frame is pulled off, the switch must figure out not
only where to forward the frame, but also whether it should be forwarded and how.
Three fundamental decisions must be made: one concerned with finding the egress switch
port, and two concerned with forwarding policies. All these decisions are made
simultaneously by independent portions of switching hardware and can be described as
follows:
■ L2 forwarding table—The frame’s destination MAC address is used as an index, or
key, into the content-addressable memory (CAM), or address, table. If the address is
found, the egress switch port and the appropriate VLAN ID are read from the table.
(If the address is not found, the frame is marked for flooding so that it is forwarded
out every switch port in the VLAN.)
■ Security ACLs—Access control lists (ACL) can be used to identify frames according
to their MAC addresses, protocol types (for non-IP frames), IP addresses, protocols,
and Layer 4 port numbers. The ternary content-addressable memory (TCAM)contains ACLs in a compiled form so that a decision can be made on whether to forward
a frame in a single table lookup.
■ QoS ACLs—Other ACLs can classify incoming frames according to quality of
service (QoS) parameters, to police or control the rate of traffic flows, and to mark
QoS parameters in outbound frames. The TCAM also is used to make these decisions
in a single table lookup.