SONiC CLI Cheat Sheet: show, config and Docker Commands - 夜莺博客

SONiC CLI Cheat Sheet: show, config and Docker Commands

SONiC (Software for Open Networking in the Cloud) has a surprisingly simple CLI model: two command families, show and config, with every subcommand abbreviable to three characters. Whether you are checking interface transceiver health, reloading the configuration database, or inspecting BGP neighbors from inside a Docker container, this cheat sheet collects the most-used SONiC commands in one place, based on the Getting Started with SONiC book by r12f.com.

Command Structure and Shortcuts

show <object> [options]
config <object> [options]

All subcommands can be abbreviated to the first three letters, so show interface transceiver error-status becomes show int tra err. Use -h or --help for unfamiliar commands.

Basic System Information

show version
show uptime
show platform summary

Configuration Reload and Save

sudo config reload       # reload config from DB; restarts services (causes network interruption!)
sudo config save -y      # save current config to /etc/sonic/config_db.json

Docker Containers

SONiC runs each subsystem in its own container. Enter a container with docker exec:

docker ps
docker exec -it <container_id> bash

To run a command in all containers, loop over docker ps output:

for id in `docker ps | tail -n +2 | awk '{print $1}'`; do docker top $id; done

Interfaces, MAC, ARP and Routing

show interface status
show interface counters
show interface portchannel
show interface transceiver info
show mac
show arp
show ndp
show ip bgp summary
show ip bgp neighbors [IP]
show ip route
show lldp table
show vlan brief
show acl table
show acl rule

MUX Cable (Dual ToR)

config muxcable mode active Ethernet4
show muxcable status Ethernet4
show muxcable firmware version <port>

Related SONiC Articles on This Site

Combine this with our main SONiC CLI cheat sheet, SONiC packet-drop troubleshooting and SONiC quick start with ONIE.

原文链接:https://r12f.com/sonic-book/1-3-command-cheatsheet.html