Skip to content

Command Reference

Garrick He edited this page Aug 2, 2019 · 80 revisions

Table of Contents

Introduction

The CLI provides an industry-standard way of configuring various functions of the switch. This document provides a list of supported commands, with a general description of the command, its arguments, and caveats.

REST/gNMI

SONiC may also be configured and administered via a REST API and a gRPC Network Management Interface (gNMI) using YANG data models. Supported data models are documented in the YANG Object Reference.

Basic Configuration and Show

Show System Status

This sub-section explains some set of sub-commands that are used to display the status of various parameters pertaining to the physical state of the network node.

show system

Displays system details like host name, current time and boot time

  • Usage: show system
  • Example:
sonic# show system
-----------------------------------------------------------
Attribute            Value/State
-----------------------------------------------------------
Hostname            :sonic
Boot Time           :1563911113
Current Datetime    :2019-07-24 18:34:43+00:00
Domain Name         :None

  • Example:
Additional examples goes here

show system memory

Display memory usage and availability information

  • Usage: show system memory
  • Example:
sonic# show system memory
-----------------------------------------------------------
Attribute            Value/State
-----------------------------------------------------------
Used                :1304976
Total               :8162872
  • Example:
Additional examples goes here

show system cpu

Displays CPU usage details per core and consolidated CPU usage

  • Usage: show system cpu
  • Example:
sonic# show system cpu
----------------------------------------------------------------------
CPU                 %KERNEL             %USER               %IDLE
----------------------------------------------------------------------
CPU-total            17                   17                   62
CPU-1                17                   17                   62
CPU-2                17                   16                   63
CPU-3                17                   16                   62
CPU-4                17                   17                   61

  • Example:
Additional examples goes here

show system processes

Displays brief information about all the processes running in the host system.

  • Usage: show system processes
  • Example:
sonic# show system processes
--------------------------------------------------------------------------
PID       %CPU      %MEMORY   MEM-USAGE(Bytes)      NAME
--------------------------------------------------------------------------
1          0           0          58761216    /sbin/init
10         0           0          0           [lru-add-drain]
100        0           0          0           [scsi_eh_0]
1000       0           0          409763840   docker
101        0           0          0           [scsi_tmf_0]
10179      0           0          12124160    /bin/bash
102        0           0          0           [scsi_eh_1]
10217      0           0          42135552    python
103        0           0          0           [scsi_tmf_1]
107        0           0          0           [bioset]
10862      0           0          256139264   /usr/sbin/rsyslogd
109        0           0          0           [kworker/3:1H]
11         0           0          0           [watchdog/0]
110        0           0          0           [kworker/2:1H]
11044      0           0          111427584   containerd-shim
11088      0           0          109920256   containerd-shim
111        0           0          0           [kworker/0:1H]
11119      0           0          109920256   containerd-shim
11140      0           0          59592704    /usr/bin/python
11177      0           0          111362048   containerd-shim
112        0           0          0           [kworker/1:1H]
11204      0           0          59600896    /usr/bin/python
11223      0           0          61095936    /usr/bin/python
11272      0           0          189263872   /usr/bin/orchagent
11308      0           0          58249216    /usr/bin/python

  • Example:
Additional examples goes here

show system processes pid

Displays detailed information of a specified process.

  • Usage: show system processes pid <pid>
  • Example:
sonic# show system processes pid 1
-----------------------------------------------------------
Attribute            Value/State
-----------------------------------------------------------
Memory Usage        :58761216
Uptime              :84024
Start Time          :1563911114000000000
Name                :/sbin/init
Args                :None
Pid                 :1
Memory Utilization  :0
Cpu Utilization     :0
Cpu Usage System    :494
Cpu Usage User      :443
  • Example:
Additional examples goes here

Show platform status

show platform syseeprom

Displays available system eeprom data

  • Usage: show platform syseeprom
  • Example:
sonic# show platform syseeprom
-----------------------------------------------------------
Attribute            Value/State
-----------------------------------------------------------
Serial No           :CN0WHY91282983990060A00
Openconfig Alarmsequipment Failure :None
Type                :None
Oper Status         :openconfig-platform-types:ACTIVE
Id                  :S6000-ON
Software Version    :None
Firmware Version    :None
Description         :None
Openconfig Alarmsequipment Mismatch :None
Empty               :False
Hardware Version    :A00
Removable           :False
Memory              :None
Name                :System Eeprom
Mfg Date            :None
Part No             :0WHY91
Location            :Slot 1
Mfg Name            :DELL

ACL Configuration and Show

This section explains the various show commands and configuration commands available for users.

ACL Show Commands

show ip access-lists

Displays list of inbound/outbound ACL tables. If a table-name is given,

  • Usage: show ip access-lists [ACL-table-name]
  • Example to display all ACLs:
