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.

Interview Q&A

Treat each question like a live interview question: answer out loud first (structure, assumptions, tradeoffs), then open the model answer to spot gaps and rehearse a tighter follow-up.

Curated: · Written: · Reviewed:

25 questions

Q&A-3

Troubleshoot a VLAN access-port mismatch.

Answer

What I'd say first. Before touching config, I pin down two things: what the endpoint sends (tagged or untagged) and what the port is supposed to do with it. Almost every "VLAN mismatch" is one of those two being wrong. My assumption set: the endpoint is a normal PC or phone sending untagged frames, the port should be an access port in one VLAN, that VLAN exists and is active, and the uplink trunk carries it. If any of those is false, the diagnosis changes, so I state them out loud and check them in that order.

Mechanism. An access port has a PVID: the access VLAN. Every untagged frame that arrives is classified into that VLAN and forwarded tagged internally. The endpoint never sees a tag. So if the port's access VLAN is 20 but the endpoint's gateway and DHCP scope live in VLAN 30, the endpoint still gets a lease, just from the wrong subnet, and can't reach its gateway. That's the classic symptom: link is up, DHCP works, but the address is wrong or the gateway is unreachable. If the port is actually in trunk mode, untagged frames land in the native VLAN (default 1), which is a third wrong answer.

Worked trace (example figures). PC sends untagged DHCP DISCOVER → switch tags it with the port's access VLAN, say 20 → broadcast floods VLAN 20 → the SVI for VLAN 20 relays to the DHCP server → server offers 10.20.4.0/24. If the port is really in VLAN 30, the same DISCOVER is tagged 30, relayed from the VLAN 30 SVI, and the PC gets 10.30.4.0/24. The lease itself tells you which VLAN the port is actually in: that's the fastest single clue.

Commands, in order.

CheckCommandWhat a mismatch looks like
Port mode + VLANshow interfaces Gi1/0/5 switchportOperational Mode: static access, Access Mode VLAN: 30 when you expect 20
VLAN exists/activeshow vlan briefVLAN 20 missing or act/unsup
Uplink carriageshow interfaces trunkVLAN 20 absent from the allowed/forwarding list
STP stateshow spanning-tree interface Gi1/0/5Blocking/Alternate instead of Forwarding
Dynamic assignmentshow authentication sessions interface Gi1/0/5802.1X pushed a different VLAN than the static config
Port securityshow port-security interface Gi1/0/5Secure-shutdown: err-disabled, link down
MAC learningshow mac address-table interface Gi1/0/5MAC learned in the wrong VLAN, or none

Failure modes and how I detect each. Wrong access VLAN: endpoint gets a lease from the wrong subnet. Read the address, don't guess. Port left in trunk mode: untagged frames hit native VLAN 1, so the endpoint lands in VLAN 1; show interfaces switchport shows Operational Mode: trunk. VLAN not created or shut: show vlan brief shows it missing, and the port shows inactive. Uplink trunk not allowing the VLAN: local port looks perfect, but nothing crosses. show interfaces trunk on both ends. 802.1X dynamic VLAN overriding static config: the port flips VLANs after auth; compare show authentication sessions before and after. Port-security err-disable: link is down, not mis-VLANed. Different symptom, different fix (shutdown/no shutdown after clearing). STP blocking on a redundant path: intermittent, not constant.

Trade-offs. Static access VLAN is predictable and easy to audit; dynamic assignment via 802.1X scales for roaming users but makes "what VLAN is this port in" a runtime question, not a config question. Trunk-to-endpoint (rare, for a VM host) removes the access/native ambiguity but pushes tagging responsibility to the endpoint. I only chase DHCP relay or gateway issues after confirming the port's actual VLAN: otherwise I'm debugging the wrong layer.

Close. Compare against a known-good port on the same switch: same show interfaces switchport output, same VLAN, same trunk carriage. The diff is the answer.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-19

How does Layer 2 Port Security work on switchports, and what are the operational differences between protect, restrict, and shutdown violation modes?

Answer

Port security bounds the set of source MAC addresses a switchport accepts. Enable it on a port that is statically access or trunk, set a maximum, and the switch builds a secure MAC table from static entries, dynamic learning, or sticky learning. Any ingress frame whose source MAC is not in that table (or that pushes the port past maximum, or that is already secured on another port) is a violation.

The three modes differ only in what happens after the switch decides a frame is unauthorized:

  • protect: drop the frame, say nothing: no counter, no syslog, no trap.
  • restrict: drop the frame, increment the violation counter, emit syslog and an SNMP trap.
  • shutdown: err-disable the whole port; all traffic stops, including from already-authorized hosts.

Defaults decide most real deployments: violation mode defaults to shutdown, maximum defaults to 1. A bare switchport port-security on an access port is a one-MAC, fail-closed config.

Config and a worked violation

interface GigabitEthernet1/0/5
 switchport mode access
 switchport access vlan 10
 switchport port-security
 switchport port-security maximum 2
 switchport port-security mac-address sticky
 switchport port-security violation restrict
 switchport port-security aging time 10
 switchport port-security aging type inactivity

switchport port-security must come first; the modifiers are rejected before it. Hosts A (0011.2233.4455) and B (0011.2233.4466) transmit and are learned as sticky entries, so show port-security interface gi1/0/5 reads:

Port Status                : Secure-up
Violation Mode             : Restrict
Aging Time                 : 10 mins
Aging Type                 : Inactivity
Maximum MAC Addresses      : 2
Total MAC Addresses        : 2
Sticky MAC Addresses       : 2
Security Violation Count   : 0

Host C (0011.2233.4477) now sends. Total MAC Addresses is already 2, so the frame is a violation:

  • protect: dropped in hardware, count stays 0, nothing logged.
  • restrict: dropped, count → 1, %PORT_SECURITY-2-PSECURE_VIOLATION logged, trap sent; A and B keep forwarding.
  • shutdown: count → 1, %PM-4-ERR_DISABLE: psecure-violation error detected on Gi1/0/5, putting Gi1/0/5 in err-disable state; A and B lose connectivity too.
ModeUnauthorized frameAuthorized trafficCounterSyslog/trapPort state
protectdroppedforwardsnonoup
restrictdroppedforwardsyesyesup
shutdowndroppedblockedyesyeserr-disabled

What bites in production

  • Protect is undetectable. The counter stays 0 and nothing is logged, so a misconfigured host looks like a dead NIC. Use restrict wherever you need evidence.
  • Shutdown is a DoS primitive. One rogue frame takes down every host on the link. On an uplink or a virtualization host trunk that is an outage, not a security win. Detect via %PORT_SECURITY-2-PSECURE_VIOLATION plus %PM-4-ERR_DISABLE, and show interfaces status err-disabled.
  • Recovery loops. errdisable recovery cause psecure-violation with errdisable recovery interval <sec> (default 300, recovery off by default) brings the port back; if the offending device is still attached it re-violates immediately and the port flaps every interval. Repeated PSECURE_VIOLATION entries spaced by the interval are the tell.
  • MAC moves. A secured MAC appearing on a second secured port is a violation on the port where it appears again: a laptop moved between desks, or a VM MAC after vMotion with a stale entry.
  • Sticky is not persistent by itself. Sticky entries land in running-config; they survive a reload only after copy running-config startup-config. Save them and then swap a NIC, and the stale entry still occupies a slot against maximum, so the new NIC violates. Check show port-security address.
  • Trunks count per VLAN. switchport port-security maximum 5 vlan 10,20 sets per-VLAN limits, default 1 per VLAN. A trunk toward another switch blows past that and err-disables the uplink.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-4

Diagnose a VLAN that fails across an otherwise healthy trunk.

Answer

Assumptions: the trunk is up, every LAG member is up, other VLANs pass, and only one VLAN fails. That rules out link state and points at per-VLAN state.

First 60 seconds: compare the trunk's allowed VLAN list on both ends. A trunk can be up and carry twenty VLANs while omitting one, because the allowed list is per-interface configuration, not link state. On IOS/IOS-XE:

SW1# show interfaces GigabitEthernet0/1 trunk
Port    Mode  Encapsulation  Status    Native vlan
Gi0/1   on    802.1q         trunking  1

Port    Vlans allowed on trunk
Gi0/1   10,20,42

Port    Vlans allowed and active in management domain
Gi0/1   10,20,42

Port    Vlans in spanning tree forwarding state and not pruned
Gi0/1   10,20,42

Three lists, three different failure domains:

  • Missing from allowed on trunk → switchport trunk allowed vlan on that side.
  • Present in allowed but missing from allowed and active in management domain → the VLAN does not exist or is not active in that switch's VLAN database. show vlan id 42 confirms. A common cause is VTP overwriting the database.
  • Present in both but missing from forwarding state and not pruned → STP blocking or VTP pruning.

Native VLAN mismatch. show interfaces GigabitEthernet0/1 switchport prints Native VLAN: 1 (the default). If the two ends disagree, untagged frames cross into the wrong VLAN. PVST+ sends a BPDU for every VLAN untagged on the native VLAN, so a mismatch puts VLAN 42's BPDUs into VLAN 1 on the far side: STP sees two topologies and can block the VLAN or loop it. CDP reports it: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on GigabitEthernet0/1 (1), with SW2 GigabitEthernet0/1 (42). LLDP has no equivalent TLV, so do not wait for an LLDP alarm.

STP. show spanning-tree vlan 42 on both ends. If the trunk port shows role Altn and state BLK, VLAN 42 has no forwarding path even though the link is up. Check the root bridge (show spanning-tree vlan 42 root) and port cost. Default bridge priority is 32768; with extended system ID the effective value is 32768 + VLAN ID.

Data plane. show mac address-table vlan 42 on both switches. Empty on one side means frames are not arriving. Then show interfaces GigabitEthernet0/1 counters errors for input errors, CRC and drops, and show port-security interface GigabitEthernet0/1: a port-security violation or storm control can drop one VLAN's frames while others pass.

Worked example. SW1 and SW2, Gi0/1 trunk. VLANs 10 and 20 pass; VLAN 42 fails. On SW1, show interfaces Gi0/1 trunk lists 42 in all three lists. On SW2, Vlans allowed on trunk reads 10,20: 42 is absent, so frames tagged 42 arriving at SW2 are dropped on ingress. Fix on SW2:

SW2# configure terminal
SW2(config)# interface GigabitEthernet0/1
SW2(config-if)# switchport trunk allowed vlan add 42
SW2(config-if)# end

add appends; switchport trunk allowed vlan 42 would replace the list and drop 10 and 20. Verify with show interfaces Gi0/1 trunk (42 in all three lists) and show mac address-table vlan 42 (MACs appear).

