Switching, VLANs, and Layer 2 Segmentation Questions
Layer 2 switching and segmentation: MAC learning, aging and forwarding (including unknown-unicast flooding and cut-through versus store-and-forward), VLAN design and 802.1Q trunking (tag format, native VLAN, DTP trunk negotiation, VTP, voice VLAN, private VLANs, Q-in-Q), spanning tree (STP, RSTP, MST and edge protection such as PortFast, BPDU guard and root guard), EtherChannel/LACP and MLAG, multicast handling with IGMP snooping, and the hand-off between layer 2 and layer 3 (SVIs, router-on-a-stick, routed ports). Covers access and trunk port configuration and verification, switch-level fault diagnosis (trunk and native VLAN mismatches, MAC flapping, broadcast storms, bundles that will not form), campus, small-office and data-centre VLAN plans, and migrating or renumbering VLANs with minimal downtime. Boundary: attack and defense mechanics (MAC flooding, DHCP snooping, ARP inspection, VLAN hopping), routing protocol configuration, VXLAN/EVPN overlays, fabric and whole-campus topology choice, device automation, and the generic layered troubleshooting method are covered elsewhere.
Your flat, single-VLAN data centre must be split into segmented VLANs with minimal downtime. How would you sequence the migration, handle addressing, ARP and DHCP, validate each wave, and roll back if a wave fails?
Sample Answer
Direct answer
Do it as a series of small, reversible waves, each moving one group of related hosts into a new VLAN, with the router interface for the new VLAN built and tested BEFORE any host moves, and a written, timed back-out for every wave. A VLAN is a separate broadcast domain carved out of the same physical switches; a trunk is a switch-to-switch link that carries several VLANs; an SVI (switch virtual interface) is the switch's layer 3 interface for one VLAN, which is the gateway address the hosts in that VLAN use to reach other subnets. The risks are not the VLAN commands: they are addressing (hosts keep their IPs only if you keep the subnet), ARP caches that can hold old MACs (a Cisco router interface keeps an entry for 4 hours by default), and DHCP scopes that no longer match. Commands below are Cisco IOS XE.
Pick the addressing strategy first
Hosts in a flat VLAN share one subnet, so each new VLAN needs its own subnet and its own gateway address. Recommend re-addressing each tier into a NEW subnet taken from address space that is currently unused, rather than shrinking masks on live hosts and rather than carving the tiers out of the old subnet, because that is what lets the old and new subnets exist side by side through the whole migration.
Why not carve them out of the old subnet: suppose the flat network is VLAN 1 with 10.20.0.0/16. A host there with mask /16 treats every address from 10.20.0.1 to 10.20.255.254 as directly reachable on its own wire. If a web host were moved to 10.20.10.5, an old host would not send to it through the gateway; it would ARP for it locally and fail because the two now sit in different VLANs. Worse, 10.20.10.5 may already belong to an existing flat-network host, so a rolled-back host could collide with it.
Example, with 10.30.0.0/16 as an illustrative free block (confirm in your IP address management records that nothing else uses it): web 10.30.10.0/24 (254 usable hosts), app 10.30.20.0/24 (254), database 10.30.30.0/25 (126) and management 10.30.99.0/26 (62). Computed with Python's ipaddress: none of the four overlaps another or the old 10.20.0.0/16, and each gateway is the first address (.1). Size each subnet from the host count plus growth. If no free block exists, the only options are an in-place renumber, which cannot run side by side and carries more risk, so finding free space is the first task. Hosts that get addresses from DHCP (Dynamic Host Configuration Protocol) only re-address when they next renew or re-request a lease. Changing the port's VLAN does not by itself drop the link, so a client keeps its old, now-wrong address until its next renewal, which can be hours or days away depending on the lease length. Force it in every wave by bouncing the port or renewing the lease on the host, and consider shortening the lease time ahead of the work (at least one old lease length before the first wave). Hosts with static addresses need a configuration change, so list them first.
Sequence
- Inventory and dependencies (before the window): list every host, its MAC, IP, role, and who talks to whom (flow records or
show mac address-table). Group by tier and by dependency so a wave moves hosts that talk to each other together. - Prepare the network without touching hosts: create the VLANs on every switch (
vlan 20,name APP), allow them on the trunks withswitchport trunk allowed vlan add 20(withoutadd, the command replaces the whole list), create the gateway SVI (interface vlan 20,ip address 10.30.20.1 255.255.255.0) and leave it up. If VTP is in use, checkshow vtp statusfirst. - DHCP: for each new VLAN create the scope and point the SVI at the server with
ip helper-address. DHCP clients find a server by broadcast, and a broadcast does not cross a router, so the SVI relays it: by default it forwards DHCP (UDP ports 67 and 68) among other broadcast services, rewriting the destination to the server address. Exclude static addresses (gateway, printers, servers) from each scope. - ARP and the gateway: the old subnet's gateway stays on the old SVI until the last wave ends. ARP (Address Resolution Protocol) caches map an IP address to a MAC address; on a Cisco router interface the default lifetime is 14400 s (4 hours) per interface, and hosts keep their own caches with timers set by their operating system. Two cases matter. A re-addressed host gets a new IP, so the old SVI's entry for its old IP just goes unused, but if that old IP is later handed to a different device, the old SVI can keep sending that IP's frames to the previous MAC until the entry expires, so keep vacated addresses reserved until the wave closes. A host that keeps its IP while its MAC changes (a replaced server or NIC, a moved gateway address) is where neighbours can hold the wrong MAC for up to 4 hours. Lower
arp timeout(in seconds, interface mode) on the old SVI a day ahead of the work, for examplearp timeout 300, and restore it afterwards. - Wave 0 (canary, one low-risk host moved first so a failure shows up cheaply): move one non-critical host, change its port with
switchport access vlan 20, renew DHCP or set the static address, and run the validation list below. - Waves 1..N: one tier per window, least critical first, database last, each with the same validation and back-out.
- Clean up: remove old SVI addresses, tighten ACLs (access control lists, the permit and deny rules that filter traffic) between the new VLANs, update documentation, restore ARP timeout.
Validate each wave (pass or roll back)
- Port in the right VLAN:
show vlan brieflists VLAN 20 with the host's port in its Ports column. - Trunks carry it:
show interfaces trunklists 20 under allowed VLANs and under VLANs in the forwarding state. - Host: gets address (DHCP lease from the right scope), pings the new gateway, resolves DNS, and reaches the dependency in another tier through routing and the firewall.
- Switch:
show mac address-tableshows the host's MAC on one port in VLAN 20. - Application owners confirm a real transaction. Metric: error rate and latency at the load balancer compared to the previous hour.
Roll back
Because the old subnet and old SVI stay intact until the end, and the new subnets do not overlap them, rollback is: switchport access vlan 1 (the original flat VLAN), renew the old lease or restore the old static address (which is still unused by anyone else, because vacated addresses stay reserved), and flush the ARP entry on the gateway. Set a back-out trigger beforehand, for example "if any validation line fails 15 minutes after the move, roll back that wave", so no one decides under pressure. A wave is only started if the window leaves time for its own rollback.
Pitfalls
- Moving a host before its trunk and SVI exist: no gateway, outage.
- Forgetting static-IP hosts that DHCP never touches.
- Stale ARP: the 4-hour default turns a minute of work into hours of intermittent failure.
- Moving dependent hosts in different waves: both SVIs live on the same router, so the old and new subnets can reach each other by routing, but the ACLs and firewall rules must permit that traffic until the pair is together.
Your campus runs classic spanning tree and a link failure takes 30-50 seconds to recover. What does the newer rapid version change to converge faster, how does it coexist with older switches, and how would you move to it safely?
Sample Answer
Direct answer
Rapid Spanning Tree Protocol (RSTP, IEEE 802.1w) replaces the timer-driven port transitions of classic Spanning Tree Protocol (STP, IEEE 802.1D) with a negotiation between neighbouring switches, pre-computes a backup path, and notices a dead neighbour after three missed hellos. It coexists with classic STP because each port falls back to 802.1D behaviour on its own when it hears a classic switch. You move to it by changing the mode switch by switch, with edge ports and root placement fixed first, because the mode change itself restarts spanning tree and can disrupt traffic. (Cisco documents Rapid PVST+, its per-VLAN flavour of 802.1w, as the spanning-tree mode on Catalyst 9300 and the default there.)
Why classic STP takes 30 to 50 seconds
Classic STP only lets a port forward after it has waited out timers, so that old topology information dies before a new path opens. Each port is in one of these states:
- Blocking: receives BPDUs but sends and receives no user data. This is where a port that would create a loop sits.
- Listening: processes BPDUs to learn whether it should still forward, but does not learn MAC addresses and does not forward.
- Learning: still does not forward, but learns source MAC addresses from the frames it hears so the MAC table is already filled when forwarding starts.
- Forwarding: carries user data normally.
Blocking moves to listening, listening to learning and learning to forwarding, and each of the last two waits one forward delay. At the defaults (hello 2 s, forward delay 15 s, max age 20 s):
| Failure type | What happens | Time |
|---|---|---|
| Direct link failure on the forwarding path | A blocked port moves through listening then learning, each lasting one forward delay | 15 + 15 = 30 s |
| Indirect failure (a failure further away, the blocked port just stops hearing superior BPDUs) | The port waits for max age to expire, then listening, then learning | 20 + 15 + 15 = 50 s |
A BPDU (bridge protocol data unit) is the small frame switches exchange to elect a root and keep the tree current. The root bridge is the one switch with the lowest bridge ID (priority, then MAC address) that every other switch builds its shortest path toward. The 30 to 50 second range in the question is exactly these two rows.
What RSTP changes
- Fewer states and more roles. RSTP merges disabled, blocking and listening into one discarding state, leaving discarding, learning and forwarding. It splits the old blocking role into alternate (a backup path to the root through another switch) and backup (a redundant path to the same segment), next to the usual root and designated roles. An alternate port is already a computed spare, so when the root port fails the alternate can take over immediately instead of re-running the election.
- Proposal and agreement handshake instead of timers. A designated port that is discarding or learning sets the proposal bit in its BPDUs. The neighbour makes sure its other non-edge ports are in sync (blocked, or edge ports), then replies with a copy of the BPDU carrying the agreement bit, and the designated port goes to forwarding at once. Trace on two switches (illustrative names): D1 is the root and a new link comes up to access switch A. (a) D1's port on the link is designated but starts out discarding, so it sends a BPDU with the proposal bit set. (b) A must now be "in sync", meaning none of its other ports could form a loop with the new path: every non-edge port of A that is designated and forwarding is briefly set to discarding, while ports that are already blocked or are edge ports are left alone. (c) A makes the port facing D1 its root port and replies with a copy of the BPDU carrying the agreement bit. (d) D1 receives the agreement and moves its port straight to forwarding, with no timer involved. A then repeats the same proposal toward the switches below it, so the handshake ripples outward. This only gives rapid transition on point-to-point links (links between exactly two switches), which Cisco's implementation infers from full duplex (half duplex is treated as shared and falls back to the slow path).
- Edge ports. A port to an end station cannot create a loop, so a port configured as edge goes straight to forwarding, skipping listening and learning. Only non-edge ports reaching forwarding count as a topology change.
- Every switch originates BPDUs. BPDUs are sent every hello time (2 s by default) rather than relayed from the root, and a switch treats its direct root or designated neighbour as lost after three consecutive missed BPDUs, which is 3 x 2 s = 6 s at default hello for the slow case where nothing signals the failure. Set that against the classic table: the 6 s replaces the 20 s max age wait of the indirect case, and the handshake and alternate port replace the 15 + 15 s of listening and learning, so the 30 to 50 s range shrinks to a few seconds in the common cases and to about 6 s plus the handshake in the worst one.
- Faster topology change handling. The switch that detects a change propagates it to its non-edge designated ports and its root port, excluding the port that received the notification, and flushes the MAC addresses learned on those ports, so the table relearns quickly instead of waiting for the aging timer.
Coexistence with older switches
RSTP is backward compatible. When an RSTP port receives a classic (802.1D) BPDU it changes to 802.1D mode on that port only, and a three-second migration delay timer holds the port's current mode before it may adapt to the type of the next BPDU it hears. The consequence is local: the link to the old switch behaves like classic STP (timer-based, slow, and able to handle the older topology change notification, TCN, BPDUs), while ports between RSTP switches stay fast. So a single legacy switch in the middle of a ring (switches cabled in a loop, with spanning tree blocking one link) caps convergence for the segments that depend on it. On Cisco switches the modes also interoperate: PVST+ (Cisco's classic mode, which runs a separate spanning tree per VLAN) works with Rapid PVST+.
Moving to it safely
- Baseline. Record the current root bridge and port roles per VLAN (
show spanning-tree vlan <id>), the mode of each switch (show running-config, look for thespanning-tree modeline), andshow spanning-tree summary. - Fix the foundations first. Set the root and secondary root deliberately on the distribution switches. Mark every end-station port as an edge port with PortFast (Cisco's name for an edge port, which skips the waiting states) and protect it (see the BPDU guard commands below). Without edge ports, a host port cannot complete the handshake (an end station does not answer a proposal), so it falls back to the timer-based path, and a flapping user port generates topology changes.
- Understand the cost of the change. Changing the spanning-tree mode stops all spanning-tree instances for the old mode and restarts them in the new one, which can disrupt traffic. Do it in a maintenance window, one switch at a time.
- Order. My choice (an operational judgement, not a vendor requirement) is to start at an access switch, because a failure there hurts only its own users, and finish at the root, because the changed switches already interoperate with the unchanged ones.
! on each switch, in the window
configure terminal
spanning-tree mode rapid-pvst
spanning-tree portfast default
spanning-tree portfast bpduguard default
end
spanning-tree portfast default turns PortFast on for access ports, and spanning-tree portfast bpduguard default err-disables (shuts down into the error-disabled state) any PortFast port that receives a BPDU. These come from Cisco's Catalyst 9300 Layer 2 configuration guide (IOS XE 17.13), and the platform default is already Rapid PVST+ there, so on a 9300 the first line may already be present; older platforms still default to classic PVST+.
- Verify and roll back. After each switch:
show spanning-tree summaryandshow spanning-tree vlan <id>to confirm roles, then pull the uplink in the change window and time the outage. The rollback is the mode line set back tospanning-tree mode pvst, which restarts spanning tree again, so decide the abort point beforehand.
Trade-offs and pitfalls
- A half-duplex or hub-connected segment is treated as shared and does not get the handshake, so convergence there stays timer-based.
- A misconfigured edge port (PortFast on a link to another switch) forwards immediately and can loop before spanning tree reacts. Protect edge ports with BPDU guard.
- Mixed estates converge as slowly as their slowest legacy segment, so measure after migration rather than assuming a 30 to 50 s improvement everywhere.
Tell me about a time you diagnosed and resolved a network outage caused by a VLAN or switching misconfiguration. Using the STAR method, describe the Situation, the Task you were responsible for, the Actions you took (tools/commands used), the Result, and the preventive measures you implemented after the incident.
Sample Answer
Direct answer
A strong STAR (Situation, Task, Action, Result) answer is one specific incident told in order, with the commands you ran and what each told you, then what you changed so it cannot repeat. Below is a complete worked example built on a classic switching mistake; replace the details with your own incident and quote your own measured figures from the ticket (duration, users affected), not estimates.
Situation
During a planned change window I was adding a new VLAN (a virtual LAN, a separate broadcast domain) for a finance team to an existing trunk between an access switch and the distribution switch. A trunk is one link that carries many VLANs at once, and its allowed VLAN list is the set of VLANs it is permitted to carry. Minutes after the change, users on several other VLANs on that floor lost connectivity, and monitoring showed the access switch's management address no longer answering from the network side, so I worked from the console.
Task
I was the engineer who made the change, so I owned the restoration and the root cause. The aim was to go straight to the change I had just made, restore service, check for collateral damage, and then stop it recurring.
Actions
- Went to the change I had just made. The change record said the only item touched was the trunk, so I looked at it before anything else:
show interfaces trunkon the access switch. The allowed VLAN list contained only the new VLAN, VLAN 30: the output has a section per trunk port listing the VLANs allowed, and where the design called for the finance VLAN plus every existing user and management VLAN, it showed just 30. That also explains the symptoms: the management VLAN was no longer carried, so the switch could not be reached over the trunk, and every other user VLAN had no path out of the floor. I had typedswitchport trunk allowed vlan 30with a bare VLAN list, which sets the list to exactly what is typed, instead ofswitchport trunk allowed vlan add 30, which appends. Every existing VLAN had been removed from the trunk. - Restored service. I ran
switchport trunk allowed vlan addwith the missing VLANs, taking the list from the VLAN design record and the last saved configuration, because I had not captured the trunk's list myself before the change, then verified withshow interfaces trunkthat every VLAN in the design was in the allowed list and in the forwarding state (forwarding means spanning tree lets the port pass traffic, as opposed to blocking, where it only listens). - Checked for collateral damage. Spanning tree is the protocol that blocks redundant links so Layer 2 frames cannot circle forever.
show spanning-tree detailshowed a burst of topology changes at the time of the change (a topology change is spanning tree reconverging after a port changed state; it makes switches age out or delete learned MAC entries so stale ones are dropped and relearned), andshow mac address-tableconfirmed that hosts were relearned on the right ports. I also confirmed the native VLAN (the one VLAN whose frames cross a trunk untagged) matched on both ends, because Cisco warns that a mismatch can cause spanning-tree loops: the two ends disagree about which VLAN the untagged frames, including spanning tree's own messages, belong to. - Told people. I updated the incident channel as soon as I knew the cause and the fix, instead of waiting for the post-mortem.
Result
Connectivity came back as soon as the trunk list was restored, and every VLAN was verified end to end. State the real duration and affected user count from your incident record. The honest summary is that the outage came from my command, and I owned that in the post-incident review.
Preventive measures
- Changes to trunk allowed lists now use the
addandremoveforms by policy, and the change template includes a pre-changeshow interfaces trunkcapture and a post-change diff. - Pre-change configuration backups are automatic, so the restore is a copy, not a recollection.
- A post-change checklist verifies at least one host per VLAN (ping the gateway) before the window is closed.
- Changes of this type are peer reviewed and, where the tooling allows, pushed from a template that renders the full intended list.
What I would do differently
I would have captured the allowed list before the change, tested the command on a lab switch, and kept a rollback timer ready (a safety net that reverts the change automatically, for example a scheduled reload to the saved configuration that you cancel once the change is proven), so that restoration would have been a single step rather than a diagnosis.
Spanning tree edge and core ports need different protections. For a campus, which protective features would you apply where, how does the switch react when each one triggers, and what mistakes make them cause outages instead of preventing them?
Sample Answer
Direct answer
Put PortFast with BPDU guard on edge (end-station) ports, root guard on the distribution ports that face access switches, and loop guard on the root and alternate ports of the uplinks that point toward the root. Treat BPDU filter as the one to avoid on interfaces. A BPDU (bridge protocol data unit) is the frame switches exchange to elect the root bridge and keep spanning tree loop-free; each feature below reacts to the presence or absence of BPDUs in a different place. Three terms recur. A root port is a switch's best path toward the root; an alternate port is a blocked backup path toward the root; err-disabled is a port the switch has shut down itself after detecting a fault. A superior BPDU is one that advertises a better root than the receiver currently knows, meaning a lower root bridge ID (priority first, then MAC address) or, for the same root, a lower path cost.
Placement for a campus
| Port type | Feature | Why there |
|---|---|---|
| Access port to a PC, phone, printer | PortFast plus BPDU guard | An end station should never send BPDUs. PortFast sends the port straight to forwarding, BPDU guard shuts it if a switch appears. |
| Distribution port facing an access switch (downlink) | Root guard | The distribution layer should stay root. If a superior BPDU arrives that would make a downstream switch the root, the port is blocked. |
| Access or distribution uplink port that is root or alternate | Loop guard | Protects against a link that stops delivering BPDUs in one direction only (a unidirectional link), which would otherwise let a blocked port start forwarding and create a loop. |
| Core or distribution links between switches | Neither BPDU guard nor root guard | These links must carry BPDUs and may legitimately change roles. |
Root guard and loop guard cannot be enabled on the same port at the same time (Cisco documents this restriction). The restriction fits the roles: root guard is meant for designated ports that face switches which must never become root, while loop guard protects root and alternate ports that should keep receiving BPDUs, so a given port never needs both.
What each one does when it triggers
- BPDU guard. When enabled globally it applies to PortFast ports; the switch puts the port in the error-disabled state if any BPDU arrives. The port stays down until someone intervenes. The log looks like
%PM-SP-4-ERR_DISABLE: bpduguard error detected on Gi4/1, putting Gi4/1 in err-disable state(the prefix varies by platform). Recover by removing the cause and then runningshutdownfollowed byno shutdown, or enable timed recovery witherrdisable recovery cause bpduguard(the interval is set witherrdisable recovery interval <seconds>; the default is 300 seconds on Catalyst switches, andshow errdisable recoverydisplays the value in force). If the cause is still there the port just goes down again. - Root guard. The port is put in the root-inconsistent (blocked, and the name says why: the BPDU claims a root it must not have) state when it receives a superior BPDU, for all VLANs on that interface. It recovers by itself once the superior BPDUs stop. Cisco warns that misuse can cause a loss of connectivity.
- Loop guard. If an alternate or root port stops receiving BPDUs, the port goes to the loop-inconsistent state instead of moving to forwarding, and the log carries
%SPANTREE-2-LOOPGUARD_BLOCK; when BPDUs return it recovers (%SPANTREE-2-LOOPGUARD_UNBLOCK). It applies on point-to-point links (links between exactly two switches). - BPDU filter. Configured globally it stops PortFast ports from sending or receiving BPDUs, but a port that receives a BPDU loses its PortFast status and rejoins normal spanning tree. Configured on an interface it stops that port sending and receiving BPDUs outright, which Cisco describes as the same as disabling spanning tree on the port.
Configuration (Cisco IOS XE, Catalyst 9300 guide)
! global, covers every PortFast port
spanning-tree portfast default
spanning-tree portfast bpduguard default
! distribution downlink to an access switch
interface GigabitEthernet1/0/10
spanning-tree guard root
! access switch uplink
spanning-tree loopguard default
! optional timed recovery for BPDU guard
errdisable recovery cause bpduguard
Mistakes that turn protection into outages
- BPDU filter on an interface facing another switch. Neither side exchanges BPDUs, so each side sees no loop risk, and a physical loop forwards forever. This is the filter pitfall that matters most; prefer the global form, which falls back to normal spanning tree the moment a BPDU appears, or do not use filter at all.
- PortFast on a switch-to-switch port. The port forwards instantly with no loop check. PortFast belongs only on ports to end stations.
- Root guard on the wrong side. On an uplink toward the real root, root guard blocks the legitimate path as soon as the real root's BPDUs arrive. It belongs on ports facing away from the root.
- Automatic recovery without fixing the cause. A looped desktop mini-switch will be err-disabled, recover after the interval, and be err-disabled again, a repeating brownout on that port rather than one clean failure.
- Loop guard and root guard together on one port are not allowed, so plan which one each port gets.
Worked example
A floor switch has 48 access ports and two uplinks to the distribution pair. Access ports: PortFast plus BPDU guard. Uplinks: loop guard (default). The two distribution switches: root guard on each downlink toward floor switches, none on the link between the two distribution switches. A user plugs a small managed switch into a wall port and loops two of its ports together. That switch sends BPDUs the moment it connects. With BPDU guard the access port goes error-disabled on the first BPDU and the floor is unaffected. Without it, the loop floods the VLAN.
Worked example: root guard and loop guard
Root guard (illustrative numbers). Distribution switch D1 is root with priority 4096. Priority is compared first, lowest wins. A user brings in a switch left at the default 32768; its BPDUs advertise 32768 and lose to 4096, so nothing changes. A switch whose priority has been set to 0, whether by mistake or by an attacker, advertises 0, which is lower than 4096, so its BPDU is superior and, without protection, it would win the election and pull the campus traffic through itself. With root guard on D1's downlink, the port goes root-inconsistent the moment that BPDU arrives, and returns to normal once the superior BPDUs stop.
Loop guard. Access switch A has a root port toward D1 and a blocked alternate port toward D2. D2's port on that link is designated and forwarding, and it sends BPDUs that keep A's port blocked. Suppose that cable fails in one direction only: D2 still forwards frames toward A, but its BPDUs no longer reach A. In classic STP, after the max age timer (20 s by default; three missed hellos, about 6 s, under RSTP) A hears nothing, concludes the path is gone and would start moving the blocked port toward forwarding. Now both ends forward on the same link, which is a loop. Loop guard stops this: the port goes loop-inconsistent instead of forwarding, and recovers when BPDUs return.
You inherit a network with mixed-vendor switches and inconsistent STP modes (PVST+, MST, RSTP) causing varying port states and occasional loops. How would you audit STP configuration across vendors, reconcile STP behavior safely, and plan a migration to a consistent STP strategy with minimal impact? Provide concrete checks and a rollout plan.
Sample Answer
Direct answer
I would audit first, stabilize second and migrate third, and I would commit to MST (Multiple Spanning Tree, the IEEE 802.1s standard now part of 802.1Q) as the consistent target for a mixed-vendor network, with RSTP (Rapid Spanning Tree, IEEE 802.1w) behavior inside it. PVST+ (Per-VLAN Spanning Tree Plus) is Cisco's own per-VLAN design, so it is the odd one out when vendors mix. The flip condition: if every switch is Cisco and VLAN count is small, Rapid PVST+ (the default on Catalyst 9000) is simpler and I would keep it. Whatever I choose, the migration is staged one device at a time with a tested rollback, and nothing is converted before the root bridge placement is fixed.
The ideas everything else depends on
Spanning tree. Switches flood broadcasts out every port, so a physical loop makes a frame circulate forever (a broadcast storm). Spanning Tree Protocol (STP) lets you keep redundant cables but blocks just enough ports to leave a loop-free tree. Switches trade BPDUs (bridge protocol data units, the STP messages) to agree on that tree. A blocking port receives BPDUs but discards user frames; if an active link fails, a blocked port is brought into service.
Root bridge. The tree is built outward from one switch, the root bridge: the switch with the lowest bridge ID, which is a priority number followed by the switch's MAC address. Every other switch picks its best path toward the root and blocks the alternatives. With PVST+ there is one tree, so one root, per VLAN. The default priority is 32768, and the priority field carries the VLAN ID as well (the extended system ID), so VLAN 20 on a default switch has priority 32768 + 20 = 32788. If every switch uses the default, the lowest MAC address wins, which is arbitrary: often an old access switch. Priorities are set in steps of 4096: the intended primary core at 4096 has 4096 + 20 = 4116 in VLAN 20, and the secondary at 8192 has 8212. Both beat any default switch.
MST vocabulary. Per-VLAN trees cost CPU and mix badly across vendors, so MST maps many VLANs onto a few instances, each instance being one tree. A region is a group of switches that share the same name, revision number and VLAN-to-instance map. Instance 0 is special, the IST (internal spanning tree): it exists in every region and carries every VLAN not mapped to another instance. The CST (common spanning tree) connects regions and non-MST switches, and the CIST (common and internal spanning tree) is the IST of every region plus the CST joined into one tree for the whole network; its root, the CIST root, is the root bridge of the whole network. To the outside, a region looks like one single virtual switch, and a boundary port is a port that links a region to a different region or to a PVST+, Rapid PVST+ or plain RSTP switch.
Step 1: audit (read-only)
Collect, for every switch, the same facts. On Cisco IOS XE:
show spanning-tree summary
show spanning-tree detail
show spanning-tree vlan 10
show spanning-tree mst
show spanning-tree mst configuration digest
show spanning-tree inconsistentports
show spanning-tree blockedports
Other vendors have equivalent commands: look them up in each vendor's documentation and record the same fields. Treat the Cisco keywords the same way and confirm each against your platform and release before scripting the audit. How to read them: summary tells you which mode the switch runs (compare it across the estate); vlan 10 names the root bridge's priority and MAC for that VLAN and states whether this switch is itself the root; mst and the digest show the region name, revision and a fingerprint of the VLAN-to-instance map that must be identical on every member; inconsistentports lists ports held back by a protection feature (root guard, loop guard, a type mismatch); blockedports shows which links are the unused alternatives.
Build one table per switch with:
- STP mode (PVST+, Rapid PVST+, MST, plain RSTP);
- for each VLAN, bridge priority, the root bridge's ID, and whether this switch is the root (there should be exactly one root per VLAN or per MST instance);
- MST region name, revision and VLAN-to-instance mapping (the digest);
- edge ports (ports facing PCs and servers) with PortFast and BPDU guard, and uplink ports with root guard or loop guard;
- topology change counts and the port that last reported one (each change flushes MAC entries, so frequent changes mean instability).
Findings I would expect: an unintended root (a switch left at default priority 32768 plus the VLAN ID that wins on lowest MAC), regions that do not match because of a typo or a different revision, and ports blocked in one VLAN's tree that carry traffic for another's.
Step 2: reconcile safely before changing modes
- Fix the roots first. Give the core pair deliberate low priorities (for example 4096 and 8192 on the primary and secondary core) in every VLAN or instance, using
spanning-tree vlan N priority 4096, so the root no longer depends on the lowest MAC. - The per-VLAN priorities above only steer per-VLAN trees, so the same deliberate placement is set per MST instance as part of each core conversion, not afterwards:
spanning-tree mst 0-2 priority 4096on the primary core andspanning-tree mst 0-2 priority 8192on the secondary (Cisco's MST guide givesspanning-tree mst instance-id priority priority, with priority in increments of 4096 and an instance-id that can be a range or a comma list). - Put the protection features on, since they stop the most common loop sources. PortFast makes a host port forward immediately and BPDU guard shuts it down if a switch is plugged in:
spanning-tree portfastandspanning-tree bpduguard enableon host ports. Root guard refuses a better root than the one you chose:spanning-tree guard rooton core ports facing access switches. Loop guard protects uplinks from a one-way link failure. Edge protection (PortFast plus BPDU guard) and root guard are the baseline; loop guard is added where the design needs it. - Know what a mixed edge does today. Cisco's spanning-tree guide says that when Rapid PVST+ and PVST+ devices are mixed they should be configured for different spanning-tree instances. In general, a port that hears legacy 802.1D BPDUs can fall back to 802.1D behavior (confirm the exact fallback rules for each platform in your estate). Convergence differs: 802.1D reacts in 30 to 50 seconds, RSTP typically within 3 times the hello time (3 x 2 s by default) or immediately on link failure. That difference explains "varying port states" better than any single bug.
Step 3: the target design
MST with a small number of instances: instance 0 (the IST, carrying everything unmapped), instance 1 for the data VLANs, instance 2 for voice or the second root. Three things must be identical on every switch in the region: name, revision and VLAN-to-instance map (name up to 32 characters, case-sensitive). Mismatches split the network into separate regions at their boundary, which is the typical MST failure. Prepare on each device (the region lines can be entered ahead of time; the final spanning-tree mode mst line is the conversion itself, and on the two cores the priority lines from Step 2 go in the same change):
spanning-tree mst configuration
name CAMPUS
revision 1
instance 1 vlan 10-20
instance 2 vlan 30-40
spanning-tree mode mst
A switch cannot run MST and PVST+ at the same time, so each conversion is all or nothing per device.
Step 4: rollout plan
- Freeze unrelated changes. Back up every configuration. Document the current root per VLAN. Rehearse on a lab with the same vendor mix.
- Convert the core pair first, one at a time, in a maintenance window. The reason: the old and new parts of the network meet at boundary ports, and Cisco's MST guide says load balancing between PVST+ or Rapid PVST+ and an MST cloud works only if every boundary port is forwarding, which happens when the IST root is also the CST root, in other words when the region contains the root bridge of the whole network. The core pair holds the root (Step 2, with the MST priorities set in the same change), so converting it first puts the root inside the region and its boundary ports forward. Converting an access switch first creates a small region whose boundary port faces a root that is outside it, and that port can end up blocked. After each core switch:
show spanning-tree mst, confirm the region name and digest, confirm the neighbors' ports forward, and confirm user traffic with a ping across each VLAN. - Then distribution, then access, in batches by closet. Each batch has a go/no-go check: no inconsistent ports, topology change counter stable for 15 minutes, MAC table sane.
- Rollback per device: keep the previous mode in the saved configuration, so
spanning-tree modeis changed back and the config reloaded from backup; decide beforehand how long to wait before rolling back. - After: remove temporary workarounds, document the region, add the audit commands to a recurring check, and alert on root changes.
Worked example
Audit finds an access switch with default priority 32768 and the lowest MAC in VLAN 20 acting as root for that VLAN (bridge priority 32788), so the traffic of a whole floor hairpins through it. Step 2 sets the cores to 4096 and 8192 (4116 and 8212 in VLAN 20); the next audit shows the core as root in all VLANs and topology changes drop. Step 4 then converts the cores, and show spanning-tree mst configuration digest shows the same digest on every switch.
Pitfalls
Converting access switches first can leave them as boundary regions against a PVST+ root. Changing the VLAN-to-instance map later requires every switch to change at once. Do not enable loop guard and root guard on the same port; they cannot be combined.
Unlock Full Question Bank
Get access to all 41 Switching, VLANs, and Layer 2 Segmentation interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.