---
title: "Quiz: Switching and VLANs"
domain: networking
level: beginner
questions: 10
---

# Quiz: Switching and VLANs

## Questions

### 1. A switch's MAC address table for VLAN 10 contains the entries below. A frame arrives on port `p3` in VLAN 10 with source `00:00:5e:00:53:21` and destination `00:00:5e:00:53:44`. What does the switch do?
*Objective: 1 — Explain how a switch learns, forwards and floods frames*

```text
00:00:5e:00:53:11 dev p1 vlan 10
00:00:5e:00:53:12 dev p2 vlan 10
00:00:5e:00:53:13 dev p4 vlan 10
```

- A) It drops the frame, because the destination isn't in the table
- B) It sends the frame to the router port, because unknown destinations must be on another network
- C) It records `00:00:5e:00:53:21` on `p3` and floods the frame out of every other port in VLAN 10
- D) It floods the frame out of every port of the switch, including `p3`, in all VLANs

### 2. A user unplugs a laptop from port 5 of a switch and plugs it into port 9 of the same switch, in the same VLAN. The laptop immediately sends a frame. What happens to the switch's MAC address table?
*Objective: 1 — Explain how a switch learns, forwards and floods frames*

- A) The switch updates the laptop's entry from port 5 to port 9 as soon as it receives that frame
- B) The entry stays on port 5 until it ages out, so frames to the laptop are lost for about 300 seconds
- C) The switch adds a second entry, so frames to the laptop go out of both ports
- D) An administrator must clear the table before the laptop can communicate again

### 3. On a Linux switch, `bridge vlan show` prints the output below. Which statement is correct?
*Objective: 2 — Describe VLANs, 802.1Q tagging, access and trunk ports*

```text
port              vlan-id
eth1              30 PVID Egress Untagged
eth2              30 PVID Egress Untagged
eth5              30
                  40
```

- A) `eth5` is an access port in VLAN 40
- B) All three ports are trunks, because they all carry VLAN 30
- C) `eth5` uses VLAN 30 as its native VLAN, so VLAN 30 crosses it untagged
- D) `eth1` and `eth2` are access ports in VLAN 30, and `eth5` is a trunk that carries VLANs 30 and 40 tagged

### 4. Two switches are joined by a trunk. SW1 uses native VLAN 1 on the trunk; SW2 uses native VLAN 99. A host in VLAN 1 on SW1 sends a broadcast. Where does it end up on SW2?
*Objective: 2 — Describe VLANs, 802.1Q tagging, access and trunk ports*

- A) Nowhere: trunks never accept untagged frames
- B) In VLAN 99, because SW1 sends native-VLAN frames untagged and SW2 puts untagged frames into its own native VLAN
- C) In VLAN 1, because the frame's 802.1Q tag says VLAN 1
- D) In every VLAN on SW2, because broadcasts cross VLAN boundaries

### 5. In a router-on-a-stick design, what does each router subinterface need?
*Objective: 3 — Compare inter-VLAN routing options*

- A) The VLAN ID of its VLAN, so it sends and receives frames with that tag, and an IP address in that VLAN's subnet that hosts use as their gateway
- B) Its own physical cable to an access port in its VLAN
- C) An IP address in the same subnet as all the other subinterfaces, so the router can forward between them
- D) The native VLAN of the trunk, so its frames cross the trunk untagged

### 6. A campus network has 30 VLANs and heavy traffic between the user VLANs and the server VLANs. Inter-VLAN routing must run at close to switching speed and stay available if one link fails. Which design fits best?
*Objective: 3 — Compare inter-VLAN routing options*

- A) Router-on-a-stick with one 1 Gbit/s trunk to a single router
- B) One physical router port connected to an access port in each of the 30 VLANs
- C) A redundant pair of Layer 3 switches, each with a VLAN interface acting as gateway for each VLAN
- D) One large VLAN and subnet for all users and servers, so no routing is needed

### 7. Why can a single extra cable between two switches bring a whole network down when no loop prevention runs?
*Objective: 4 — Explain switching loops, STP and RSTP*

- A) Switches deliberately send frames around loops to find the shortest path, which uses all the bandwidth
- B) Ethernet frames have no Time to Live, and switches flood broadcasts out of every port, so copies circulate and multiply endlessly
- C) The two switches disagree about the native VLAN, which blocks all traffic on the link
- D) The extra cable doubles the MAC table size, and the switches run out of memory