FailureWhat you seeDetectionCost/risk
Allowed listVLAN absent from "Vlans allowed on trunk" on one sideCompare show interfaces trunk on both endsOne command to fix; adding a VLAN whose STP has not converged can loop
VLAN not in databaseIn allowed list, absent from "allowed and active in management domain"show vlan id 42 on that switchVTP revision overwrote it; re-add the VLAN, then check VTP domain and revision
Native VLAN mismatchDifferent Native VLAN in show interfaces switchport; %CDP-4-NATIVE_VLAN_MISMATCHCDP syslog, show cdp neighbors detailUntagged PVST+ BPDUs land in the wrong VLAN → STP loop or blocked VLAN
VTP pruningIn allowed list, absent from "forwarding state and not pruned"show vtp status (VTP Pruning Mode)Pruning saves bandwidth but blackholes a VLAN with no active access port on the server
STP blockingshow spanning-tree vlan 42 shows Altn/BLK on the trunkRoot bridge and port cost on both endsIf it is the only path, the VLAN is down; fix priority or cost
MAC learning / dropsshow mac address-table vlan 42 empty on one sideshow interfaces counters errors, show port-securityPort-security violation or storm control drops that VLAN's frames

Fix risk. Adding a VLAN to the allowed list is one command, but if STP has not converged on that VLAN you can create a transient loop; check show spanning-tree vlan 42 before and after. For a native VLAN mismatch, change one side to match the other, but confirm nothing untagged depends on the old native VLAN (management IPs, untagged hosts). Stage it: change one side, verify, then the other. On IOS, reload in 5 before the change and reload cancel after gives a rollback window.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-1

Diagnose MAC flapping between switch ports.

Answer

Start by pinning down what "flapping" actually means here: the same MAC and VLAN pair is being learned on two different ports inside a short window. Get the exact MAC, VLAN and the two ports from the trigger. On Cisco IOS the log line is %SW_MATM-4-MACFLAP_NOTIF: Host 0011.2233.4455 in vlan 10 is flapping between port Gi1/0/1 and port Gi1/0/2. NX-OS emits a similar MAC move notification. Then ask the one question that decides everything: is this endpoint supposed to move?

The mechanism is simple and worth saying out loud. A switch learns the source MAC of every frame on the ingress port. The entry is keyed on (MAC, VLAN) and points at one port, with an age timer: default 300 seconds on IOS and NX-OS. When a frame with the same MAC and VLAN arrives on a different port, the switch rewrites the entry to the new port and resets the timer. Flapping is just that rewrite happening repeatedly. So the diagnosis is always: why is the same MAC being sourced from two ports?

Worked trace. t=0: entry 0011.2233.4455 vlan 10 -> Gi1/0/1, age 0. t=2s: a frame from that MAC arrives on Gi1/0/2; the entry is rewritten to Gi1/0/2 and the age resets. t=4s: a frame arrives on Gi1/0/1; rewritten back. The log fires. That is the whole event.

CauseSignatureCheckFix
L2 loop / STP failureBroadcast rate climbs, topology changes, MAC seen on both sides of a blocked linkshow spanning-tree vlan 10 detail | include changes, show interface | include broadcastFind and break the loop
Duplicate MACTwo hosts, same MAC, different ports, both transmittingshow mac address-table address 0011.2233.4455 alternates portsFind the second host, change its MAC
LAG mis-bundleMember links not in one bundle, or LACP mismatchshow etherchannel summary shows (I) or (D) flagsCorrect the channel-group
vPC / MLAG active-activePeer-link down or orphan portshow vpc on NX-OS shows peer-link stateRestore the peer-link
Wireless roamingClient roams AP to AP in the same VLANWLC show client summaryExpected: no fix
Hypervisor bridge loopTwo vNICs on one bridge, or VM MAC spoofToR show mac address-table shows the VM MAC on two uplinksFix the host bridge

The real trade-off is containment versus evidence. Storm-control or err-disable stops the blast radius but destroys the capture you need. I would mirror both ports to a SPAN session and capture first, then contain. If the storm is already taking down the access layer, contain first, shut the second port or apply storm-control, and accept that you will diagnose from counters and logs instead of packets.

Two failure modes to watch. Absence of the log does not mean no flapping: mac-move notification is rate-limited and can be disabled, so check whether it is on (mac address-table notification mac-move in config). And a MAC that flaps faster than the aging timer never ages out, so show mac address-table always shows one port: you need the log or a packet capture to see the other. Finally, a unidirectional link can leave STP forwarding while BPDUs are lost; detection is show interface input errors plus show spanning-tree interface showing no BPDUs received.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-2

Control excessive unknown-unicast and broadcast traffic.

Answer

Core answer

Before I touch a knob, I want to know which of the two problems I have, because unknown-unicast and broadcast have different causes. Unknown unicast floods for exactly one reason: the switch has no MAC table entry for the destination, so a Layer 2 frame is flooded to every port in the VLAN. Broadcast (ARP requests, DHCP discovers, NDP neighbor solicitations) floods by definition; only the volume is in question.

Assumptions: a standard Layer 2 access/leaf topology, hosts in the same VLAN, and I can see per-port counters and the MAC table.

My first move is measurement. Per-VLAN flooding counters, the MAC table count against the platform limit, and the ARP/NDP rate at the gateway. If the MAC table is near its ceiling (a few thousand entries on a small access switch, up to 32K on a Catalyst 9300) the switch floods everything, and no storm-control setting fixes that. I'd also check whether entries are aging out: Cisco's default MAC aging time is 300 seconds, and if a silent host never refreshes its entry, its traffic floods after five minutes.

Why it floods

Three causes cover most of it. A silent receiver that only receives never sources a frame, so its entry ages out. Asymmetric routing means the return-path switch never sees the source MAC, so it floods the return traffic. And a MAC move or churn (a VM migrating, or a loop) keeps the table unstable.

Controls and when each is wrong

controlwhat it doeswhen it's the wrong tool
storm controlper-port rate limit on broadcast, multicast, or unknown-unicastboot storms and silent hosts: it drops legitimate traffic
EVPN MAC learningcontrol-plane learning, so a leaf knows the MAC without floodingmixed VTEP configs: one leaf without it and you get asymmetric flooding
ARP/NDP suppression (RFC 9161)leaf answers ARP locallyrequires every VTEP to support it
segmentationsmaller broadcast domaindoesn't fix flooding inside one large VLAN
MAC aging tuningalign timers across the topologymasks the cause if a host is genuinely silent

Storm control is a backstop, not a fix: it can't tell a legitimate boot storm from an attack, and it drops at the port, blackholing a real host. storm-control action shutdown err-disables the port, which is the last thing you want during a boot storm.

Failure modes and detection

  • Silent receiver: MAC entry missing for a host that's clearly up. Detect by comparing the MAC table to the ARP table.
  • Asymmetric path: compare MAC tables on both sides of the pair; one side won't have the entry.
  • Boot storm: ARP rate spike at the gateway after power restore.
  • Table overflow: show mac address-table count near the limit.

Arithmetic

A 1 Gbps access port with storm control at 5% allows 50 Mbps of broadcast. An ARP request is a 64-byte frame on the wire excluding preamble and inter-frame gap, 84 bytes including them. 50 Mbps ÷ (84 × 8 bits) ≈ 74,000 pps. If your legitimate boot storm is 200 hosts ARPing once, that's 200 frames: nowhere near the limit, which tells you the 5% threshold is protecting against something else.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-5

Design and validate a spanning-tree topology.

Answer

First I'd pin down three things: how many VLANs, whether the topology is single-vendor, and where the L3 boundary sits. Those decide the STP variant, and the variant decides everything else.

If it's a Cisco-only campus with a handful of VLANs, Rapid PVST+ is fine: one instance per VLAN, RSTP state machine, sub-second convergence on point-to-point links. If there are hundreds of VLANs, I'd use MSTP (802.1Q, formerly 802.1s) and map VLANs into a few instances, because Rapid PVST+ runs a full state machine per VLAN: 500 VLANs is 500 instances of BPDU processing and MAC flushing on every topology change. MSTP collapses that, at the cost of a region config: name, revision, and VLAN-to-instance map must match on every switch, or the region splits and you get two roots.

Root placement is the design decision. Every bridge picks the lowest-cost path to the root, so the root is the traffic sink for the whole L2 domain. Put it at the distribution layer next to the L3 gateway, not in the access layer, or inter-VLAN traffic hairpins up to an access switch and back. Primary root priority 4096, secondary 8192: both below the 32768 default, in 4096 steps. Then let cost pick the path: with the long method (802.1t), 1 Gbps is 20,000 and 10 Gbps is 2,000, so a 10G uplink wins by default; with the short method (802.1D-1998) 1 Gbps is 4 and 10 Gbps is 2. Port priority defaults to 128 in steps of 16, and only matters when two links to the same neighbor tie on cost.

Convergence: RSTP on a point-to-point link uses proposal/agreement. The downstream bridge proposes, the upstream agrees, and the port goes to forwarding without waiting on timers, typically well under a second. Legacy 802.1D is the slow one: max age 20s, forward delay 15s, so an indirect failure is 20 + 15 + 15 = 50s. RSTP ages neighbor info after three missed hellos, 6s at the 2s default hello, which is why hello is a liveness timer, not just a keepalive. On a topology change, RSTP floods the TC to all bridges and each flushes MAC entries on every port except the one it arrived on and edge ports; legacy STP sends the TCN to the root, which sets the TC flag and everyone shortens MAC aging to forward delay (15s).

Guards, and when not to use them: BPDU guard only on true edge ports (PortFast), where it err-disables on any BPDU. Never on an uplink. Root guard on ports toward switches that must not become root; it puts the port in root-inconsistent state on a superior BPDU. Don't put root guard on the port toward your own secondary root: you'd block it. Loop guard on root and alternate ports where unidirectional loss is possible; it moves the port to loop-inconsistent instead of letting it become designated. Don't use loop guard where you want the port to take over.

Validation matrix: each row has a detection signal:

testexpecteddetect
link loss on the active uplinkalternate goes forwarding, sub-second under RSTPshow spanning-tree detail role change, TC count
root losssecondary root takes overshow spanning-tree root bridge ID changes
unidirectional linkloop guard blocks the portshow spanning-tree inconsistentports
accidental bridge on edge portBPDU guard err-disablessyslog + show errdisable recovery
root hijack attemptroot guard root-inconsistentshow spanning-tree inconsistentports
TCN stormMAC table churn, brief floodingshow spanning-tree detail TC count climbing

