SONiC
Module 2 · Control Plane, FRR & Route Lifecycle

Build a Routed Adjacency

60 minLabConfigurationVirtualOpen-source

Bring up a routed link between two nodes (two SONiC-VS, or SONiC-VS plus a Linux host running FRR), establish an eBGP session, advertise test prefixes in both directions, and verify the received routes at the FRR layer. This is the foundation topology every later lab in this module reuses.

Safety: Safe

Non-disruptive. Safe to run in the virtual lab.

Safe/observational-plus-config on an isolated lab link. Do not attach this /31 port group to production VLANs.

Two-node eBGP

  AS 65001                         AS 65002
  ┌───────────────┐   .1  .2   ┌───────────────┐
  │  sonic-a      │Ethernet0──┤ Ethernet0      │
  │ 10.0.12.1/31  │───────────│ 10.0.12.2/31   │
  │ lo 10.1.1.1   │   p2p link│ lo 10.2.2.1     │
  └───────────────┘           └───────────────┘
   advertise 10.1.1.0/24       advertise 10.2.2.0/24

Objective

  • Configure routed (L3) interfaces on a point-to-point link between two nodes.
  • Establish an eBGP session between the two ASNs.
  • Advertise a test prefix from each side and confirm it is received on the other.
  • Produce the baseline topology reused by Labs 2.2–2.5.

Starting state

  • Both nodes powered on, management reachable, logged into the SONiC CLI.
  • Ethernet0 on each SONiC node is admin-up and not yet configured for L3.
  • You have confirmed the routing config mode (Lesson 2.1) so you edit the correct surface.

Prerequisites: Lesson 2.1 complete. · Two nodes reachable over management; a shared L2 segment for the data link (one vCenter port group). · Lab 1.1 baseline snapshot exists on each SONiC-VS.

Tasks

  1. 1

    Confirm the routing config mode before editing

    Decide whether SONiC config or FRR config is authoritative on each node so your BGP config persists.

    SONiC DB
    sonic-db-cli CONFIG_DB HGET 'DEVICE_METADATA|localhost' docker_routing_config_mode
    Expected:
    • A mode string (e.g., split or unified) telling you where to configure BGP.

    What happened internally: Editing the wrong surface risks your config being regenerated/overwritten on the next reload. This check makes the rest of the lab deterministic.

  2. 2

    Configure the routed interface on sonic-a

    Assign a /31 to Ethernet0 and add a loopback carrying the test prefix.

    SONiC CLI
    sudo config interface ip add Ethernet0 10.0.12.1/31
    SONiC CLItest prefix source
    sudo config interface ip add Loopback1 10.1.1.1/24
    SONiC CLI
    show ip interfaces
    Expected:
    • Ethernet0 shows 10.0.12.1/31; Loopback1 shows 10.1.1.1/24; both oper-up.

    What happened internally: config interface writes intent to CONFIG_DB; managers translate it toward APPL_DB and the interface orchagent programs the router interface toward SAI.

  3. 3

    Configure the peer side

    Mirror the addressing on the second node (SONiC-VS or Linux/FRR).

    SONiC CLIon sonic-b; on Linux/FRR use ip addr add
    sudo config interface ip add Ethernet0 10.0.12.2/31
    Expected:
    • Reachability across the /31: each side can ping the other's interface IP.

    What happened internally: A successful ping here proves the L2 link and interface programming — the substrate BGP will run over.

  4. 4

    Configure eBGP on both sides

    Configure BGP on the surface that owns routing config on each node. The vtysh form below applies where FRR owns config; on unified-mode SONiC, use the SONiC BGP config path instead.

    FRR / vtyshsonic-a (AS 65001); mirror with AS 65002 / 10.2.2.0/24 on the peer
    vtysh -c 'conf t' \
      -c 'router bgp 65001' \
      -c ' neighbor 10.0.12.2 remote-as 65002' \
      -c ' address-family ipv4 unicast' \
      -c '  network 10.1.1.0/24' \
      -c '  neighbor 10.0.12.2 activate' \
      -c ' exit-address-family' \
      -c 'end'
    Expected:
    • Configuration accepted with no errors; neighbor appears in the BGP config.

    What happened internally: bgpd now has neighbor intent and will attempt the TCP session and the BGP FSM toward Established.

  5. 5

    Verify the session and received prefixes

    FRR / vtysh
    vtysh -c 'show ip bgp summary'
    FRR / vtysh
    vtysh -c 'show ip bgp'
    FRR / vtyshthe prefix learned from the peer
    vtysh -c 'show ip route 10.2.2.0/24'
    Expected:
    • Neighbor state Established with a nonzero prefix-received count.
    • The peer's test prefix present in the BGP table and selected into the zebra RIB.

    What happened internally: Established + received prefix confirms the control plane through zebra. This lab intentionally stops at FRR; Lab 2.2 traces the same prefix onward to hardware.

  6. 6

    Save configuration

    SONiC CLIpersist SONiC-owned config
    sudo config save -y
    Expected:
    • config_db.json updated; on FRR-owned nodes also vtysh -c 'write memory'.

    What happened internally: Persistence differs by config mode — save on the surface that owns the config, per your Task 1 finding.

Troubleshooting branches

If: Session stuck in Connect/Active

Then: Verify /31 reachability with ping; confirm remote-as and no ACL/mgmt-vs-data confusion; check both sides activated the address-family.

If: Established but 0 prefixes received

Then: Confirm the peer actually advertises (network/redistribute) and that the origin prefix exists and is up on the peer.

If: Interface won't come up L3

Then: show interfaces status for oper state; confirm the port is not still in a VLAN/L2 config from a prior lab.

Cleanup / rollback
  • Leave the topology in place — Labs 2.2–2.5 build on it. If reverting, restore each node's Lab 1.1 baseline snapshot.

Lab evidence checklist

  • Routing config mode recorded for each node.
  • /31 reachability (ping) captured.
  • BGP summary showing Established + received count captured.
  • Peer test prefix shown in show ip bgp and show ip route.
  • Config saved on the owning surface.

Reflection

  • Where does the received route appear first, and what are the remaining stops before it can forward?
  • How did knowing the config mode change where you entered the BGP configuration?
Lab notes & observations