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/Option | Example | Description |
---|
show version | show version | Display the current SONiC version |
show interfaces | show interfaces | Show information about network interfaces |
show ip | show ip | Display IP address configuration |
show running-config | show running-config | Show the current running configuration |
write memory | write memory | Save the running configuration to startup |
Network Configuration
#
Command/Option | Example | Description |
---|
net show | net show | Display network configuration |
net add | net add interface Ethernet0 address 192.168.1.1/24 | Add IP address to an interface |
net del | net del interface Ethernet0 address 192.168.1.1 | Remove IP address from an interface |
net route | net route add 10.0.0.0/24 via 192.168.1.1 | Add a static route |
net route del | net route del 10.0.0.0/24 | Remove a static route |
VLAN Configuration
#
Command/Option | Example | Description |
---|
vlan | vlan add 10 | Add a VLAN with ID 10 |
vlan show | vlan show | Show VLAN configuration |
vlan del | vlan del 10 | Remove VLAN with ID 10 |
Interface Configuration
#
Command/Option | Example | Description |
---|
interface | interface Ethernet0 | Enter interface configuration mode |
interface Ethernet0 | interface Ethernet0 | Configure Ethernet interface Ethernet0 |
ip address | ip address 192.168.1.1/24 | Set IP address for the interface |
no shutdown | no shutdown | Enable the interface |
shutdown | shutdown | Disable the interface |
Routing Configuration
#
Command/Option | Example | Description |
---|
router ospf | router ospf 1 | Enter OSPF routing configuration mode |
network | network 192.168.1.0/24 area 0 | Configure OSPF network statement |
router bgp | router bgp 65001 | Enter BGP routing configuration mode |
neighbor | neighbor 192.168.1.2 remote-as 65002 | Configure BGP neighbor |
Troubleshooting
#
Command/Option | Example | Description |
---|
ping | ping 8.8.8.8 | Test connectivity to a remote host |
traceroute | traceroute 8.8.8.8 | Trace the route to a remote host |
show log | show log | Display system log |
debug | debug | Enter debug mode for diagnostics |
Management
#
Command/Option | Example | Description |
---|
sonic | sonic | Enter SONiC CLI |
sonic-cfggen | sonic-cfggen -h | Generate and display SONiC configuration |
sonic-boot | sonic-boot | Manage 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.