Skip to content
Tech Interview Prep
Technical interview guide

Routing & Switching Fundamentals

How traffic gets forwarded within a local network (switching) versus across different networks (routing).

Minutes to read
4
Practice MCQs
25
Interview Q&A
25
Edition
v7
Editorial status
Reviewed
Relevant for
Network Engineer

Scope: Current IETF router, CIDR, OSPFv2/v3, BGP, eBGP policy, VRRP, BFD, EVPN, VXLAN, Cisco Layer 2/STP, and Juniper BGP references reviewed 2026-09-04.

Overview

Curated: · Written: · Reviewed:

Routing & Switching Fundamentals

In one line

Switching forwards frames by destination MAC inside one VLAN. Routing forwards packets by longest-prefix match across IP prefixes. Switch when the destination shares the sender's subnet; route when it does not.

Key definitions

  • CAM table: maps a MAC address to a port within a VLAN. A miss floods.
  • FIB: the forwarding table the data plane uses, programmed from the RIB.
  • Administrative distance (AD): ranks route sources for the same prefix; lower wins. Cisco defaults: connected 0, static 1, eBGP 20, OSPF 110, iBGP 200.
  • DR/BDR: the OSPF hub elected on a multi-access segment. Non-DR routers reach Full only with the DR and BDR.
  • AS_PATH: the BGP attribute listing traversed ASes. A router rejects any path that already contains its own AS.
  • Native VLAN: the VLAN sent untagged over an 802.1Q trunk. Both ends must match.

How it works

  • A switch learns the source MAC and ingress VLAN, forwards known unicast to the learned port, and floods unknown unicast and broadcast within the VLAN.
  • For an off-subnet destination, the host ARPs for its gateway and frames carry the gateway's MAC. The router strips the Layer 2 header, runs longest-prefix match in the FIB, decrements TTL, and rewrites the Layer 2 header. IP addresses stay constant.
  • OSPF neighbors progress Down, Init, 2-Way, ExStart, Exchange, Loading, Full. Hello and dead timers must match; the broadcast and point-to-point defaults are 10 s and 40 s. Every non-backbone area attaches to Area 0, and inter-area routes transit it.
  • BGP is a path-vector protocol. Routes learned from eBGP go to iBGP peers, but routes learned from one iBGP peer are not passed to another. A full iBGP mesh, or route reflectors, avoids that gap.
yes no yes Frame arrives in VLAN Dst MAC in CAM for this VLAN? Forward to learned port Flood to VLAN ports except ingress Port is a router interface? Strip L2, LPM in FIB, TTL minus 1, rewrite MAC

When to use and when not to

ChoiceUse whenAvoid when
Switching within one VLANHosts share a subnetThe destination is off-subnet
Router-on-a-stickFew VLANs, light inter-VLAN trafficAll inter-VLAN traffic crosses one bottleneck link
SVI on a Layer 3 switchCampus inter-VLAN routing at line rateThe device lacks Layer 3 hardware forwarding
Routed portPoint-to-point links between Layer 3 devicesYou need many subnets on one interface
Static routeStub networks, or a default with a clear ownerThe next hop may fail, since a static route never withdraws
Summary routeContiguous prefixes behind one ABR or ASBRAddress space is fragmented, or the summary hides a missing specific
OSPFPaths must reconverge within one administrative domainA single exit where the protocol adds state for no benefit
BGPPolicy between autonomous systemsSimple single-homed sites
LAGMore aggregate capacity and member-link redundancyYou need one flow faster than one member link

Traps interviewers probe

  1. Reading a populated MAC table as end-to-end reachability. It proves only local reachability in the VLAN. Fix: check the gateway's ARP entry, the route to the destination, and the return path.
  2. Saying a static route always wins. It wins only when prefix length ties. Fix: a longer prefix from any protocol wins first, because prefix length is compared before AD.
  3. Comparing metrics across protocols. Fix: AD picks the source; metric only ranks routes within one protocol.
  4. Assuming LAG prevents loops, or that a 4 x 10 Gbps LAG gives one flow 40 Gbps. The bundle looks like one link to STP, so STP still runs. Each flow hashes to one member, so a single flow tops out at 10 Gbps. Fix: keep STP on, use BPDU guard on edge ports, and match member speed, VLAN and system ID.
  5. Assuming a native VLAN mismatch is loud. It is silent and can merge VLANs or drop traffic. Fix: match the native VLAN on both ends and move it off VLAN 1 to an unused VLAN.

Interview tips

Opening: Name the plane first, then the table: "I'll walk the packet from the host and check the table that decides each hop."

Likely follow-ups:

  • How does AD differ from metric?
  • Why does a summary route of 10.0.0.0/22 cover 10.0.0.0/24 through 10.0.3.0/24, and what breaks if one /24 is unreachable?
  • Why does an OSPF neighbor stall in ExStart?
  • Why does iBGP need a full mesh?
  • How would you prove the FIB matches the RIB after a change?

30-second outline:

  1. Same subnet means the MAC table decides; different subnet means longest-prefix match decides.
  2. Say what changes per hop: IP addresses stay, MAC addresses are rewritten, TTL drops by one.
  3. Name the three states to compare: the MAC entry or route, the RIB route, and the FIB entry.
  4. Give the likeliest fault for the symptom: a missing gateway ARP entry, a mismatched OSPF timer or MTU, a missing iBGP mesh session, or a native VLAN mismatch.
  5. Say how you would confirm it: the table entry or counter at the failing hop.

Feedback on this overview

Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.