### 8. After a link failure between two switches running classic 802.1D STP, users wait about 50 seconds before traffic flows again. Which change addresses this best?
*Objective: 4 — Explain switching loops, STP and RSTP*

- A) Disable spanning tree, because it causes the delay
- B) Increase the max age timer, so switches wait longer before declaring a link failed
- C) Remove the redundant links, so spanning tree never has to recalculate
- D) Migrate to RSTP and configure host-facing ports as edge ports

### 9. An attacker on a desk port runs a tool that sends thousands of frames per second, each with a random source MAC address. A minute later, the attacker's capture shows traffic between other users in the same VLAN. Which defence most directly prevents this?
*Objective: 5 — Assess Layer 2 attacks and defences*

- A) Port security that limits how many MAC addresses the desk port may learn
- B) BPDU guard on the desk port
- C) Moving the trunks' native VLAN to an unused VLAN
- D) DHCP snooping with the uplink as the only trusted port

### 10. Which configuration makes a double-tagging VLAN hopping attack possible?
*Objective: 5 — Assess Layer 2 attacks and defences*

- A) The trunks use an unused VLAN 999 as native VLAN, and no access port is in VLAN 999
- B) The attacker's access port is in a VLAN that isn't allowed on any trunk
- C) The attacker's access port is in VLAN 1, and VLAN 1 is also the native VLAN of the trunk
- D) The switches run RSTP instead of classic STP

---

## Answer key

<details>
<summary>Show answers</summary>

| # | Answer | Explanation |
|---|---|---|
| 1 | C | The switch always learns the source (`…:21` on `p3`), and an unknown unicast destination is flooded to every other port in the same VLAN, never back out of `p3` and never into other VLANs. Switches don't drop unknown destinations, and they know nothing about routers or networks. |
| 2 | A | The switch learns from every frame's source address, so the first frame from port 9 moves the entry immediately. Aging only removes entries that aren't refreshed; it isn't needed when a device moves and keeps talking. |
| 3 | D | `PVID Egress Untagged` marks an access VLAN: untagged frames in, untagged frames out. `eth5` lists two VLANs with neither flag, so both are carried tagged: it's a trunk with no native VLAN. A native VLAN would show `PVID` and `Egress Untagged` on `eth5`. |
| 4 | B | Native-VLAN frames cross the trunk untagged, so SW2 can't know they came from VLAN 1 and assigns them to its own native VLAN, 99. That's a native VLAN mismatch: traffic leaks between VLANs. There's no tag to say VLAN 1. |
| 5 | A | Each subinterface is bound to one VLAN ID and holds that VLAN's gateway address, so one physical link to a trunk serves every VLAN. Separate cables per VLAN describe the older one-interface-per-VLAN design, and subinterfaces in the same subnet couldn't route between VLANs. |
| 6 | C | Layer 3 switches route between VLAN interfaces at or near switching speed, and a redundant pair removes the single point of failure. Router-on-a-stick sends every routed packet twice over one link, and one router port per VLAN doesn't scale to 30 VLANs. One giant VLAN gives up segmentation and creates a huge broadcast domain. |
| 7 | B | Unlike IP packets, Ethernet frames carry no TTL, so nothing removes a frame from a loop. Every switch floods each broadcast copy again, causing a broadcast storm and MAC flapping. Switches don't use loops on purpose; that's exactly what STP prevents. |
| 8 | D | Classic STP waits for timers (max age plus two forward delays, 30–50 seconds). RSTP negotiates with neighbours and fails over to alternate ports in seconds or less, and edge ports let host ports forward immediately. Disabling STP or removing redundancy trades a delay for an outage or a storm. |
| 9 | A | This is MAC flooding: the fake source addresses fill the MAC table, and the switch floods traffic it can no longer place, so the attacker sees it. Limiting the MACs per port stops the table from filling. BPDU guard, native VLAN hygiene and DHCP snooping address other attacks. |
| 10 | C | Double tagging needs the attacker to be in the trunk's native VLAN: the first switch strips the outer (native) tag and sends the frame across the trunk with only the inner tag, which the next switch obeys. Option A is the recommended defence, and RSTP is unrelated to tagging. |

</details>
