Site Search

SONiC Practical Hands-on Seminar Lecture Report Part 2 - Learning the Basics of Open Network OS with White Box Switches -

Introduction
This article is based on a lecture given at the SONiC Practical Hands-on Seminar held on August 26, 2025.
We provide an easy-to-understand introduction to SONiC, from its basic architecture to its command system, even for beginners.


If you would like to download the presentation materials, please refer to the link below.


In Part 1, we systematically introduced SONiC 's architecture, differences between versions, use cases, and installation methods.
In this article, Part 2, we will finally focus on the CLI (Command Line Interface) command system, which is essential for operating SONiC.

SONiC command system

SONiC offers two types of CLI systems, which can be used depending on your purpose and operational style.

1. Standard (Linux-based) CLI

Configuration is performed by directly entering commands in a format familiar to engineers accustomed to using Linux.
For example, to configure the management port, do the following:

admin@sonic:~$ sudo config interface ip add eth0 10.1.1.10/24 10.1.1.1
admin@sonic:~$ config save

*When configuring routing using FRR, operations using a separate CLI system using the VTYSH command are required.

2. Switch Industry Standard (Cisco-like) CLI

It is a CLI system that can be operated using syntax similar to Cisco IOS, making it familiar to network engineers.
Below is an example of the same management port configuration:

admin@sonic:~$ sonic-cli
sonic# config terminal
sonic(config)# interface Management 0
sonic(conf-if-Management0)# ip address 10.1.1.10/24 gwaddr 10.1.1.1
sonic(conf-if-Management0)# no shutdown
sonic(conf-if-Management0)# exit
sonic(config)# exit
sonic# write memory

In this way, SONiC allows operators to flexibly choose a CLI system depending on their skill set and environment.

In this hands-on session, we performed remote access via VPN to the 800G switch "AIS800-64D" manufactured by Edgecore, which is installed in the lab at our Shin-Yokohama office.
VPN settings will not be covered in this article.

Below are some example switch industry standard (Cisco-like) CLI commands:
You can see the commands that can be entered after the Show command in this way. You can use these to check information.

admin@sonic:~$ sonic-cli sonic# show タブキー補完 aaa access-group alarm ars audit-log auditd-system bfd bgp buffer buffer-pool cable-diagnostics class-map clock config config-key config-reload consistency-check copp core crm crypto database dcbx device dropcounters errdisable error-database event evpn hardware histogram hosts image in-memory-logging interface interface-naming ip ipv6 kdump ldap-server link lldp locator-led logging mac mclag mirror-session nat neighbor-suppress-status ntp object-groups pbf platform poe policy-map port-group port-security PortChannel priority-flow-control priority-group ptp qos queue radius-server reboot-cause route-map running-configuration service-policy sflow snmp snmp-server spanning-tree ssh-server storm-control subinterfaces switch-profiles switch-resource switching-mode swsslog-configuration system tacacs-server tam tech-support techsupport-export threshold tpcm udld uptime usb users version Vlan vrrp vrrp6 vxlan warm-restart watermark ztp-status
admin@sonic:~$ sonic-cli
sonic# show version
sonic# show interface status
sonic# show interface counters
sonic# show platform environment
sonic# show vlan
sonic# show running-configuration
sonic# show users
sonic# show uptime

Below are some example SONiC standard (Linux-based) CLI commands:
You can also use the Show command to view the information.

sonic# exit
admin@sonic:~$ show -h
Usage: show [OPTIONS] COMMAND [ARGS]...
  SONiC command line - 'show' command
Options:
  -?, -h, --help  Show this message and exit.
Commands:
  aaa                   Show AAA configuration
  acl                   Show ACL related information
  arp                   Show IP ARP table
  bgp                   Show BGP information
  boot                  Show boot configuration
  buffer                Show buffer information
  buffer_pool           Show details of the buffer pools
  chassis-modules       Show chassis-modules information
  classifier            Show flow based services classifiers related...
  clock                 Show date and time
  config                Show details about configuration profiles available
copp                  Show COPP
  cores                 Show core dump events encountered
  database              Show Redis database information
  debug                 Collect debugging information from components
  dropcounters          Show drop counter related information
  ecn                   Show ECN configuration
  environment           Show environmentals (voltages, fans, temps)
  errdisable            Errdisable information
  error_database        Show ERROR DB entries
  export                show tech-support export configurations
  feature               Show feature status
  fgnhg                 Show FGNHG information
  hardware              Show ASIC related information
  headroom-pool         Show details of headroom pool
  histogram
  hostname              Show hostname
  hosts                 Show nameserver configuration
  in-memory-logging     Show in-memory system log
interfaces            Show details of the network interfaces
  ip                    Show IP (IPv4) commands
  ipv6                  Show IPv6 commands
  kdump                 Show kdump configuration, status and information
  knet                  Show knet info
  kubernetes
  ldap                  Show LDAP configuration
  line                  Show all console lines and their info include...
  linktrack             Show link state tracking information
  lldp                  LLDP (Link Layer Discovery Protocol) information
  locator-led           Show Locator LED State
  logging               Show system log
  mac                   Show MAC (FDB) entries
  management            Show management interface-related information
  management-interface  Show management interface parameters
  management_interface  Show management interface parameters
  mgmt-vrf              Show management VRF attributes
  mirror-session        Show existing everflow sessions

For more details on the Show command, please refer to the following document.

*Reference materials can be found here

GNS3 SONiC VM Access

