📝 Link Layer Switches learning and forwarding (26 MCQs)
Layer 2 Switching Through MAC Address Learning
A data-link layer switch connects devices within a LAN and forwards Ethernet frames according to destination MAC addresses. It learns which devices are reachable through each port by recording the source MAC address of incoming frames. The resulting MAC address table allows the switch to send known unicast traffic only toward the required port instead of repeating every frame everywhere.
Building the MAC Address Table from Source Frames
When a frame arrives, the switch reads its source MAC address and associates that address with the receiving port and VLAN. It updates the entry when a device moves. The switch then checks the destination address: a known unicast is forwarded selectively, while an unknown unicast is flooded within the relevant VLAN on the same switch.
Filtering, Forwarding and Flooding Frame Traffic
For a known destination MAC address, the switch sends the frame through the mapped egress port. If the destination is on the same incoming port, it filters the frame rather than forwarding it. Broadcast frames and unknown unicasts are flooded to eligible ports in the same VLAN, excluding the incoming port.
Learning Two Computers on Different Switch Ports
A frame from computer A enters port 3 with source MAC address AA-AA-AA-AA-AA-AA. The switch records that address against port 3. When computer B replies, its source address is learned on port 7. Later frames between the computers can be forwarded directly between those ports without flooding other eligible ports.
Switching and the Separation of Collision Domains
Each full-duplex switch port provides a separate collision domain, allowing connected devices to transmit and receive simultaneously without Ethernet collisions on that link. However, a conventional Layer 2 switch does not automatically separate broadcast domains; ports in the same VLAN share broadcast traffic. VLAN configuration creates separate logical Layer 2 broadcast domains.
Misconceptions About MAC Learning and Flooding
'A switch learns the destination address from an outgoing frame' is incorrect because it learns source addresses on ingress. 'Unknown unicast traffic is always dropped' is incorrect because it is normally flooded within its VLAN. 'A Layer 2 switch separates all broadcasts' is incorrect because VLAN boundaries, not ordinary port switching, separate broadcast domains.
Tracing Switch Tables and Frame Forwarding
For exam problems, update the MAC table from each frame's source address and incoming port before deciding the destination action. Distinguish known unicast forwarding, same-port filtering, and flooding of broadcast or unknown unicast frames. Track VLAN membership as well, since learning and forwarding are scoped to the relevant VLAN on the same switch.
MAC Learning and Frame Forwarding Terms
- MAC table - Maps addresses to ports.
- Learning - Recording source MAC addresses on ingress.
- Forwarding - Sending frames through selected ports.
- Filtering - Suppressing frames on the receiving port.
- Flooding - Sending frames to eligible VLAN ports.
- VLAN - Defines a logical broadcast domain.
📝 All Link Layer Switches learning and forwarding MCQs
Q1. What layer of the OSI model does a link-layer switch operate in?
📖 Explanation: A link‑layer switch functions at the Data Link layer (Layer 2) of the OSI model. It examines MAC addresses, learns source addresses, and forwards frames based on its MAC address table, distinguishing it from devices that operate at the Physical or Network layers.
Q2. Compare a broadcast domain to a collision domain. Which statement is accurate?
📖 Explanation: A broadcast domain defines the set of ports that receive broadcast frames, while a collision domain defines the set of ports where frames can collide. Switches create separate collision domains per port, but a single broadcast domain can span multiple ports unless VLANs partition it.
Q3. If a switch receives a frame with an unknown destination MAC address, what action does it take?
📖 Explanation: When the destination MAC address is not in the switch's forwarding table, the switch treats the frame as unknown and floods it out every other port in the same VLAN. This ensures delivery while the MAC address table learns the source location for future frames.
Q4. When two switches are connected without spanning‑tree, loops cause broadcast storms. What is the immediate effect on MAC address tables?
📖 Explanation: A loop creates continuous broadcast traffic, causing the switches to receive the same frames repeatedly. The rapid influx of frames can overwrite or duplicate entries in the MAC address table, leading to inconsistency and eventual corruption of the forwarding database.
Q5. Suppose a VLAN is configured on a switch but trunking is disabled on the connecting switch. What will happen to traffic between the VLANs?
📖 Explanation: Without an active trunk, the VLAN tag cannot be carried across the link. Consequently, frames from the VLAN cannot be recognized on the opposite side and are discarded, preventing inter‑VLAN communication until trunking is enabled on both ends.
Q6. If a switch implements port security limiting MAC addresses to 2 per port, and three devices connect to the same port, what is the likely result after the third device attempts communication?
📖 Explanation: Port‑security violations trigger the configured security action. When the maximum number of allowed MAC addresses is exceeded, the switch typically places the port into an error‑disable state, effectively shutting it down until an administrator re‑enables it.
Q7. Compare a hub and a switch in terms of collision domains. Which statement is true?
📖 Explanation: A hub repeats incoming signals to all ports, placing every attached device in the same collision domain. A switch, however, provides a dedicated collision domain per port, isolating traffic and preventing collisions between separate ports.
Q8. Which of the following best differentiates a managed switch from an unmanaged switch?
📖 Explanation: Managed switches include a management plane that allows administrators to configure VLANs, set security policies, monitor traffic, and perform diagnostics via CLI, web GUI, or SNMP, whereas unmanaged switches lack any such configurability and operate purely as plug‑and‑play devices.
Q9. When evaluating network performance, which factor is most directly improved by replacing a hub with a switch?
📖 Explanation: A hub shares a single collision domain among all ports, so every transmission risks colliding. Replacing it with a switch isolates each port into its own collision domain, dramatically reducing the chance of collisions and thereby improving effective bandwidth per host.
Q10. A network engineer must decide between using a layer‑2 switch with VLANs versus a layer‑3 switch with routing capabilities for inter‑VLAN traffic. Which consideration is most critical?
📖 Explanation: If inter‑VLAN communication is required, a layer‑3 switch can perform routing internally, eliminating the need for an external router and reducing latency. When routing is essential, the routing capability becomes the primary factor influencing the equipment choice.
Q11. Apply the principle of MAC learning: after a switch receives a frame from MAC X on port 1, what entry is added to its table?
📖 Explanation: The switch records the source MAC address and the inbound port in its MAC address table, mapping MAC X to port 1. This learning enables the switch to forward future frames destined for X directly to port 1 without flooding.
Q12. Explain why a switch can prevent loops using the Spanning Tree Protocol (STP). Which mechanism does STP use?
📖 Explanation: STP elects a root bridge and calculates the shortest path to it for each switch. Ports that would create a loop are placed in a blocking state, ensuring that only a single active path exists between any two switches and eliminating broadcast storms.
Q13. In a VLAN trunk, what tag is added to Ethernet frames to identify VLAN membership?
📖 Explanation: 802.1Q tagging inserts a four‑byte VLAN header between the source MAC and EtherType fields. This header carries the VLAN identifier, allowing switches to keep traffic for different VLANs separate even when it traverses a common trunk link.
Q14. Synthesize a scenario where a switch's MAC address aging timer must be adjusted. What network condition justifies decreasing the timer value?
📖 Explanation: In environments such as wireless networks or roaming laptops, devices frequently change attachment points. Reducing the MAC address aging timer ensures stale entries are removed quickly, allowing the switch to relearn new port locations and maintain accurate forwarding.
Q15. If a switch port is set to “trunk” mode but the connected device is a host, what is the most likely outcome?
📖 Explanation: A host that does not understand VLAN tags will receive tagged frames, which it cannot interpret. Consequently, the host will discard the frames, leading to communication failures unless the port is reconfigured to access mode or the host is VLAN‑aware.
Q16. Which statement correctly contrasts broadcast domains of a switch and a router?
📖 Explanation: Routers operate at Layer 3 and do not forward broadcast frames, effectively dividing the network into separate broadcast domains. Switches, operating at Layer 2, forward broadcasts within the same VLAN, keeping the broadcast domain intact unless VLANs are used.
Q17. Apply the concept of VLAN tagging: when a frame from VLAN 10 traverses a trunk link, what identifier is added?
📖 Explanation: The 802.1Q standard inserts a four‑byte tag containing the VLAN identifier (10 in this case) into the Ethernet frame, allowing the receiving switch to associate the frame with the correct VLAN after it leaves the trunk.
Q18. When a switch receives a broadcast frame on a VLAN, how does it forward the frame?
📖 Explanation: Broadcast frames are replicated and sent out every port that belongs to the same VLAN, except the port on which the frame was received. This ensures all devices in that VLAN receive the broadcast while limiting propagation to other VLANs.
Q19. Evaluate the impact of enabling PortFast on edge ports in a network with STP. Which risk is introduced?
📖 Explanation: PortFast bypasses the listening and learning states, allowing a port to transition to forwarding immediately. If a switch is inadvertently connected to another switch on an edge port, the rapid transition can create a loop before STP has time to block the offending link.
Q20. Synthesize how MAC address table overflow (CAM table overflow) can be used as a security attack. What is the effect on switch behavior?
📖 Explanation: An attacker can flood the switch with forged source MAC addresses, exhausting the CAM table. Once full, the switch can no longer make forwarding decisions and defaults to flooding, effectively turning the switch into a hub and exposing traffic to eavesdropping.
Q21. If a switch implements IEEE 802.1X port‑based authentication and a device fails authentication, what is the state of that port?
📖 Explanation: When 802.1X authentication fails, the port remains in an unauthorized state. In this state, the port does not forward any user traffic, though it may still allow limited EAPOL frames for re‑authentication attempts.
Q22. Compare the effect of enabling VLAN pruning on trunk links versus disabling it. Which statement is true?
📖 Explanation: VLAN pruning removes VLANs that have no active ports on the far side of a trunk, preventing frames for those VLANs from being sent across the link. This conserves bandwidth and reduces processing load on both switches.
Q23. Apply the principle of full‑duplex communication in switches. What is a direct benefit?
📖 Explanation: Full‑duplex allows simultaneous transmission and reception on a link, removing the possibility of collisions and negating the need for collision‑detection mechanisms such as CSMA/CD, thereby improving efficiency and throughput.
Q24. A switch has a MAC address table entry that maps MAC Y to port 3. If the same MAC Y sends a frame out of port 5, what will the switch do with the old entry?
📖 Explanation: When a switch observes a source MAC address on a different port, it refreshes the MAC table entry to reflect the new location. This dynamic update ensures subsequent frames destined for MAC Y are correctly forwarded to port 5.
Q25. When designing a campus network, an engineer must decide between using multiple layer‑2 switches with a single core router versus using a hierarchical layer‑3 switch architecture. Which factor most strongly influences the decision?
📖 Explanation: If high‑performance inter‑VLAN routing is required, a hierarchical layer‑3 switch design provides faster routing within the fabric, reducing latency compared to sending all inter‑VLAN traffic to a single router.
Q26. What acronym does VLAN stand for?
📖 Explanation: VLAN stands for Virtual Local Area Network, a technology that allows a single physical switch to be partitioned into multiple logical broadcast domains, improving traffic segmentation and security.