Routing and Switching
Routing and Switching
This domain tests forwarding decisions, VLAN design, Spanning Tree behavior, and routing protocol operation. Questions often ask which path a frame or packet takes and why.
Core rules
- A switch learns source MAC addresses and floods unknown unicast, broadcast, and multicast within a VLAN. Trunks carry multiple VLANs with 802.1Q tags; the native VLAN is untagged.
- Spanning Tree prevents Layer 2 loops. The root bridge is elected by the lowest bridge ID (priority, then MAC). Root ports point toward the root; designated ports forward on each segment; non-designated ports block.
- Routers choose the longest prefix match first. If prefixes tie, they compare administrative distance (AD), then metric. Static routes default to AD 1; eBGP 20; OSPF 110; RIP 120.
- Inter-VLAN routing can use a router-on-a-stick subinterface or a Layer 3 switch SVI. EtherChannel bundles links and must match speed, duplex, VLAN, and trunk configuration.
Worked example A packet destined to 10.1.2.5 sees three routes: 10.1.0.0/16 via A, 10.1.2.0/24 via B, and 0.0.0.0/0 via C. The /24 is the longest match, so the router forwards via B even if the /16 has a lower AD or better metric. Prefix length is compared before AD.
Traps Do not elect the root bridge by highest priority; lower wins. Do not assume a trunk carries a VLAN because it exists in the VLAN database-allowed VLAN lists matter. OSPF cost is reference bandwidth divided by interface bandwidth, so all 1 Gbps and faster links can tie with default reference bandwidth. Finally, an ARP request is broadcast, but an ARP reply is usually unicast.