Storm control as a backstop: storm-control broadcast level 1 is 1% of link bandwidth, 10 Mbps on a 1G port, and it's a mitigation, not a substitute for a correct topology.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-6

Troubleshoot an aggregate with one suspended member.

Answer

Core answer (first 90 seconds)

"Suspended" is not "down." The link is up and passing light, but LACP refused to put the member in the bundle: port up, port-channel up, this member outside it. So I read LACP state on both ends before physical counters.

On Cisco, show etherchannel summary flags it s: 1 Po1(SU) LACP Gi1/0/1(P) Gi1/0/2(s). On Linux, /proc/net/bonding/bond0 shows the member with MII Status: up but an Aggregator ID different from its peers. Then show lacp neighbor on both ends. The usual cause is a mismatch that changes the port's operational key, so the two sides compute different keys and LACP will not aggregate.

Worked trace (representative values)

Po1 between SW1 and SW2, members Gi1/0/1 and Gi1/0/2. Gi1/0/2 was re-patched overnight.

MemberNegotiated speedOper keyState byte
Gi1/0/110 Gbps0x00010x3D
Gi1/0/21 Gbps0x00020x05

The state byte is a bitmap; bit 3 is synchronization:

BitName1 means
0Activityactive
1Timeoutshort (1s)
2Aggregationcan aggregate
3Synchronizationin sync: gates bundling
4Collectingreceiving
5Distributingsending
6Defaultedusing default partner info
7Expiredpartner timed out

0x3D = bits 0,2,3,4,5 → active, aggregation, sync, collecting, distributing. 0x05 = bits 0,2 → active, aggregation, no sync. The bad cable dropped Gi1/0/2 to 1 Gbps, so SW2 derived a different operational key (0x0002); SW1's state machine never sets synchronization and the port stays suspended. Replacing the cable restores 10 Gbps, the key returns to 0x0001, bit 3 sets, and the summary flips to P.

Why it happens

LACP runs a per-port state machine. Each side advertises an actor (itself) and reports a partner: system ID, system priority, port ID, port priority, operational key, state bitmap. A port joins the aggregator only when both sides agree on operational key and system ID and the port reaches in-sync.

The operational key is derived from the port's operational attributes: speed, duplex, and on many platforms MTU and VLAN/trunk config. Change any on one member and its key diverges.

Triggers, in the order I check them:

  • Mode mismatch: one side active/passive, the other on (static). Static plus LACP never negotiates.
  • Operational key mismatch: different speed/duplex/MTU, or the member in a different VLAN/trunk.
  • System ID/priority mismatch: cabling to a different switch than the rest of the bundle.
  • Timeout mismatch: one side short (1s), the other long (30s). Cisco defaults long; Linux lacp_rate defaults slow.
  • min-links not met: fewer active members than port-channel min-links.

Trade-offs

If the member is genuinely incompatible and I need capacity now, I can force it up: static mode on on both ends, or LACP fallback/individual mode so the port forwards alone when negotiation fails. Both trade safety for bandwidth: static mode cannot detect a one-way failure or a mis-cabled peer, and individual mode can create a loop if the peer is actually a different switch. Fix the mismatch instead.

Failure modes and detection

  • One-way LACPDU loss: link up, show lacp counters shows LACPDUs sent but not received; the member suspends after the timeout (30s long, 1s short).
  • Wrong peer: show lacp neighbor shows a system ID that does not match the other members.
  • min-links: show etherchannel summary shows M, not s.

Verification

Fix the mismatch, confirm the member shows P and show lacp neighbor matches on both ends, then test hash-diverse flows and remove one member to confirm the bundle survives within remaining capacity.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-18

How do default gateways, static routes, and dynamic routing protocols differ in operation, and when should each be used?

Answer

All three primitives answer the same question, which next hop for a given destination, and differ in who computes the answer and how fast it reacts when the topology changes. A default gateway is a static default route installed on a host, normally handed out by DHCP option 3. A static route is an operator-installed prefix binding in the RIB. A dynamic protocol is a distributed process that derives prefixes from neighbour state and withdraws them when neighbours die.

Assumptions: IPv4, single VRF, Cisco IOS-style administrative distance (AD) unless noted. Junos uses preference instead: static 5, OSPF internal 10, BGP 170.

Comparison

AttributeDefault gatewayStatic routeDynamic protocol (OSPF/BGP)
Who configuresHost, via DHCP option 3 or manualOperator, per prefixProtocol, from neighbour state
Control-plane costNone on the hostNone at runtime; N prefixes × M routers of configHellos, LSDB/path table, CPU and memory
Failure detectionNone nativelyInterface state only; blind to remote failuresOSPF dead interval 40 s (hello 10 s) on broadcast media; BGP hold 90 s (keepalive 30 s) per RFC 4271
ConvergenceARP/NDP re-resolution onlyNoneSub-second with BFD (RFC 5880); otherwise tens of seconds
Preferencen/a (host has one)Cisco AD 1; Junos preference 5OSPF 110, eBGP 20, iBGP 200 on Cisco

Forwarding decision trace

RIB on a router holding all three:

198.51.100.0/24  via 10.0.0.2  OSPF,   AD 110
198.51.100.0/24  via 10.0.0.6  static, AD 1
0.0.0.0/0        via 10.0.0.1  static, AD 1

Packet to 198.51.100.42: longest-prefix match selects /24 over /0. Two /24 entries tie on prefix length, so lowest AD wins: the static route via 10.0.0.6. The OSPF copy stays in the RIB but never reaches the FIB.

Packet to 203.0.113.7: only /0 matches, so it goes to 10.0.0.1.

Failure modes and how to detect them

Static route blackhole on a shared segment. A static route via 10.0.0.6, where 10.0.0.6 sits behind a Layer 2 switch. The upstream device dies; the local interface stays up/up and the ARP entry for 10.0.0.6 persists (Cisco IOS default ARP timeout is 14400 s). The route stays in the FIB and traffic is dropped silently. Detect with BFD at 300 ms × 3, or IP SLA plus object tracking:

ip sla 10
 icmp-echo 10.0.0.6 source-interface GigabitEthernet0/0
 frequency 5
ip sla schedule 10 life forever start-time now
track 10 ip sla 10 reachability
ip route 198.51.100.0 255.255.255.0 10.0.0.6 track 10

If the next hop is on a point-to-point interface instead, interface-down withdraws the route for free.

Default gateway failure. The host has no alternative next hop. VRRP (RFC 5798) advertises every 1 s by default, so master-down is roughly 3 s; sub-second needs BFD or tuned timers. Without an FHRP, the host re-ARPs after its own cache expires and still finds nothing.

Dynamic protocol failure modes. OSPF takes up to 40 s to declare a neighbour dead on broadcast media without BFD. BGP takes up to 90 s. Redistribution is the other trap: an IGP redistributed into BGP without prefix filters can advertise internal space to a transit provider (RFC 7454).

When to use which

  • Default gateway: every host and stub subnet. Never run an IGP on a workstation.
  • Static route: single-homed edge, out-of-band management, Null0 blackholing, and floating backups (a static at AD 250 behind a dynamic route).
  • Dynamic protocol: multi-homed or meshed topologies where the path changes faster than an operator can react.

Do not use statics in a mesh: N prefixes × M routers is N×M config lines and one typo blackholes silently. Do not rely on a default route alone where internal and external destinations must be distinguished; a missing more-specific route sends internal traffic to the internet.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-7

Explain route lookup for a destination with default, aggregate, and specific routes.

Answer

Assumptions first: IPv4 unicast, one VRF, no policy routing or ACL redirect, FIB already programmed. Change any of those and the answer changes.

The core answer. Route lookup is longest-prefix match, full stop. The router collects every route whose prefix contains the destination and the one with the greatest prefix length wins. Default (0.0.0.0/0, length 0), aggregate (10.0.0.0/8, length 8), specific (10.1.2.0/24, length 24): the /24 wins regardless of protocol, admin distance, or metric. Admin distance and metric only break ties between routes with the same prefix length. That distinction is the whole question.

Once the winning route is chosen, the router resolves the next hop. If the next hop isn't on a directly connected subnet, it recurses: it looks up the next-hop address itself and repeats until it lands on a connected route with an egress interface. Then it needs an L2 adjacency, an ARP or ND entry, to build the rewrite. Only then does the packet leave.

Worked trace. Destination 10.1.2.55.

prefixlennext hop
0.0.0.0/00192.0.2.1
10.0.0.0/88198.51.100.1
10.1.2.0/2424203.0.113.1

All three match. LPM picks 10.1.2.0/24. Next hop 203.0.113.1 isn't connected, so recurse: 203.0.113.0/24 is connected on eth1, so egress is eth1. ARP for 203.0.113.1 gives the adjacency, the rewrite is built, packet goes out eth1. Withdraw the /24 and the /8 wins; withdraw that and the default carries it.

Trade-offs. The default route keeps the table tiny and is how you reach the internet, but it's a blackhole for anything you forgot to route. Aggregates summarize many subnets into one advertisement, cheap for the control plane, but they also cover address space you may not own, so you install a discard route (null0) for the aggregate to stop a more-specific-missing loop. Specifics give you control and traffic engineering at the cost of table size and churn.

Failure modes and how you see them.

  • Recursive next hop resolving through the default route: loop or unresolved. Cisco logs a recursive-routing message; on Linux ip route get shows the resolved chain.
  • Missing adjacency: ARP incomplete, packets dropped. ip neigh shows INCOMPLETE and interface output drops climb.
  • Aggregate blackhole: traffic to unallocated space inside the aggregate hits null0. The Null0 counter incrementing is the signal.
  • Asymmetric return path: forward via the specific, return via the default. A stateful firewall drops the return. Catch it with tcpdump on both interfaces.

Verification. Linux: ip route get 10.1.2.55 prints the chosen route, egress, and source. IOS: show ip route 10.1.2.55. Junos: show route forwarding-table destination 10.1.2.55. Then confirm with interface counters.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-25

When connected, static, OSPF, eBGP and iBGP all offer the same prefix, how does the router decide which route to install and use, and how do you verify the winner?

Answer

Two comparisons happen at two different layers, and conflating them is the usual mistake. Per prefix, the router picks one best candidate by administrative distance first, then metric; only the winners of that contest are installed in the RIB. The forwarding lookup then does longest-prefix match across whatever prefixes are installed. AD never compares 10.0.0.0/8 against 10.1.0.0/16: those are different prefixes, both can be installed, and the longer one wins at lookup time.

Assumptions: single VRF, IPv4, Cisco IOS defaults.