GNS3 (Graphical Network Simulator 3) is a tool for virtualizing and emulating network devices.
You can experiment with network configurations using a virtual router switch.
This time, we accessed and operated the SONiC virtual machine (VM) on GNS3.


The diagram below shows the connection configuration (network topology) between virtual network devices built on GNS3.
We prepared multiple switches equipped with SONiC and the servers and PC terminals connected to them as virtual machines, and ran commands to configure each switch and terminal and check communication.

The virtual environment is configured as follows:

Now let's take a look at some more detailed SONiC CLI commands.
First, the basic settings.

Check and save the settings

admin@sonic:~$ show runningconfiguration all { "ACL_RULE": { "ipacl|RULE_1": { "PACKET_ACTION": "DROP", "PRIORITY": "65535", "VLAN": "10" (中略) admin@sonic:~$ sudo config save -y Running command: /usr/local/bin/sonic-cfggen -d --print-data > /run/tmpmkko4w73 Running command: mv -f /run/tmpmkko4w73 /etc/sonic/config_db.json Running command: sync;sync;sync 39463 Bytes written admin@sonic:~$

Change host name

admin@sonic:~$ sonic-cli
sonic# configure terminal
sonic(config)# hostname sonic09
sonic(config)#
Broadcast message: Hostname has been changed from 'sonic' to 'sonic09'. Users r
unning 'sonic-cli' are suggested to restart your session.
sonic(config)# exit
sonic# write memory
sonic# exit

Change admin password

admin@sonic:~$ sudo passwd admin
New password: 
Retype new password: 
passwd: password updated successfully

Port speed (group unit) change

admin@sonic:~$ sonic-cli
sonic# show port-group
-------------------------------------------------------------------------------------
Port-group  Interface range            Valid speeds      Default Speed Current Speed
-------------------------------------------------------------------------------------
1           Ethernet0 - Ethernet3      10G, 25G          25G           25G
2           Ethernet4 - Ethernet7      10G, 25G          25G           25G
3           Ethernet8 - Ethernet11     10G, 25G          25G           25G
sonic09# configure
sonic09(config)# port-group 3 speed 10000
sonic09(config)# exit
sonic09# show port-group
-------------------------------------------------------------------------------------
Port-group  Interface range            Valid speeds      Default Speed Current Speed
-------------------------------------------------------------------------------------
1           Ethernet0 - Ethernet3      10G, 25G          25G           25G
2           Ethernet4 - Ethernet7      10G, 25G          25G           25G
3           Ethernet8 - Ethernet11     10G, 25G          25G           10G

Port Enablement

sonic01# show interface status
--------------------------------------------------------------------------------------------------------------------------------------
Name                Description                   Oper        Reason         AutoNeg   Speed          MTU            Alternate Name
--------------------------------------------------------------------------------------------------------------------------------------
Ethernet0           -                             up          oper-up          off       25000          9100           Eth1/1
Ethernet1           -                             down        admin-down       off       25000          9100           Eth1/2
sonic01# configure
sonic01(config)# interface Ethernet 1
sonic01(config-if-Ethernet1)# no shutdown
sonic01(config-if-Ethernet1)# exit
sonic01(config)# exit
sonic01# show interface status
--------------------------------------------------------------------------------------------------------------------------------------
Name                Description                   Oper        Reason         AutoNeg   Speed          MTU            Alternate Name
--------------------------------------------------------------------------------------------------------------------------------------
Ethernet0           -                             up          oper-up          off       25000          9100           Eth1/1
Ethernet1           -                             up          oper-up          off       25000          9100           Eth1/2
Ethernet2           -                             down        admin-down       off       25000          9100           Eth1/3

Ping communication check

linux01:~# ip addr
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 0c:bc:d4:d9:00:00 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::ebc:d4ff:fed9:0/64 scope link
       valid_lft forever preferred_lft forever
3: eth0.10@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
    link/ether 0c:bc:d4:d9:00:00 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.1/24 scope global eth0.10
       valid_lft forever preferred_lft forever
    inet6 fe80::ebc:d4ff:fed9:0/64 scope link
       valid_lft forever preferred_lft forever
linux01:~# ping 192.168.1.2
PING 192.168.1.2 (192.168.1.2): 56 data bytes
64 bytes from 192.168.1.2: seq=0 ttl=64 time=12.270 ms
64 bytes from 192.168.1.2: seq=1 ttl=64 time=8.806 ms
64 bytes from 192.168.1.2: seq=2 ttl=64 time=8.556 ms

If you would like to see use case configuration commands such as VLAN settings, LACP settings, and ACL settings, please refer to the document below.
*Reference materials can be found here

Summary

In this article, we focused on SONiC 's two​ ​CLI systems and introduced everything from basic configuration operations to practical use in a virtual environment using GNS3.
We hope you will also make use of the presentation materials to further improve your SONiC operational skills.


Click here for list of materials

Document list

In addition to introducing products handled by Macnica,
We publish materials related to open networking, such as BGP cross network automatic construction files and network operation test evaluation reports.

Click here for details

Product Page Top

Aviz Networks

We are pioneers of SONiC, an open source network operating system, providing observability, configuration automation tools and support from a team of SONiC experts.

Edgecore Networks

We continue to be a pioneer in open networking by developing and selling products related to OpenNetworking/white Box switches.

IP Infusion

As a market leader among open networking providers, we provide reliable network solutions to over 600 customers, including carriers, service providers, and data centers.

*Download here

Inquiry/Document request

In charge of Macnica Edgecore Networks

Weekdays: 9:00-17:00