SONiC (Software for Open Networking in the Cloud) is a modular, container-based network operating system originally developed by Microsoft and now under the Linux Foundation. It is adopted widely across hyperscale cloud providers, AI clusters, and modern data centers.
At the heart of SONiC is a clean separation of concerns.
SONiC organizes its data in multiple logical databases each with multiple logical tables. The most important databases are the following.
- Configuration state lives in Redis (
CONFIG_DB) - Operational state reflects Linux into Redis (
STATE_DB) - Intended ASIC state is expressed in Redis (
APPL_DB) - Actual ASIC state is maintained in Redis (
ASIC_DB) - Hardware counters are exposed through Redis (
COUNTERS_DB)
SONiC organizes its computation in multiple containers where each container runs one or more closely related daemon processes.
- Manager daemons translate configuration → Linux
- orchagent translates Linux/intent → SAI operations
- syncd programs the ASIC through the SAI vendor implementation
SAI refers to Switch Abstraction Interface.
SONiC’s design forms a deterministic pipeline: User intent → Linux kernel state → ASIC programming → operational monitoring.
This document is a conceptual, end-to-end walkthrough of that pipeline. It explains:
- How configuration enters SONiC via CLI, REST, or gNMI
- How that configuration becomes Redis state
- How manager daemons (*mgrd) apply configuration to Linux
- How Linux state propagates upward via netlink
- How orchagent consumes Redis and programs ASIC objects via SAI
- How syncd applies SAI operations inside the vendor SDK to the ASIC
- How counters, MAC learning, and link events travel up the stack
- How to debug issues at each hop
We focus on five practical use cases that stress the full stack:
- Port VLAN configuration (top → bottom)
- BGP route installation (top → bottom)
- MAC learning (bottom → up)
- Hardware counters (bottom → up)
- Port state changes (bottom → up)
Each use case includes Redis tables, schemas, Linux commands, netlink flows, orchagent logic, and SAI/ASIC details.
At the end of the document, appendices provide deeper background on:
- Linux netlink (with a fully annotated C++ example)
- Redis usage patterns inside SONiC
- libswsscommon APIs used by SONiC daemons with C++ examples
- SAI primer with C snippets
This is intended to be a mix of introduction, architecture overview, and tutorial-style narrative for SONiC understanding.