AD is local to the router and never advertised. Cisco IOS defaults:

SourceAD
Connected0
Static1
eBGP20
OSPF110
iBGP200

Junos calls the same knob route preference and uses different numbers: direct 0, static 5, OSPF internal 10, OSPF external 150, BGP 170 for both eBGP and iBGP, so the ordering is broadly similar but the eBGP/iBGP split is not universal. Quote the vendor you are on.

A floating static is a static route with its AD raised above the protocol it is backing up:

ip route 10.1.1.0 255.255.255.0 192.0.2.1 250

While OSPF holds 10.1.1.0/24 at AD 110, the static is not installed. When OSPF withdraws the prefix, the static becomes the only candidate and is installed. Two caveats: it tracks only the presence of the route, not reachability of its next hop, so pair it with IP SLA tracking if the backup path can fail independently; and set the AD above every protocol you want it to lose to. 250 clears iBGP's 200, whereas 200 would tie and leave the outcome to implementation detail.

Verification is reading the table, not guessing:

R1# show ip route 10.1.1.0 Routing entry for 10.1.1.0/24 Known via "ospf 1", distance 110, metric 20

  • 192.0.2.2, from 192.0.2.2, 00:12:44 ago, via GigabitEthernet0/1

The protocol name and the first number in brackets are the source and AD; the second is the metric. show ip route 10.1.1.0 255.255.255.0 longer-prefixes shows competing longer prefixes, show ip bgp 10.1.1.0 shows the BGP best-path decision, show ip ospf route shows what OSPF computed. If the table shows the static and you expected OSPF, the OSPF route is gone or was never installed: check the neighbor, not the static.

Same-protocol tie. OSPF: AD is equal at 110, so cost decides; if costs tie, IOS installs up to maximum-paths next hops (default 4) as ECMP. eBGP: AD is equal at 20, so BGP's own best-path algorithm decides. Weight, local preference, locally originated, AS path length, origin, MED, eBGP over iBGP, IGP metric to next hop, then router ID. BGP does not multipath by default; you need maximum-paths (and maximum-paths ibgp for iBGP) plus identical attributes.

That is the difference from the ECMP case: ECMP is what happens after AD and metric tie inside one protocol. Here the point is that a worse metric from a better-AD protocol wins outright: a one-hop eBGP path beats a ten-hop OSPF path with a lower cost, because 20 < 110 is settled first.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-8

Diagnose a route present in control plane but not forwarding.

Answer

Core answer (first 90 seconds)

First pin the scope: which VRF/table, which exact prefix, one line card or all, and when it started. Then split the problem by comparing the control plane and the forwarding plane for that exact prefix.

  • IOS-XR: show route 10.0.0.0/24 detail vs show cef 10.0.0.0/24 detail
  • IOS: show ip route 10.0.0.0 vs show ip cef 10.0.0.0 detail
  • Junos: show route 10.0.0.0/24 detail vs show route forwarding-table destination 10.0.0.0/24
  • Linux/FRR: ip route get 10.0.0.0 and show ip route 10.0.0.0/24

Three outcomes decide everything. If the prefix is in the RIB but not the FIB, it is a programming failure. If it is in both but packets still drop, it is an adjacency or hardware problem. If it is not in the RIB at all, it is a control-plane selection problem and forwarding is a red herring.

Why a selected route can fail to program

RIB selection is pure path computation. FIB installation is a second, harder step: the router must resolve the next-hop chain down to a connected adjacency and find a hardware slot for the entry. Any break in that chain leaves the route "selected but not programmed." That is the mechanism behind almost every case of this symptom.

Failure modes and how to detect each

FailureSymptomDetection
Next-hop recursion unresolvedIn RIB, absent from FIBshow route <next-hop> detail: recursive path gone; show cef <prefix> detail reports unresolved
Adjacency/ARP/NDP incompleteFIB entry present, traffic droppedshow adjacency <next-hop> detail shows incomplete; show arp / show ipv6 neighbors has no entry
Policy or hidden routeNot selected in RIBshow route <prefix> detail prints the hidden reason
TCAM/FIB resource exhaustionNew prefix missing, older ones fineFIB resource counters (show cef resource on IOS-XR)
Programming queue backlogFIB lags RIB after churnQueue and drop counters (show cef drops on IOS-XR, show cef drop on IOS)
Line card out of syncOne LC forwards, another does notPer-LC FIB lookup for the same prefix

Ordering and trade-offs

Do the RIB-vs-FIB diff first: it is one command pair and it eliminates half the space. Then check the adjacency, because an incomplete ARP/NDP entry is the single most common cause and is cheap to confirm. Only then look at resource and queue counters, which are noisier and platform-specific. Compare a second, working prefix in the same VRF to tell a per-prefix fault from a table-wide one.

Do not restart the routing process first. A restart clears the queue and drop counters and often makes the route reappear, destroying the evidence you need to find the real cause. Restart only after you have captured the RIB/FIB diff, adjacency state, and counters.

Convergence time is the one benign explanation: a route installed milliseconds ago may simply not be programmed yet. If the prefix has been missing for minutes, it is not convergence: keep digging.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-9

Validate ECMP health and diagnose one bad path.

Answer

Core answer (first 90 seconds)

Assume Linux, kernel 5.x, ECMP via a nexthop group, hashing on L3 or L4. Separate three questions: is the group installed correctly, is the hash spreading as intended, and is one member actually broken.

Confirm the group first. ip nexthop show lists members, weights, and whether it is a resilient group. ip -br link and ip neigh show confirm each member's link is up and its adjacency resolves: a member that is link-up but ARP-stale is the classic silent blackhole.

Then enumerate buckets offline, no traffic needed. ip route get with a full 5-tuple prints the chosen nexthop:

for p in $(seq 1024 2023); do
  ip route get 10.0.0.5 from 192.168.1.10 ipproto tcp sport $p dport 443 \
    | sed -n 's/.*dev \([^ ]*\).*/\1/p'
done | sort | uniq -c

With three equal members and L4 hashing, 1000 ports should land roughly 333/333/334. If they do, the hash is fine and the fault is a member. If they skew, say 900/50/50, it is a hash-policy artifact, not a broken path.

Then per-member counters: ethtool -S <if> for tx/rx packets, drops and errors; ip -s link; nstat -az | grep -i retrans. Compare members over the same window.

Trade-offs

Hash policy decides everything. net.ipv4.fib_multipath_hash_policy=0 (L3) is stable per destination but polarizes hard with few destinations: all traffic to one /24 goes one way. =1 (L4) spreads by port but rehashes when ports change and, inside tunnels, hashes only the outer header unless you set =2 (inner L3+L4). Resilient groups (ip nexthop add id 100 group 1/2/3 resilient buckets 16) keep surviving flows pinned when a member is removed; a plain group rehashes every flow on any membership change, which resets TCP. Use resilient when session continuity matters; plain when membership is static.

Failure modes and detection

  • Silent blackhole: link up, neighbor resolves, no forwarding. Detection: that member's tx counter flat while others climb, and ip route get tuples landing on it fail a pinned probe.
  • One-way loss: rx normal, tx drops. Detection: ethtool -S tx_dropped/tx_errors, or ss -ti retransmits on flows pinned there.
  • MTU mismatch: small packets pass, large drop. Detection: ping -M do -s 1472 <member-ip> per member.
  • Polarization: bucket sweep skews. Detection: the uniq -c above.
  • Asymmetric return path: forward via member A, return via B, stateful firewall drops. Detection: tcpdump on both directions, conntrack -L.

Worked trace

Sweep of 1000 source ports to 10.0.0.5:443, three members eth0/eth1/eth2, L4 hashing:

memberportstx pkts (60s)tx_dropped
eth03341.2M0
eth13331.2M0
eth233341k118k

Even bucket spread rules out the hash. eth2 carries 3% of the traffic its share predicts and drops 118k packets: that member is the bad path. Confirm with a pinned probe: pick a port that ip route get sends to eth2, then nc -s 192.168.1.10 -p <port> 10.0.0.5 443 and watch ethtool -S eth2 tx_dropped climb while eth0/eth1 stay flat. If instead the sweep had shown 900/50/50, the fix is sysctl -w net.ipv4.fib_multipath_hash_policy=1, not touching a member.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-10

Design safe route aggregation.

Answer

Assumptions I'd state before designing. Two data centres, DC1 and DC2, each holding eight site /24s: 10.1.0.0/24 through 10.1.7.0/24 in DC1, 10.2.0.0/24 through 10.2.7.0/24 in DC2. Each DC has a border router running eBGP to core AS 65000, which peers with two transits. I'm aggregating at the DC border, not at the core. If the components don't share fate (different PoPs, different uplinks) I'd say so and change the design.

The answer. Aggregate only where you own every component and can show they fail together. DC1's eight /24s collapse to 10.1.0.0/21, DC2's to 10.2.0.0/21. Two things make that safe.

First, the originator must carry a discard route for the aggregate. On Cisco and FRR, aggregate-address 10.1.0.0/21 summary-only installs 10.1.0.0/21 → Null0 in the RIB; on Junos the aggregate route carries discard. Without it, a packet for 10.1.3.5 arriving at the DC border after 10.1.3.0/24 has failed matches the /21, has no next hop, and follows the default route back toward the core, which sends it back. That's the loop. The discard route terminates it locally.

Second, the aggregate must not outlive its components. BGP originates an aggregate only while at least one contributing route is in the table, so all-eight-down is safe: the /21 disappears. Partial failure is the dangerous case: seven up, one down, /21 still advertised, the missing /24 blackholes. If the components must be all-or-nothing, gate the advertisement: neighbor 192.0.2.1 advertise-map DC1_AGG exist-map DC1_ALL_SITES. Build the exist-map so it only matches when all eight /24s are present: check your platform's semantics, since some match if any listed prefix is present. Any component down then withdraws the whole /21: correct, but coarse, so use it only when the sites really are one fate domain.

Leaking more-specifics. When a component's best path differs from the aggregate's: say 10.1.3.0/24 is reachable via DC2 while the /21 points at DC1: advertise the /24 alongside the /21. Longest-prefix match wins in the FIB, so traffic goes to DC2 and the aggregate still covers the rest. Tag the leak with the well-known no-export community (0xFFFFFF01) so it stays inside your AS and never reaches transit. Watch RPKI here: if your ROA is 10.1.0.0/21 maxLength 21, the leaked /24 is invalid and route-origin validation drops it. Set maxLength to 24 if you intend to leak.

Trade-offs.

