Skip to content

Command Reference

Jeff Yin edited this page Nov 20, 2019 · 80 revisions

Introduction

The CLI provides an industry-standard way of configuring various functions of the switch. This page 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 explained in the YANG Object Reference.

Starting the CLI

  1. Login to the switch and execute docker exec -it mgmt-framework bash to get into the mgmt container.
  2. Execute “clish_start” from the mgmt container launch CLISH, using /usr/sbin/cli/clish_start

Basic configuration and show

show system status

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

show system

show system — Displays host name, current time, boot time, and other system details.

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

show system memory

show system memory — Displays memory usage and availability information.

sonic# show system memory
-----------------------------------------------------------
Attribute            Value/State
-----------------------------------------------------------
Used                :1304976
Total               :8162872

show system cpu

show system cpu — Displays CPU usage details per core and consolidated CPU usage.

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

show system processes

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

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

show system processes pid

show system processes pid <pid> — Displays detailed information of a specified process.

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

Show platform status

show platform syseeprom

show platform syseeprom — Displays available system EEPROM data.

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.

ACL show commands

show ip access-lists

show ip access-lists [ACL-table-name] — Displays a list of inbound/outbound ACL tables.

# 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

Display 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

show ip access-group — Displays IP access-group information.

# show ip access-group
Ingress IP access-list ACL1 on Ethernet0
Egress IP access-list ACL3 on Ethernet4

ACL configuration commands

ip access-list

ip access-list [ACL-table-name] — Configure an access-list table.

sonic# config t
sonic(config)# ip access-list ACL4
Success

ACL rule configuration

Configure transport control protocol (TCP) ACL rule

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 }

sonic# config t
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
sonic(config-ipv4-acl)# seq 2 permit tcp any any dst-eq 24
Success

Configure user datagram protocol (UDP) ACL rule

seq <id> { permit | deny } [ udp ] [ src-prefix | any] { src-eq <src-port> } [ dst-prefix | any ] { dst-eq <dst-port> } { dscp <value> }

sonic(config-ipv4-acl)# seq 2 permit udp any any
Success

Configure Internet control message protocol (ICMP) or protocol number ACL rule

seq <id> [permit | deny] [icmp | protocol-number] [src-prefix | any] {dscp <value>}

sonic(config-ipv4-acl)# seq 1 permit icmp 3.3.3.3/24 5.5.5.5/24 dscp 10
Success
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

no seq <id> — Remove access-list rule.

sonic(config-ipv4-acl)# no seq 1
Success

ACL table deletion

no ip access-list [ACL-table-name] — Remove access-list.

sonic(config)# no ip access-list test-acl1

ip access-group

ip access-group access-list-name {in | out} — Apply an IPv4 ACL to a Layer 3 interface.

Apply an IPv4 ACL named ip-acl1 to the Layer 3 Ethernet interface 0

sonic# config t
sonic(config)# interface Ethernet 0
sonic(conf-if-Ethernet0)# ip access-group ip-acl1 in

Apply Egress IPv4 ACL to an Ethernet interface 4

sonic(config)# interface Ethernet 4
sonic(conf-if-Ethernet4)# ip access-group test5-out1 out

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

Auto-neg config/un-config is not supported.

show interface status

show interface status — Displays a brief summary of the interfaces.

#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

show interface Ethernet <id> — Displays details about a specific interface.

#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

show interface Ethernet — Displays details about all physical interfaces.

#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

show interface counters — Displays port statistics of all physical interfaces.

#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

interface Ethernet <id> — Specifies the interface to be configured and places you in INTERFACE mode.

SONiC(config)# interface Ethernet 4

shutdown

shutdown | no shutdown — Activates or deactivates an interface.

SONiC(config)# interface Ethernet 4
SONiC(conf-if-Ethernet4)# no shutdown
Success
SONiC(conf-if-Ethernet4)# shutdown
Success

mtu

mtu <val> | no mtu — Configures the maximum transmission unit (MTU) size of the interface in bytes.

SONiC(config)# interface Ethernet 4
SONiC(conf-if-Ethernet4)# mtu 2500
Success
SONiC(conf-if-Ethernet4)# no mtu
Success

description

description <string> | no description — Provides a text-based description of an interface.

SONiC(config)# interface Ethernet 4
SONiC(conf-if-Ethernet4)# description sonic
Success
SONiC(conf-if-Ethernet4)# no description
Success

ip address

ip address <ip-address with mask> | no ip address <ip-address> — Configures an IPv4 address of the interface.

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

ipv6 address <ipv6-address with mask> | no ipv6 address <ipv6-address> — Configures the IPv6 address of the interface.

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 lldp table — Displays the LLDP table.

SONiC only supports one neighbor per interface.

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

show lldp neighbors — Displays LLDP neighbor information.

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#

show lldp neighbors

show lldp neighbors <if-name> — Displays LLDP neighbor information including interface.

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#