# show ip access-lists
ip access-list ACL1
     1 permit icmp 11.1.1.1/32 21.1.1.1/32 dscp 1
     2 deny tcp 11.1.1.2/32 eq 102 21.1.1.2/32 eq 202 fin dscp 2
     3 permit pim 11.1.1.3/32 21.1.1.3/32 dscp 3
     4 deny tcp 11.1.1.4/32 21.1.1.4/32 dscp 4
     5 permit tcp 11.1.1.5/32 21.1.1.5/32 dscp 5
ip access-list ACL2
     1 permit tcp 12.1.1.1/32 eq 101 22.1.1.1/32 eq 201 dscp 1
     2 permit tcp 12.1.1.2/32 eq 102 22.1.1.2/32 eq 202 dscp 2
ip access-list ACL3
     1 permit tcp 0.0.0.0/0 0.0.0.0/0 eq 24

  • Example to display a specific IPv4 ACL:
# show ip access-lists ACL2
ip access-list ACL2
     1 permit tcp 12.1.1.1/32 eq 101 22.1.1.1/32 eq 201 dscp 1
     2 permit tcp 12.1.1.2/32 eq 102 22.1.1.2/32 eq 202 dscp 2

show ip access-group

Displays IP access-group information

  • Usage: show ip access-group
  • Example:
# show ip access-group
Ingress IP access-list ACL1 on Ethernet0
Egress IP access-list ACL3 on Ethernet4

ACL Configuration Commands

ip access-list

Configure an access-list table

  • Usage: ip access-list [ACL-table-name]
  • Example:
sonic# configure terminal
sonic(config)#
sonic(config)# ip access-list ACL4
Success

ACL rule configuration

Configure Transport Control Protocol (TCP) ACL rule

  • Usage: seq <id> { permit | deny } [ tcp ] [ src-prefix | any] { src-eq <src-port> } [ dst-prefix | any ] { dst-eq <dst-port> } { dscp <value> } { fin | syn | rst | psh | ack | urg }
  • Example:
sonic# configure terminal
sonic(config)#
sonic(config)# ip access-list ACL4
Success
sonic(config-ipv4-acl)# seq 1 permit tcp 4.4.4.4/24 5.5.5.5/24 fin ack dst-eq 100
Success

  • Additional example:
sonic(config-ipv4-acl)# seq 2 permit tcp any any dst-eq 24
Success

Configure User Datagram Protocol (UDP) ACL rule

  • Usage: seq <id> { permit | deny } [ udp ] [ src-prefix | any] { src-eq <src-port> } [ dst-prefix | any ] { dst-eq <dst-port> } { dscp <value> }
  • Example:
sonic(config-ipv4-acl)# seq 2 permit udp any any
Success

Configure Internet Control Message Protocol (ICMP) or Protocol Number ACL rule

  • Usage: seq <id> [permit | deny] [icmp | protocol-number] [src-prefix | any] {dscp <value>}
  • Example:
sonic(config-ipv4-acl)# seq 1 permit icmp 3.3.3.3/24 5.5.5.5/24 dscp 10
Success
  • Additional example:
sonic(config-ipv4-acl)# seq 1 deny 103 any any
Success
  • Supported protocol numbers:
    • Internet Control Message Protocol(ICMP) – 1
    • Internet Group Membership Protocol (IGMP) – 2
    • Transmission Control Protocol (TCP) – 6
    • User Datagram Protocol (UDP) – 17
    • Resource Reservation Protocol (RSVP) – 46
    • Generic Routing Encapsulation (GRE) – 47
    • Authentication header (AUTH) – 51
    • Protocol Independent Multicast (PIM) – 103
    • Layer Two Tunneling Protocol v.3 (L2TP) – 115

ACL rule deletion

To remove access list rule

  • Usage: no seq <id>
  • Example:
sonic(config-ipv4-acl)# no seq 1
Success

ACL Table deletion

To remove access list

  • Usage: no ip access-list [ACL-table-name]
  • Example:
sonic(config)# no ip access-list test-acl1

ip access-group

To apply an IPv4 access control list (ACL) to a Layer 3 interface.

  • Usage: ip access-group access-list-name {in | out}
  • Example to apply an IPv4 ACL named ip-acl1 to the Layer 3 Ethernet interface 0
sonic# configure terminal
sonic(config)# interface Ethernet 0
sonic(conf-if-Ethernet0)# ip access-group ip-acl1 in
  • Example to apply Egress IPv4 ACL to an Ethernet interface 4:
sonic(config)# interface Ethernet 4
sonic(conf-if-Ethernet4)# ip access-group test5-out1 out
  • Example to remove an IPv4 ACL named ACL2 from Ethernet interface 4:
sonic(config)# interface Ethernet 4
sonic(conf-if-Ethernet4)# no ip access-group test5-out1 out

Interface configuration and show