DesignCore FIBPartial failureUse when
/21 summary-only2 entries for 16 sitesblackhole for the missing /24components share fate
+ exist-map on all components2whole /21 withdrawnall-or-nothing sites
+ leak more-specifics+1 per leaklongest match keeps traffic correctcomponents have diverse paths
no aggregation16precisefew prefixes, or per-prefix billing

MED (default 0, lower preferred, non-transitive) is the only lever you have on a neighbouring AS's inbound choice between the two /21s. Local-pref (default 100, higher wins) is internal-only and won't cross the eBGP boundary.

Failure modes and detection. Blackhole: aggregate up, /24 gone, traffic to the /24 dies at the DC border. The aggregate gives you no signal, so monitor per component: a route-watcher on the /24s, not on the /21. Loop: you learn a summary from a peer and also accept a default from that same peer; never do both unless the peer has a discard route. AS_SET: aggregate-address ... as-set builds an AS_SET that breaks loop detection downstream. RFC 6472 says don't. Convergence: eBGP MRAI defaults to 30s (5s iBGP), keepalive 60s / hold 180s, so a withdrawal is not instant. Size the blast radius accordingly: one bad /21 withdraws 2048 addresses.

Rollback. Keep the more-specifics in the RIB and ready to advertise; if the aggregate misbehaves, drop summary-only and the /24s return within one MRAI interval.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-22

Validate a path after routing convergence.

Answer

Core answer (first 90 seconds). "Converged" is a control-plane statement: the RIB picked a best route. It says nothing about whether the data plane forwards on it. Validation means proving three things for one specific tuple (source, destination, VRF, DSCP) in order: the RIB holds the route you expect for the reason you expect; the FIB and adjacency on every hop match that RIB entry; and packets actually traverse it in both directions. State the tuple and the expected path first, then walk the layers, because a layer-1 mismatch and a layer-3 mismatch have different owners and different fixes.

Assume IPv4, single AS, ECMP enabled, no NAT, and login on every hop. If NAT, MPLS, or a third-party transit is in the path, the validation changes.

Layer 1: control plane. show route 10.20.0.0/16 detail (Junos) or show ip route 10.20.0.0/16 plus show bgp ipv4 unicast 10.20.0.0/16 bestpath (IOS-XR). You want the best route, protocol, preference/metric, and next hop. On Junos, show route 10.20.0.0/16 extensive prints why a candidate lost: localpref, IGP metric, or "not eligible for selection." The reason matters: a route that won because the preferred path withdrew is a different risk than one that won on metric.

Layer 2: FIB and adjacency. show route forwarding-table destination 10.20.0.0/16 (Junos) or show cef 10.20.0.0/16 detail (IOS-XR; show ip cef on classic IOS). This is the hardware view. Then show adjacency <next-hop> detail: an "incomplete" adjacency means ARP/ND never resolved and the FIB entry is a blackhole the RIB knows nothing about.

Layer 3: data plane. DF-bit probes at increasing sizes, then a real transaction. Linux ping -M do -s 1472, then -s 1372; Junos ping ... do-not-fragment size 1472. traceroute in both directions. For MPLS, use LSP ping (RFC 8029) rather than IP traceroute: IP traceroute never exercises the label stack.

Worked trace. Path A was a jumbo internal link, MTU 9000. A fiber cut moves the prefix to path B, a GRE tunnel with MTU 1400. RIB and FIB agree, adjacency complete, small pings pass, TCP handshake passes (SYN is 60 bytes). The first 1460-byte data segment is dropped, and the ICMP "fragmentation needed" is filtered by an inbound ACL on the tunnel head, so the sender never learns. Symptom: connection hangs after handshake, no error. Detection: ping -M do -s 1472 fails, -s 1372 succeeds, so path MTU is 1400 (1400 − 20 IP − 8 ICMP = 1372). This survives every RIB/FIB check and is the classic "SSH works, HTTP hangs" ticket.

Trade-offs. Active probes are cheap, repeatable, and test the tuple you choose, but routers deprioritize ICMP, and a probe can succeed on a path the application never uses (different DSCP, different ECMP hash). Real transactions test the actual path but are slow and hard to repeat. Use probes to bisect, a real transaction to confirm. Where to start depends on the change: a policy or metric change → start at the RIB; a line-card or link event → start at the FIB/adjacency, because that is where stale state lives.

Failure modes.

  • RIB/FIB divergence. TCAM exhaustion or a failed FIB download leaves the RIB correct and the FIB stale. Detect: show cef next hop differs from show ip route next hop. Cost: silent blackhole for that prefix only; everything else is fine.
  • ECMP hash polarization. Four-way ECMP, one member's adjacency stale → roughly a quarter of flows blackhole. Detect: per-interface egress counters show one member at zero, or show cef ... detail shows one incomplete next hop. Cost: intermittent, reads like an application bug.
  • Asymmetric return path. Forward converged, return still on the old path or dropped by uRPF. Detect: traceroute both directions from both edges. Cost: one-way audio, TCP handshakes that never complete.
  • MTU mismatch. As traced above; detect with DF-bit size sweep, cost is a hang with no error.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-11

Explain the OSPF control-to-forwarding pipeline.

Answer

OSPF's pipeline is: hellos build adjacencies, the link-state database is synchronized and flooded, SPF turns that database into a shortest-path tree, the RIB picks among candidate routes, and the FIB installs the winner. Assume OSPFv2 on Cisco IOS defaults unless stated; OSPFv3 has the same shape with link-local addressing.

Start with hellos. On a broadcast or point-to-point interface, HelloInterval is 10 s and RouterDeadInterval is 40 s (4×Hello); on NBMA it's 30/120. Two routers become neighbors only if area ID, authentication, stub flags, and MTU match. On a broadcast segment they don't all form full adjacencies: they elect a DR and BDR, and the rest stay in 2-WAY with each other. That cuts adjacencies from n(n-1)/2 to 2n-3: five routers go from 10 to 7.

Adjacency formation is the DBD/LSR/LSU/LSAck exchange. Routers describe their LSDBs with Database Description packets, request missing LSAs, and flood updates reliably: every LSU is acknowledged, and unacknowledged LSAs are retransmitted. Each LSA carries a sequence number and age. A router refreshes its own LSAs every 1800 s (LSRefreshTime) and flushes at 3600 s (MaxAge).

Flooding keeps the LSDB identical within an area. Type 1 (router) and Type 2 (network) LSAs stay inside the area. Area Border Routers originate Type 3 summaries into other areas; ASBRs originate Type 5 externals (Type 7 in an NSSA). That's where area boundaries and redistribution enter the pipeline.

SPF is Dijkstra over the LSDB graph: vertices are routers and transit networks, edges are links weighted by cost. Cisco's default cost is 10^8 / bandwidth, so a 1 Gbps link costs 1 and a 10 Gbps link also costs 1 unless you raise the reference bandwidth. SPF is throttled: Cisco IOS defaults are 5 s initial, 10 s hold, 10 s max wait. The output is a shortest-path tree; each destination's next hop is the first hop on the tree.

The RIB then compares candidates. OSPF's administrative distance is 110, so it loses to eBGP (20) and static (1) but beats RIP (120). Equal-cost paths go into the RIB as ECMP. Finally the FIB is programmed: the RIB manager resolves each next hop to an interface and adjacency, and pushes it to the forwarding plane. On Linux with FRR, zebra installs it via netlink; on hardware, the line card gets it.

stagecarriedlives infailure signature
helloneighbor paramsneighbor tablestuck INIT, area/MTU mismatch
DBD/LSR/LSULSA headers and bodiesadjacency queuesstuck EXSTART, MTU mismatch
floodingLSAsLSDBLSA age climbing, missing Type 3
SPFgraphSPF treeSPF churn, high CPU
RIBroutesrouting tableroute present, no FIB entry
FIBnext hopsforwarding tabletraffic blackholed

Concrete failure modes: ExStart hang is almost always MTU mismatch. ip ospf mtu-ignore hides it but breaks large LSAs. LSA aging past 1800 s without refresh means a stuck neighbor or one-way flooding. SPF churn from a flapping link shows as repeated SPF runs and CPU spikes; check show ip ospf statistics. Duplicate router IDs cause unstable Type 1 LSAs. Area mismatch shows as neighbors stuck in INIT or absent.

Trade-offs: one area keeps the LSDB small but every topology change runs SPF everywhere; multi-area confines Type 1/2 flooding to an area and lets ABRs summarize Type 3, at the cost of suboptimal paths across areas. OSPF vs IS-IS: IS-IS runs on L2, uses fewer LSA types, and scales with a flatter design; OSPF is more common in enterprise and has richer vendor tooling.

So the answer to 'where does it break' is: at the stage whose state you haven't checked. Neighbor state alone tells you nothing about the FIB.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-12

Troubleshoot OSPF neighbors stuck below FULL.

Answer

Core answer

OSPF adjacency is a state machine, and the state a neighbor is stuck in names the negotiation that failed. Read the state first, then check only the parameter that gates that state. Don't touch timers until you know which one.

The progression is Down → Init → 2-Way → ExStart → Exchange → Loading → Full. Each transition is gated by a specific check:

  • Down: no hellos received. Wrong area ID, mismatched hello/dead timers, authentication mismatch, network-type mismatch, or hellos filtered by an ACL or control-plane policy.
  • Init: I'm receiving your hellos but my router ID isn't in yours. One-way delivery. Usually an ACL dropping outbound hellos, or multicast not forwarded in one direction.
  • 2-Way: normal between two DROthers on a broadcast segment. If the pair should be Full and isn't, suspect a network-type mismatch (one side broadcast, the other point-to-point) or every interface on the segment at priority 0, so no DR is elected.
  • ExStart: master/slave DBD negotiation. The classic cause is MTU mismatch: the DBD carries the sender's interface MTU, and a router discards a DBD whose MTU is larger than its own. Duplicate router ID also stalls here.
  • Exchange/Loading: LSA exchange. Stuck Loading means requested LSAs never arrive.

Defaults to check: hello 10s / dead 40s on broadcast and point-to-point; 30s / 120s on NBMA and point-to-multipoint. Both sides must match. Authentication is null by default; if configured, type and key must match. Area ID and stub/NSSA flags must match. MTU must match unless ip ospf mtu-ignore is set on both.

Worked trace: MTU mismatch stalls in ExStart

