SONiC
Module 2 · Control Plane, FRR & Route Lifecycle

Route Withdrawal

45 minLabObservationCorrelationVirtual

Watch a prefix leave the system. Establish forwarding for a test prefix, then withdraw it at the source and observe the removal cascade — control plane (FRR), application state (APPL_DB), and hardware state (ASIC_DB) — while testing forwarding before and after. The point is to see teardown propagate in the same order as install, and to time it.

Safety: Caution

May change state — take a snapshot first.

Caution: this removes a route and forwarding for the test prefix. Use only the lab test prefix; do not withdraw anything else.

Reuses Lab 2.1

  peer withdraws 10.2.2.0/24 ; observe removal on sonic-a

Objective

  • Observe a prefix being removed from FRR, APPL_DB, and ASIC_DB.
  • Confirm forwarding stops after withdrawal and that stale state does not linger.
  • Record rough removal timing across layers.

Starting state

  • Prefix 10.2.2.0/24 received on sonic-a and forwarding (per Lab 2.2).
  • Two terminals on sonic-a: one for watching state, one for the data-plane test.

Prerequisites: Lab 2.2 completed (you can trace the prefix). · Lesson 2.3 lifecycle.

Tasks

  1. 1

    Baseline: confirm the route forwards

    SONiC CLI
    show ip route 10.2.2.0/24
    Linux
    ping -c 2 10.2.2.1
    Expected:
    • Route present at all layers; ping succeeds (VS limits noted).

    What happened internally: Establishes the 'before' state so the withdrawal delta is unambiguous.

  2. 2

    Withdraw the prefix at the source

    On the peer (AS 65002), stop advertising the test prefix.

    FRR / vtysh Disruptiveon the peer — removes the advertisement
    vtysh -c 'conf t' -c 'router bgp 65002' -c ' address-family ipv4 unicast' -c '  no network 10.2.2.0/24' -c 'end'
    Expected:
    • The peer stops advertising; a BGP withdraw is sent toward sonic-a.

    What happened internally: Withdrawing the network origin triggers a BGP UPDATE with the prefix withdrawn, starting the teardown cascade.

  3. 3

    Observe removal at the control plane

    FRR / vtysh
    vtysh -c 'show ip bgp 10.2.2.0/24'
    FRR / vtysh
    vtysh -c 'show ip route 10.2.2.0/24'
    Expected:
    • Prefix gone from bgpd and no longer selected in zebra.

    What happened internally: bgpd removes the path and informs zebra, which withdraws the route and signals FPM to delete it downstream.

  4. 4

    Observe removal at application and hardware state

    SONiC DBexpect empty
    sonic-db-cli APPL_DB HGETALL 'ROUTE_TABLE:10.2.2.0/24'
    SONiC DBIllustrative outputthe dest should no longer be present
    sonic-db-cli ASIC_DB EVAL "return redis.call('SCAN',0,'MATCH','ASIC_STATE:SAI_OBJECT_TYPE_ROUTE_ENTRY:*','COUNT',200)" 0
    Expected:
    • APPL_DB entry deleted; no ASIC_DB route object for the dest.

    What happened internally: fpmsyncd deletes the APPL_DB entry; orchagent issues SAI remove; syncd tears down the hardware entry. Same chain as install, in reverse.

  5. 5

    Confirm forwarding stopped

    Linux
    ping -c 3 10.2.2.1
    Expected:
    • Ping now fails / no route — forwarding removed, no stale black-hole-avoiding entry lingering.

    What happened internally: Verifies teardown reached the data plane. Lingering forwarding after full withdrawal would indicate stale state (Lesson 2.4).

  6. 6

    Restore the advertisement

    FRR / vtyshon the peer — re-advertise
    vtysh -c 'conf t' -c 'router bgp 65002' -c ' address-family ipv4 unicast' -c '  network 10.2.2.0/24' -c 'end'
    Expected:
    • Prefix relearned and reprogrammed; forwarding returns.

    What happened internally: Confirms the install cascade re-runs cleanly, and returns the lab to the Lab 2.1/2.2 baseline for later labs.

Troubleshooting branches

If: APPL_DB entry lingers after control-plane removal

Then: Check fpmsyncd/bgp container health; a stuck exporter can delay APPL_DB deletion.

If: ASIC_DB object remains after APPL_DB is gone

Then: Suspect orchagent/syncd; persistent divergence is a sync-failure signal, not normal teardown lag.

If: Ping still succeeds briefly

Then: Short-lived cache/neighbor effects can occur; re-test after a few seconds. Persistent success after full removal is abnormal.

Cleanup / rollback
  • Ensure the prefix is restored and forwarding again so Labs 2.4/2.5 start from a known-good baseline.

Lab evidence checklist

  • Before: route present + ping success captured.
  • Control-plane removal captured (bgpd + zebra).
  • APPL_DB and ASIC_DB removal captured.
  • After: ping failure captured.
  • Restore verified.
  • Rough per-layer removal timing noted.

Reflection

  • Did teardown propagate in the reverse order of install? Where was the largest delay?
  • What would lingering hardware state after a clean withdrawal tell you about the system?
Lab notes & observations