Interface Show Commands

Note : Auto-neg config/un-config is not supported

show interface status

Show a brief summary of the interfaces

  • Usage: show interface status
  • Example: show interface status
#show interface status
------------------------------------------------------------------------------------------
Name                Description         Admin          Oper           Speed          MTU
------------------------------------------------------------------------------------------
Ethernet0           -                   up             down           40GB           9100
Ethernet4           -                   up             up             40GB           9100
Ethernet8           -                   up             down           40GB           9100
Ethernet12          Ethernet12          up             down           40GB           9100
Ethernet16          -                   up             down           40GB           9100
Ethernet20          -                   up             down           40GB           9100
Ethernet24          -                   up             down           40GB           9100

show interface Ethernet {id}

Display details about a specific interface.

  • Usage: show interface Ethernet <id>
  • Example: show interface Ethernet 44
#show interface Ethernet 44
Ethernet44 is up, line protocol is down
Hardware is Eth

Interface index is 11
IPV4 address is 44.2.3.4/24
Mode of IPV4 address assignment: MANUAL
IPV6 address is a::e/64
Mode of IPV6 address assignment: MANUAL
IP MTU 9100 bytes
LineSpeed 40GB, Auto-negotiation off
Input statistics:
        0 packets, 0 octets
        0 Multicasts, 0 Broadcasts, 0 Unicasts
        0 error, 0 discarded
Output statistics:
        0 packets, 0 octets
        0 Multicasts, 0 Broadcasts, 0 Unicasts
        0 error, 0 discarded

show interface Ethernet

Display details about all physical interfaces.

  • Usage: show interface Ethernet
  • Example: show interface Ethernet
#show interface Ethernet

Ethernet0 is up, line protocol is down
Hardware is Eth
Interface index is 0
IPV4 address is 10.0.0.0/31
Mode of IPV4 address assignment: MANUAL
Mode of IPV6 address assignment: not-set
IP MTU 9100 bytes
LineSpeed 40GB, Auto-negotiation off
Input statistics:
        0 packets, 0 octets
        0 Multicasts, 0 Broadcasts, 0 Unicasts
        0 error, 0 discarded
Output statistics:
        0 packets, 0 octets
        0 Multicasts, 0 Broadcasts, 0 Unicasts
        0 error, 0 discarded


Ethernet4 is up, line protocol is up
Hardware is Eth
Interface index is 1
IPV4 address is 10.0.0.2/31
Mode of IPV4 address assignment: MANUAL
Mode of IPV6 address assignment: not-set
IP MTU 9100 bytes
LineSpeed 40GB, Auto-negotiation off
Input statistics:
        1054 packets, 141640 octets
        430 Multicasts, 624 Broadcasts, 0 Unicasts
        0 error, 0 discarded
Output statistics:
        434 packets, 102267 octets
        434 Multicasts, 0 Broadcasts, 0 Unicasts
        0 error, 0 discarded


Ethernet8 is up, line protocol is down
Hardware is Eth
Interface index is 2
IPV4 address is 10.0.0.4/31
Mode of IPV4 address assignment: MANUAL
Mode of IPV6 address assignment: not-set
IP MTU 9100 bytes
LineSpeed 40GB, Auto-negotiation off
Input statistics:
        0 packets, 0 octets
        0 Multicasts, 0 Broadcasts, 0 Unicasts
        0 error, 0 discarded
Output statistics:
        0 packets, 0 octets
        0 Multicasts, 0 Broadcasts, 0 Unicasts
        0 error, 0 discarded

show interface counters

Display port-statistics of all physical interfaces.

  • Usage: show interface counters
  • Example: show interface counters
#show interface counters
------------------------------------------------------------------------------------------------
Interface      State     RX_OK     RX_ERR    RX_DRP    TX_OK     TX_ERR    TX_DRP
------------------------------------------------------------------------------------------------
Ethernet0      D         0         0         0         0         0         0
Ethernet4      U         1064      0         0         438       0         0
Ethernet8      D         0         0         0         0         0         0
Ethernet12     D         0         0         0         0         0         0
Ethernet16     D         0         0         0         0         0         0
Ethernet20     D         0         0         0         0         0         0
Ethernet24     D         0         0         0         0         0         0
Ethernet28     D         0         0         0         0         0         0
Ethernet32     U         431       0         0         438       0         0
Ethernet36     D         0         0         0         0         0         0
Ethernet40     D         0         0         0         0         0         0

Interface Configuration Commands

These commands configure parameters for a given physical interface.

interface Ethernet

This command specifies the interface to be configured and puts you into the INTERFACE configuration mode

  • Usage: interface Ethernet <id>
  • Example: interface Ethernet 4
SONiC(config)# interface Ethernet 4

shutdown

This commands activates or deactivates an interface

  • Usage: [no] shutdown
  • Example: shutdown | no shutdown