R1 MTU 1500, R2 MTU 1400, same area, timers, auth.

  1. Both reach 2-Way.
  2. R1 sends a DBD carrying MTU 1500. R2 compares 1500 against its own 1400; 1500 is larger, so R2 discards the packet and stays in ExStart.
  3. R2 sends a DBD carrying MTU 1400. R1 compares 1400 against its own 1500; 1400 is not larger, so R1 accepts it and moves to Exchange.
  4. R1 now waits for R2's DBD response. R2 keeps discarding R1's DBDs, so R1 retransmits, exhausts its retransmissions, and falls back to ExStart. The pair cycles ExStart ↔ Exchange instead of settling, and the log shows the neighbor bouncing EXSTART → DOWN with "Too many retransmissions".

Fix: set both interfaces to the same MTU, or ip ospf mtu-ignore on both. Confirm with show interface MTU and debug ip ospf adj.

Failure modes and detection

Stuck stateLikely causeConfirm
Downno hellosshow ip ospf interface, packet capture
Initone-way hellosboth sides show each other in Init
2-Way (should be Full)network type, no DRshow ip ospf interface network/priority
ExStartMTU mismatch, duplicate RIDshow interface, %OSPF-4-DUP_RTRID_NBR
Loadingmissing LSAsdebug ip ospf adj

Trade-offs

ip ospf mtu-ignore unblocks the adjacency but hides a real MTU mismatch that will black-hole large packets later: fix the MTU instead when you can. Raising dead timers reduces flapping on lossy links but slows failure detection; only do it after you've found the actual cause. On broadcast segments, forcing DR/BDR with priority is a workaround for a network-type mismatch, not a fix.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-13

Design OSPF areas and summarization.

Answer

Assume one OSPFv2 domain, gear I control, and an addressing plan I can summarize. My default: a single contiguous area 0, one non-backbone area per failure domain or per ~50–100 routers, ABRs placed on routers that already sit on the backbone, and one summary per area at its ABR. I only add an area when I can point at the LSDB or SPF cost it removes.

Why areas and summaries help. Type 1 (router) and Type 2 (network) LSAs flood only inside their area. An ABR rewrites an area's topology into Type 3 (summary) LSAs for everyone else, so routers outside area 1 never see area 1's internal links: a flap inside area 1 runs SPF only in area 1. Summarizing at the ABR (area 1 range 10.1.0.0 255.255.0.0) collapses many Type 3s into one, shrinking every other area's LSDB and removing SPF churn from internal changes. That is the mechanism, not a slogan.

Stub vs NSSA. A stub area blocks Type 5 externals; the ABR injects a default Type 3 instead, so internal routers carry no external LSAs. Totally stubby (area 1 stub no-summary) also blocks Type 3, leaving intra-area plus a default. Use NSSA when the area itself holds an ASBR redistributing externals: it carries Type 7 internally and the ABR translates Type 7 to Type 5 at the boundary. If the area needs specific external prefixes rather than a default, do not stub it.

Worked check. Area 1 has 30 routers and 200 /24s. Without a range, area 0's LSDB holds 200 Type 3 LSAs for area 1; with area 1 range 10.1.0.0 255.255.0.0 it holds 1. A link flap inside area 1 now changes nothing in area 0's LSDB, so area 0 SPF does not run. That is the measurable win, and it is why I summarize only at ABRs/ASBRs where the range is a true superset of the area's prefixes.

Failure modes and detection.

  • Over-broad range blackholes traffic: range 10.1.0.0/16 advertised but only 10.1.0.0/24–10.1.5.0/24 exist, so 10.1.9.0/24 looks reachable and dies at the ABR. Detect by pinging every /24 the range covers.
  • Suboptimal path: the summary hides internal cost, so area 2 traffic enters area 1 at the ABR with the lowest cost to the summary, not the one nearest the destination. Detect with asymmetric traceroutes.
  • Backbone partition: area 0 must stay contiguous or inter-area routing breaks. Detect via missing Type 3s and show ip ospf border-routers; patch with a virtual link or re-cable.
  • Single ABR: if the only ABR for an area dies, the area is isolated. Run two ABRs per area and verify both advertise the summary.

What changes the decision. No external reachability needed → stub. An internal ASBR → NSSA. Addressing that cannot be summarized cleanly → do not summarize; a leaky or over-broad range costs more than the LSDB it saves.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-14

Explain BGP route import, selection, and export.

Answer

Core answer. BGP runs every prefix through three stages: import (inbound policy, per neighbor), selection (a fixed best-path comparison over the Loc-RIB), and export (outbound policy, per neighbor). Import and export are where you express intent; selection is a deterministic algorithm you don't get to reorder. The single most useful thing to say in an interview: by default only the best path per prefix is exported. Everything else is held but not advertised.

Import. An UPDATE arrives; the router checks the session is Established, the AFI/SAFI was negotiated, and the NLRI is well-formed. Malformed attributes are handled per RFC 7606 (treat-as-withdraw by default, not a session reset). Then: AS_PATH loop check (own AS present → discard), NEXT_HOP reachability, max-prefix limit, and RPKI origin validation (RFC 6811) if configured. Inbound policy (route-map / import policy) then sets local-pref, MED, communities, or drops the route. Pre-policy routes sit in Adj-RIB-In; post-policy routes enter the Loc-RIB.

Selection. Cisco's order, highest priority first:

#TiebreakerDirectionDefault
1Weighthigher0 (Cisco-only)
2Local preferencehigher100
3Locally originatedprefer—
4AS_PATH lengthshorter—
5OriginIGP < EGP < IncompleteIncomplete = 2
6MEDlower0
7eBGP over iBGPprefer eBGP—
8IGP metric to NEXT_HOPlower—
9Multipathinstall N—
10Oldest eBGP pathprefer—
11Router IDlower—
12Cluster list lengthshorter—
13Neighbor addresslower—

Juniper drops weight and reorders slightly; the shape is the same.

Why local-pref precedes AS_PATH length: local-pref is the operator's explicit outbound-traffic-engineering knob, set by policy, and it must beat the automatic tiebreakers or you couldn't override them. AS_PATH length is only a proxy for distance and is trivially gamed by prepending, so it sits below anything you set deliberately.

Why eBGP over iBGP: an eBGP route is external reachability learned directly; an iBGP route is that same external route propagated internally. Preferring eBGP keeps traffic on the shortest exit and avoids an extra internal hop.

Trace. R1 (AS 65001) has 10.0.0.0/24 from peer 192.0.2.1 (AS 65002), AS_PATH "65002 65003", MED 50; and from 192.0.2.5 (AS 65004), AS_PATH "65004", MED 0. Both local-pref 100. Step 4: AS_PATH length 2 vs 1 → the second wins. Now add an inbound route-map setting local-pref 200 on the first. Step 2 fires before step 4, so the first wins despite the longer AS_PATH. That is the whole point of the ordering.

