SONiC

SONiC Cheatsheet #

SONiC is an open-source network operating system for data center switches, designed for flexibility and scalability. This cheatsheet covers essential commands and options for managing and configuring SONiC.

System Commands #

Command/OptionExampleDescription
show versionshow versionDisplay the current SONiC version
show interfacesshow interfacesShow information about network interfaces
show ipshow ipDisplay IP address configuration
show running-configshow running-configShow the current running configuration
write memorywrite memorySave the running configuration to startup

Network Configuration #

Command/OptionExampleDescription
net shownet showDisplay network configuration
net addnet add interface Ethernet0 address 192.168.1.1/24Add IP address to an interface
net delnet del interface Ethernet0 address 192.168.1.1Remove IP address from an interface
net routenet route add 10.0.0.0/24 via 192.168.1.1Add a static route
net route delnet route del 10.0.0.0/24Remove a static route

VLAN Configuration #

Command/OptionExampleDescription
vlanvlan add 10Add a VLAN with ID 10
vlan showvlan showShow VLAN configuration
vlan delvlan del 10Remove VLAN with ID 10

Interface Configuration #

Command/OptionExampleDescription
interfaceinterface Ethernet0Enter interface configuration mode
interface Ethernet0interface Ethernet0Configure Ethernet interface Ethernet0
ip addressip address 192.168.1.1/24Set IP address for the interface
no shutdownno shutdownEnable the interface
shutdownshutdownDisable the interface

Routing Configuration #

Command/OptionExampleDescription
router ospfrouter ospf 1Enter OSPF routing configuration mode
networknetwork 192.168.1.0/24 area 0Configure OSPF network statement
router bgprouter bgp 65001Enter BGP routing configuration mode
neighborneighbor 192.168.1.2 remote-as 65002Configure BGP neighbor

Troubleshooting #

Command/OptionExampleDescription
pingping 8.8.8.8Test connectivity to a remote host
traceroutetraceroute 8.8.8.8Trace the route to a remote host
show logshow logDisplay system log
debugdebugEnter debug mode for diagnostics

Management #

Command/OptionExampleDescription
sonicsonicEnter SONiC CLI
sonic-cfggensonic-cfggen -hGenerate and display SONiC configuration
sonic-bootsonic-bootManage SONiC boot configuration

This cheatsheet covers key commands and configurations for managing and operating SONiC. For detailed information on specific commands and options, refer to the SONiC documentation.

SONiC

Explore our comprehensive cheatsheets to enhance your knowledge and efficiency. Each cheatsheet provides detailed command options, examples, and descriptions to help you master various tools and technologies.