SONiC(config)# interface Ethernet 4
SONiC(conf-if-Ethernet4)# no shutdown
Success
SONiC(conf-if-Ethernet4)# shutdown
Success

mtu

Configures the Maximum Transmission Unit size of the interface, in bytes.

  • Usage: mtu <val> | no mtu
  • Example: mtu 2500 | no mtu
SONiC(config)# interface Ethernet 4
SONiC(conf-if-Ethernet4)# mtu 2500
Success
SONiC(conf-if-Ethernet4)# no mtu
Success

description

Provides a text-based description of the interface

  • Usage: description <string> | no description
  • Example: description sonic | no description
SONiC(config)# interface Ethernet 4
SONiC(conf-if-Ethernet4)# description sonic
Success
SONiC(conf-if-Ethernet4)# no description
Success

ip address

Configures the IPv4 address of the interface

  • Usage: ip address <ip-address with mask> | no ip address <ip-address>
  • Example: ip address 2.2.2.2/24 | no ip address 2.2.2.2
SONiC(config)# interface Ethernet 4
SONiC(conf-if-Ethernet4)# ip address 2.2.2.2/24
Success
SONiC(conf-if-Ethernet4)# no ip address 2.2.2.2
Success

ipv6 address

Configures the IPv6 address of the interface

  • Usage: ipv6 address <ipv6-address with mask> | no ipv6 address <ipv6-address>
  • Example: ipv6 address a::e/64 | no ipv6 address a::e
SONiC(config)# interface Ethernet 4
SONiC(conf-if-Ethernet4)# ipv6 address a::e/64
Success
SONiC(conf-if-Ethernet4)# no ipv6 address a::e
Success

LLDP show

Show the LLDP table.

Note: Sonic only supports 1 neighbor per interface.

  • Usage show lldp table
  • Example:
sonic# show lldp table
------------------------------------------------------------------------------------------------------
LocalPort           RemoteDevice        RemotePortID        Capability           RemotePortDescr
-------------------------------------------------------------------------------------------------------
Ethernet0           OS10                ethernet1/1/1:1     BOR                 ethernet1/1/1:1
eth0                swtor-b2lab2-1409   ethernet1/1/9       BOR                 ethernet1/1/9

Show LLDP neighbor(s) information

  • Usage show lldp neighbors
  • Example:
sonic# show lldp neighbor
-----------------------------------------------------------
LLDP Neighbors
-----------------------------------------------------------
Interface:   Ethernet0,via: LLDP
  Chassis:
    ChassisID:    34:17:eb:2c:d7:00
    SysName:      OS10
    SysDescr:     Dell EMC Networking OS10 Enterprise.
                  Copyright (c) 1999-2019 by Dell Inc. All Rights Reserved.
                  System Description: OS10 Enterprise.
                  OS Version: 10.4.9999EX.
                  System Type: Z9100-ON
    TTL:          237
    Capability:   MAC_BRIDGE, ON
    Capability:   REPEATER, ON
    Capability:   ROUTER, ON
  Port
    PortID:       ethernet1/1/1:1
    PortDescr:    ethernet1/1/1:1
-----------------------------------------------------------
Interface:   eth0,via: LLDP
  Chassis:
    ChassisID:    e4:f0:04:fe:64:e1
    SysName:      swtor-b2lab2-1409
    SysDescr:     Dell EMC Networking OS10-Enterprise.
                  Copyright (c) 1999-2019 by Dell Inc. All Rights Reserved.
                  System Description: OS10 Enterprise.
                  OS Version: 10.4.3.1.
                  System Type: S4148T-ON
    TTL:          240
    Capability:   MAC_BRIDGE, ON
    Capability:   REPEATER, ON
    Capability:   ROUTER, ON
  Port
    PortID:       ethernet1/1/9
    PortDescr:    ethernet1/1/9
-----------------------------------------------------------

sonic#
  • Usage show lldp neighbors <if-name>
  • Example:
sonic# show lldp neighbor Ethernet0
-----------------------------------------------------------
LLDP Neighbors
-----------------------------------------------------------
Interface:   Ethernet0,via: LLDP
  Chassis:
    ChassisID:    34:17:eb:2c:d7:00
    SysName:      OS10
    SysDescr:     Dell EMC Networking OS10 Enterprise.
                  Copyright (c) 1999-2019 by Dell Inc. All Rights Reserved.
                  System Description: OS10 Enterprise.
                  OS Version: 10.4.9999EX.
                  System Type: Z9100-ON
    TTL:          247
    Capability:   MAC_BRIDGE, ON
    Capability:   REPEATER, ON
    Capability:   ROUTER, ON
  Port
    PortID:       ethernet1/1/1:1
    PortDescr:    ethernet1/1/1:1
-----------------------------------------------------------

sonic#
Clone this wiki locally