Export. Outbound policy runs per neighbor against the Loc-RIB. eBGP: prepend your own AS to AS_PATH, set NEXT_HOP to yourself, optionally set MED or communities. iBGP: no AS_PATH change, NEXT_HOP preserved (use next-hop-self if the peer can't resolve it), and, critically, an iBGP-learned route is not re-advertised to another iBGP peer. That rule is why you need route reflectors (RFC 4456) or confederations.

Trade-offs. Local-pref is transitive within your AS and is the right tool for "prefer this exit." MED is non-transitive and only compared between paths from the same neighbor AS: use it to influence inbound traffic, and expect the neighbor to ignore it. Weight is Cisco-only and local to one router; it's for "this router, this prefix" and never leaves the box. AS_PATH prepending is the blunt inbound tool: it works, but it's visible and easy to over-do.

Failure modes and detection. Max-prefix exceeded → session drops; watch show bgp summary and the log. NEXT_HOP unresolvable → route sits in RIB-Failure; check the RIB-Failure counter. Policy typo → prefix present in Adj-RIB-In but missing from Loc-RIB or Adj-RIB-Out; compare the three counts per neighbor. RPKI invalid → route marked invalid and dropped if your policy says so; check the validation state per prefix. AS_PATH loop → silent discard; verify with a looking glass.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-15

Design inbound and outbound traffic engineering with BGP.

Answer

The 90-second answer. Outbound and inbound are different problems. Outbound you own: you choose which of the routes your peers offer you actually use, and you do it with LOCAL_PREF, because LOCAL_PREF is compared before AS_PATH length in the best-path decision. Inbound you don't own: you can only make an advertisement more or less attractive and hope the remote AS's policy agrees. The honest framing is "outbound is deterministic, inbound is a negotiation."

Assumptions: one AS, two transit providers and one IXP peer, Cisco/Juniper-class BGP, default LOCAL_PREF 100, default MED 0.

Outbound. Set LOCAL_PREF per neighbor or per received community. A common scheme: tag routes from transit A with community 65000:100 → LOCAL_PREF 200; transit B → 150; IXP → 250. Because LOCAL_PREF is step 2 of the decision process and AS_PATH is step 4, a 200-local-pref path with a 6-hop AS_PATH still beats a 150-local-pref path with a 2-hop AS_PATH. That is the whole reason outbound engineering works and inbound mostly doesn't.

Inbound. Three levers, in order of how much control you actually get:

LeverWhat it doesWho must cooperateBlast radius
Well-known communities (NO_EXPORT 65535:65281, NO_ADVERTISE 65535:65282)Stops your route leaving the peer's ASPeer must honor themSmall, but a leaked NO_EXPORT via a misconfigured route reflector is silent
AS_PATH prependingAdds hops, makes the path look longerNobody, but remote LOCAL_PREF overrides itCoarse; prepending 3 on a /24 can shift traffic to a path you didn't plan
MEDHints the immediate neighbor's entry pointOnly the directly connected AS, and only if it compares MEDOne AS hop: MED is non-transitive, so it never reaches the peer's peer

MED's one-hop scope is the thing candidates get wrong. It is an optional non-transitive attribute: your neighbor sees it, their neighbor doesn't. And it is only compared among paths from the same neighboring AS, so it cannot arbitrate between two different providers.

Worked trace. You advertise 203.0.113.0/24 to transit A and B. A's router sees two paths:

  • Direct from you: AS_PATH 65000, length 1, MED 50, LOCAL_PREF 100 (A's default)
  • Via B: AS_PATH 65001 65000 65000 65000, length 4, MED 0, LOCAL_PREF 100

A compares LOCAL_PREF (tie), then AS_PATH: length 1 beats length 4. A picks the direct path. Your prepending worked, but only because A's LOCAL_PREF was equal. If A had a policy setting LOCAL_PREF 200 on routes from B, your prepending is invisible.

Failure modes and detection.

  • Prepending ignored: remote LOCAL_PREF wins. Detect with a looking glass or a BMP feed (RFC 7854) from the peer, not by guessing.
  • MED ignored: peer runs always-compare-med or a different vendor default. Detect by comparing your MED against the peer's observed selection.
  • NO_EXPORT leak: a route reflector reflects a NO_EXPORT route to an eBGP peer. Detect with a route collector (RouteViews, RIPE RIS) checking your prefix's visibility.
  • Asymmetric return path: you engineer inbound, return traffic takes a different path, a stateful firewall drops it. Detect with sFlow/NetFlow keyed on source AS, or traceroute from both ends.
  • RTBH (BLACKHOLE 65535:666, RFC 7999) triggered on a /32 that is also a real host: you blackhole a customer. Detect by alerting on RTBH community count.

When not to engineer. A common rule of thumb: if a link runs above ~70% at p95 for more than a week, the cheaper answer is usually another transit port or a peering session, not more prepending. Engineering effort has a cost; a 10G port at a typical IXP is a known number, and prepending is a guess about someone else's policy.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-16

Build safe BGP import and export policy.

Answer

I'd build import and export policy as two separate generated artifacts from one source of truth, with default reject and explicit permits. Import answers "what do I accept from this peer?"; export answers "what do I send them?" The safety property is that a missing rule causes a visible outage, not a silent leak.

Assume eBGP with transit, peer, and customer roles; you have an IPAM or IRR/RPKI source of truth; you run IOS-XR or Juniper.

Import policy runs top-down, first match wins, implicit deny at the end. I start with denies that are cheap and universal: reject default route unless explicitly allowed, reject bogons (RFC 6890, Team Cymru fullbogons), reject prefixes longer than /24 IPv4 or /48 IPv6, reject AS-path containing my own AS (loop), reject first AS not equal to the peer's AS (spoofing). Then RPKI: RFC 6811 validation states valid/invalid/notfound. Then allow exact prefixes from the source of truth with correct length. Export: only my own and customer prefixes; set next-hop self; attach NO_EXPORT (0xFFFFFF01) to peer routes so they don't leak; never re-advertise peer or provider routes to another peer.

The main trade-off is strict vs permissive on RPKI invalid. Dropping invalid is safe against hijacks but a misconfigured ROA blackholes legitimate traffic. I'd drop invalid only if ROA coverage is high and I have alerting on invalid count; otherwise mark and monitor. Max-prefix: set to expected + 20-30%. Too low flaps on legitimate growth; too high risks memory exhaustion. Canary: apply to one peer or one router first, diff advertised routes before and after.

Failure modes: Max-prefix exceeded: Cisco IOS-XR neighbor 192.0.2.1 maximum-prefix 1200000 80 restart 30 warns at 80%, tears down at 100%, restarts after 30 min. Juniper: prefix-limit maximum 1200000 teardown 80 idle-timeout 30. Detection: syslog (e.g., %BGP-3-MAXPFX), SNMP trap. RPKI invalid drop: if ROA is wrong, you blackhole; detect by comparing invalid count to baseline. Bogon leak: if you forget, you advertise 10.0.0.0/8; detect via looking glass or IRR check.

DirectionMatchActionWhy
Importdefault route 0.0.0.0/0reject unless peer is transit and explicitly allowedprevents accidental default
Importbogon (RFC 6890)rejectprevents private/reserved leak
Importprefix length > /24 IPv4, > /48 IPv6rejectglobal table granularity
ImportAS-path contains own ASrejectloop prevention
Importfirst AS != peer ASrejectspoofing
ImportRPKI invalidreject or markhijack vs ROA error
Exportnot own/customerrejectvalley-free
Exportpeer/provider routeattach NO_EXPORTprevents transit leak

Arithmetic: full IPv4 table ~950k prefixes in 2024. For a transit peer, set max-prefix to 1.2M (20% headroom). For a customer with 500 /24s, set to 650 (30% headroom).

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-17

Design and test first-hop redundancy.

Answer

The first 90 seconds. A first-hop redundancy protocol gives hosts one virtual IP and one virtual MAC, so the gateway behind them can be replaced without any host re-ARPing. I pick the protocol from the failover budget. VRRPv3 (RFC 5798) with its 1 s advertisement if the budget is 3-4 s and the fleet is multi-vendor. HSRP if it is all Cisco, where preemption is off by default and you have to turn it on. GLBP only if two routers must actually forward for different hosts. Then I design three things in this order: priority and preemption, failure tracking, control-plane protection. Getting them out of order is what produces split brain on one side and black holes on the other.

Priority, preemption, timers. Priority runs 1-254, default 100; 255 means address owner and always wins. A backup takes over when Master_Down_Interval expires: 3 * advert + (256 - priority)/256 seconds, so 3.6 s at the defaults. VRRPv3 carries the advertisement interval in centiseconds, so 100 ms is legal, but the skew term does not shrink with it: 0.61 s at priority 100, 0.22 s at priority 200. That is why shortening VRRP timers alone rarely gets you under a second. For real sub-second failover I track a BFD session with object tracking and let BFD fail in about 150 ms.

Preemption, on by default in VRRP and off in HSRP, decides who wins after the repair. I set a preempt delay that covers routing convergence: 60-180 s for a full-table BGP speaker, a few seconds for a stub OSPF edge. Preempting the VIP before the routing table is populated just moves the black hole to the other chassis.

Tracked failure. Track the uplink interface with a decrement, the BGP or OSPF adjacency, or a route to a critical prefix. A decrement keeps the box master until a higher-priority backup preempts it after Skew_Time. A priority-0 advertisement, or shutting the group, resigns immediately; backups still wait Skew_Time before taking over.

Split brain. VRRP is IP protocol 112 to 224.0.0.18 with TTL 255 in both directions. VRRPv3 dropped the v2 authentication field, so containment is the TTL check, an ACL permitting protocol 112 only from the peer, and control-plane policing. HSRP is UDP 1985 to 224.0.0.2 in v1 and 224.0.0.102 in v2. Left open, both boxes go Master, both answer ARP for the VIP, and the switch CAM entry for the virtual MAC flaps between ports.

Worked failover. Group 10, VIP 10.0.4.1, virtual MAC 00:00:5e:00:01:0a. R1 priority 110, R2 priority 100, 1 s advertisements, R1 tracks its uplink with decrement 30.

t=0: R1's uplink dies. Its priority becomes 80, and it stays Master. t <= 1 s: R2 receives an advertisement carrying priority 80. Preemption is enabled, 80 < 100, so R2 sets Master_Down_Timer to Skew_Time = (256-100)/256 = 0.61 s. t = 1.6 s: R2 becomes Master, advertises priority 100, and sends an unsolicited ARP for 10.0.4.1 with the virtual MAC.

Outage is roughly 1.6-2 s. Note what the ARP fixes: hosts already map the VIP to 00:00:5e:00:01:0a and that entry was never stale. The gratuitous ARP exists to move the switch's forwarding entry.

Test matrix.

breakexpectedhow you know it is wrong
Kill the FHRP process on the masterBackup takes over within Master_Down_IntervalPacket capture on the host VLAN shows a gap between the last advertisement and the new master's ARP; a host's arp -a still resolves the VIP
Pull the master's tracked uplinkPriority decrements, backup preempts after Skew_TimeTimed ping gap to the VIP; show vrrp on both chassis
Drop protocol 112 egress on one side onlyOne-way adverts, both boxes MasterBoth report Master, and show mac address-table for 0000.5e00.010a flaps between ports
Long-lived TCP flow across the failoverSession survives only if conntrack and NAT state are synchronizedThe ssh session resets; check conntrack on the new master
Recover the original masterPreempt delay elapses, ARP is sent, traffic moves backImmediate double ARP with no routing convergence behind it

Alongside the table: both chassis need the same VLANs, the same ACL/NAT and firewall state, and enough upstream capacity that the standby can carry the whole flow plus a full routing table. Verify the last one with counters and the standby's BGP table size, and check for an asymmetric return path with traceroute right after failover.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-21

Compare Static NAT, Dynamic NAT, and Port Address Translation (PAT). How do their translation mappings and state tables operate under load?

Answer

The 90-second answer. All three rewrite addresses between domains; the only thing that decides which one you deploy is cardinality, how many inside hosts share how many outside addresses, and whether anything outside needs to reach in.

  • Static NAT is 1:1 and permanent. It is a configuration entry, not a state table: the mapping exists before any packet arrives, so either side can initiate. Ports are untouched, which is why it is the only one of the three that carries GRE, ESP, or any IP protocol without ports.
  • Dynamic NAT is 1:1 out of a pool, bound on the first outbound packet. It keeps a binding table: one entry per inside host, not per flow. Inbound works only after that host has sent something out.
  • PAT is N:1 and rewrites the L4 source port (or ICMP query ID). It keeps a per-flow 5-tuple table, and that table is the whole cost: state scales with concurrent flows, not with hosts.

Deciding criteria. Pick static when something outside must reach a specific host at a stable address (a public-facing server, an IPsec peer, a site-to-site tunnel) or when the protocol has no ports to rewrite. Pick dynamic when you have a pool, traffic is outbound-only, and you want to preserve per-host source identity in external logs. Pick PAT when addresses are scarce and outbound-only is acceptable; you are explicitly trading inbound reachability, per-host traceability, and protocol transparency for address conservation.

Comparison table

MechanismRatioPort rewriteInbound initiationState keptChoose when
Static NAT1:1NoYes, alwaysNone (config only)Inbound reachability, or portless protocols
Dynamic NAT1:1 from poolNoOnly after outboundOne binding per hostOutbound-only, need per-host traceability
PATN:1 or N:MYesOnly via static port-forwardOne entry per flowAddress scarcity, outbound-only

What the state tables hold. Static NAT has no table: the translation is a lookup against running config, so it costs nothing per flow and never exhausts. Dynamic NAT holds a binding table sized by the pool: N entries for a pool of N, and the N+1th host is dropped until a binding times out. PAT holds a 5-tuple per flow. A worked example, with hypothetical timers:

Inside local:   10.0.1.50:49152
Inside global:  203.0.113.1:51000
Outside:        198.51.100.1:443
Protocol:       TCP   State: SYN_SENT   Timeout: 30s

On the SYN-ACK the entry moves to ESTABLISHED and the timer switches to the established idle value (example: 3600s). FIN/RST tears it down in seconds. UDP and ICMP get pseudo-entries refreshed by traffic and evicted on inactivity (example: 30s UDP, 10s ICMP).

Under load. The three fail differently. Static NAT does not degrade: it is a config lookup. Dynamic NAT degrades at pool size: the 33rd host on a /27 pool is dropped even though it is idle, and the drop is silent to the host. PAT degrades at port count: 65,535 ports per protocol, minus reserved ranges, and allocation is per (protocol, destination), so a single hot destination (one SaaS endpoint, one DNS resolver) can exhaust its own port space while the rest of the table is empty. That is the failure people actually hit, and it looks like intermittent SYN drops to one destination, not a dead link.

Failure modes and detection. Port exhaustion shows as new SYNs dropped while established flows keep working; watch translation-table utilisation per destination, not just the total. State-table memory exhaustion shows as control-plane degradation or drops across all forwarding engines before ports run out; watch table size against RAM. Dynamic pool exhaustion shows as a flat line in new bindings with hosts still up. And PAT's real cost is operational: many hosts behind one address means external logs cannot attribute a connection without port-and-time correlation, and any protocol that embeds an address in its payload (FTP, SIP, RTSP) needs an ALG or it breaks.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-20

Diagnose asymmetric routing through stateful middleboxes.

Answer

Core answer (first 90 seconds)

Asymmetric routing is only a fault when a stateful device or a reverse-path check sits on the path. Two stateless routers taking different paths is harmless. So state the assumption first: name the stateful hops (firewall cluster, NAT device, load balancer, tunnel endpoint) and work out which of them see only one direction.

Then answer directly: find the first device that drops the return packet and read its reason. On an ASA, show asp drop names it: no-matching-connection means the return packet reached a firewall that never saw the forward flow; reverse-path-failed means uRPF. That one command usually ends the diagnosis.

Why it breaks

A stateful firewall keys its session table on the 5-tuple. The forward SYN creates the entry; the SYN-ACK must arrive at the same device to match it. If ECMP hashes the reverse tuple to a different member, that member has no entry and drops. The entry exists (ASA default TCP idle timeout is 3600 s, UDP 120 s) it is just on the wrong box.

ECMP is the usual cause. Hashing is per-tuple and independent per direction, so with N equal-cost paths the reverse flow lands on the same path with probability 1/N. Four paths means 75% of flows are asymmetric. That is the number to quote.

Cluster session sync is meant to cover this: the active member replicates sessions to standby. It fails when the flow moves to a member that never received the sync (churn faster than replication), or when the two directions land on two active members of different clusters.

NAT adds a second failure. If the forward path translates the source, the return packet must reach the device holding that translation. Two devices sharing a NAT pool each drop the other's return traffic.

uRPF strict mode (ip verify unicast source reachable-via rx on IOS; rp_filter=1 on Linux, where 0 is off and 2 is loose) drops any packet whose source is not reachable via the ingress interface: exactly what a return path differing from the forward path produces.

Trace

  1. Client 10.0.1.5 → VIP 10.0.9.10:443. R1 ECMP picks path A → FW-A. FW-A creates the session and NATs the source to 192.0.2.7.
  2. Server replies to 192.0.2.7. R2 hashes (10.0.9.10,443,192.0.2.7,51000) → path B → FW-B.
  3. FW-B has no session for that tuple. show asp drop increments no-matching-connection; the packet is dropped with no RST.
  4. Client retransmits the SYN, same hash, same path, same drop. The handshake never completes.

Remediation trade-offs

  • Restore symmetry: pin the flow, fix the IGP metric, enable symmetric ECMP hashing. Cheapest, no state to move, but it removes the redundancy the ECMP was built for.
  • Synchronize or distribute state. Keeps the topology; costs replication bandwidth and a failover window. Wrong when the two directions land in different failure domains.
  • Compatible routing: design the return path through the same device. Correct for load balancers, but DSR is intentional asymmetry; do not "fix" it.
  • Relax validation narrowly: loose uRPF, or disable inspection for one flow. Last resort, scoped to a specific prefix or interface.

Failure modes and detection

FailureDetectCost
Return hits wrong cluster membershow conn on both members; show asp dropsilent drops, TCP retransmits
Sync lag under churnsession counts diverge between membersfirst return packet dropped after failover
NAT pool shared across devicesshow nat translations on bothone-way traffic, no RST
Strict uRPF on return pathinterface uRPF drop counterdrops only for off-path sources

Correlate both-direction captures by 5-tuple and timestamp. The gap between the forward packet leaving and the return packet being dropped localizes the device.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-24

Ping and the TCP handshake to a server succeed, but a large file transfer stalls partway through. Walk me through how you'd diagnose it and what's actually happening.

Answer

Small packets succeeding while bulk transfer stalls is the signature of a path MTU discovery black hole, not an application bug. Ping defaults to a 56-byte payload and a SYN/SYN-ACK carries no data, so both fit any MTU on the path. The moment TCP sends a full-size segment, a router that cannot forward it drops it silently, because DF is set and the ICMP "fragmentation needed" it should return is filtered. Confirm before touching anything: ping -M do -s 1472 <dst> on Linux or ping -f -l 1472 on Windows. 1472 + 20 IP + 8 ICMP = 1500. If that fails but 1400 works, you have an MTU problem. If routing were broken the handshake would not complete; if the app were broken, small responses would fail too.

Mechanism: RFC 1812 requires a router that receives a packet larger than the next-hop MTU with DF set to drop it and send ICMP type 3, code 4, carrying the next-hop MTU. PMTUD depends on that message arriving. Filter it, common on firewalls that blanket-deny ICMP, and the sender never learns to shrink, retransmits the same 1500-byte segment, and the transfer hangs while the connection still looks "up".

Where MTU and MSS actually bite:

EncapsulationOverheadUsable MTUTCP MSS
Ethernet015001460
PPPoE814921452
GRE2414761436
VXLAN5014501410
IPsec ESP tunnel~50-73~1427-1450~1387-1410

MSS = MTU - 40 for IPv4 TCP. MSS is only a TCP option, advertised in the SYN and enforced by the endpoints, which is why clamping works: a router rewriting the SYN MSS to 1452 makes both ends never emit a segment that will not fit. It does nothing for UDP (QUIC, IKE, DNS), which must rely on PMTUD or its own probing.

Jumbo mismatch: a LAG with one member at 9000 and the rest at 1500 hashes some flows onto a member that drops every jumbo frame. Check the MTU per member, not just the bundle.

Confirm hop by hop: tracepath runs PMTUD itself and reports the MTU per hop; otherwise traceroute with increasing packet sizes, or ping with DF at each hop's address. Compare against ip link show or show interface MTU on each device.

Fix selection: if ICMP 3/4 is being dropped, stop dropping it. That is the root cause. If a tunnel or PPPoE shrinks the path, clamp MSS at that edge (ip tcp adjust-mss 1452). If a LAG member is misconfigured, fix the member. Raising the tunnel MTU only helps if every hop can carry it. Do not raise the app's buffer or blame the server.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-23

Design safe redistribution between OSPF and BGP.

Answer

Assumptions. Two domains (one OSPF process, one BGP AS) joined at one or two ASBRs. I need to know which prefixes each side is authoritative for, and whether redistribution is one-way or mutual. One-way collapses to a prefix-list and a metric; mutual at two points is the case that bites, so I'll assume that.

Core answer. Redistribute nothing by default. Build an explicit prefix-list of what each domain owns, apply it in a route-map, deny the rest. Mark what you inject so you can recognise it coming back: tag 100 when BGP enters OSPF, community 65000:100 when OSPF enters BGP. The reverse direction denies those marks first. Set the metric explicitly both ways, cap the volume, and don't originate a default unless you mean it.

Why the copy wins. Administrative distance is compared per prefix, across protocols, in the RIB. eBGP is 20, OSPF is 110. So on any ASBR, the BGP copy of an OSPF prefix beats the OSPF original. That one fact is the whole loop.

Trace. R1 originates 10.10.1.0/24 in OSPF. R2 (AS 65000) redistributes it into BGP with MED 100 and community 65000:100. R3 (AS 65001) learns it, next-hop R2. R4 (AS 65002) learns it from R3, next-hop R3, and redistributes it back into OSPF with the default seed metric: 20, type 2. R4 now holds two routes for 10.10.1.0/24: OSPF at AD 110 and BGP at AD 20. BGP wins, so R4 sends traffic for an OSPF-originated prefix out to R3 and back in through R2. If R2's OSPF path to that prefix runs back through R4, the two ASBRs point at each other and the packet rings R2→R4→R3→R2 until TTL expires. traceroute shows the ring; show ip route 10.10.1.0 on the ASBR shows a BGP next-hop that lives inside the OSPF domain. The deny on tag 100 / community 65000:100 breaks it. R4 refuses to put back into OSPF anything OSPF put into BGP.

Config (IOS 15.x).

ip prefix-list OSPF-OK seq 10 permit 10.10.0.0/16 le 24
ip prefix-list BGP-OK  seq 10 permit 172.16.0.0/16 le 24
ip community-list standard FROM-OSPF permit 65000:100

route-map OSPF-TO-BGP deny 10
 match tag 100
route-map OSPF-TO-BGP permit 20
 match ip address prefix-list OSPF-OK
 set metric 100
 set community 65000:100

route-map BGP-TO-OSPF deny 10
 match community FROM-OSPF
route-map BGP-TO-OSPF permit 20
 match ip address prefix-list BGP-OK
 set metric 20
 set metric-type type-1
 set tag 100

router bgp 65000
 redistribute ospf 1 route-map OSPF-TO-BGP
 neighbor 192.0.2.1 send-community
 neighbor 192.0.2.1 maximum-prefix 5000 80 restart 30

router ospf 1
 redistribute bgp 65000 subnets route-map BGP-TO-OSPF
 max-lsa 12000 75 warning-only

Two things people miss: subnets is required or OSPF drops everything longer than classful, and send-community is required on eBGP or the community never leaves the box. set metric-type type-1 matters too: E2, the default, ignores internal cost, so a remote E2 route can look cheaper than it is.

Trade-offs. One ASBR is loop-free by construction and needs no tags, but it's a single point of failure and forces the far side onto a suboptimal path. Two ASBRs need the tagging above and identical policy on both. Static routes to the other domain's prefixes avoid attribute translation entirely and are right when the boundary is small and stable: they just don't follow topology changes.

Failure modes. Route leak: show ip bgp neighbors 192.0.2.1 advertised-routes shows prefixes you didn't intend to send, and prefix-list hit counters climb on the deny entries. Volume blowup: %BGP-3-MAXPFX or the max-LSA warning in syslog, plus the LSA count in show ip ospf. Blackhole after restart: clear ip bgp *, then diff the FIB on both ASBRs. A prefix present in BGP but absent from OSPF means the route-map is dropping it. MED is non-transitive across AS boundaries by default, so check show ip bgp <prefix> on each ASBR rather than assuming the far side sees your metric.

Curated: · Written: · Reviewed:

Difficulty: Hard