SONiC CLI Mastery: Config Commands and Show Monitoring - 夜莺博客

SONiC CLI Mastery: Config Commands and Show Monitoring

SONiC, the open-source network operating system developed by Microsoft and donated to the Open Compute Project, is managed primarily through a Linux-based CLI that feels familiar to anyone who has used a shell. This guide takes you from the first SSH login through management interface configuration, AAA/TACACS+ integration, ACL creation, and static ARP entries, then covers the show commands that give you real-time visibility into uptime, reboot causes, environmentals and interface status. It is a practical foundation for running SONiC in production data centers.

Logging In and Configuring the Management Interface

Log in with ssh admin@<ip> (default password YourPaSsWoRd), then configure the management IP:

sudo config interface ip add Ethernet0 192.0.2.10/24

Use help or ? at any prompt for command assistance.

Configuring AAA and TACACS+

sudo config aaa authentication login tacacs+ local
sudo config tacacs add 10.0.0.1

The first command makes TACACS+ the primary authentication method with the local database as fallback; the second registers the TACACS+ server.

ACL and Static ARP Configuration

sudo config acl add table MyAclTable L3
sudo config acl add rule MyAclTable 10 --src-ip 192.0.2.0/24 --action forward
sudo config arp add 192.0.2.1 00:0a:95:9d:68:16

Monitoring with Show Commands

show system uptime
show reboot-cause
show environment
show interface status
show ip bgp summary
show runningconfiguration

show reboot-cause explains why the switch rebooted, show environment reports temperature, fan speed and power supply status, and interface status output verifies link and speed per port. Since SONiC stores configuration in a JSON database (config_db.json), the CLI commands above are the safe, supported way to change it.

Related: SONiC troubleshooting guide, MLNX-OS breakout cable troubleshooting, and ONIE and Onyx MLNX-OS install.

原文链接:https://stordis.com/mastering-the-community-sonic-command-line-interface-a-comprehensive-guide/