4 – SONiC Configuration Management

In this article we will explore how to view and handle running and startup configurations, and restore the switch to factory-default settings. We will cover:

  • Viewing and saving configurations
  • Restoring factory defaults
Running-Configuration

The running-configuration represents the current active configuration in the system.

View Running-Configuration:
sonic# show running-configuration
Example output
SSwitch-1# show running-configuration 
!
factory default profile l3 confirm
core enable
hostname Switch-1
ip arp timeout 1800
ipv6 nd cache expire 1800
kdump enable
kdump memory 0M-2G:256M,2G-4G:256M,4G-8G:384M,8G-:448M
kdump num-dumps 3
ip load-share hash ipv4 ipv4-dst-ip
ip load-share hash ipv4 ipv4-src-ip
ip load-share hash ipv4 ipv4-ip-proto
ip load-share hash ipv4 ipv4-l4-src-port
ip load-share hash ipv4 ipv4-l4-dst-port
ip load-share hash ipv6 ipv6-dst-ip
ip load-share hash ipv6 ipv6-src-ip
ip load-share hash ipv6 ipv6-next-hdr
ip load-share hash ipv6 ipv6-l4-src-port
ip load-share hash ipv6 ipv6-l4-dst-port
mac address-table aging-time 600
 
ip vrf mgmt
! 
!
--more—
!
line vty
 service-policy type qos in oob-qos-policy
!
interface Management0
 description Management0
 mtu 1500
 autoneg on
 speed 1000
 ip address 192.168.2.152/24
!
interface Ethernet0
 mtu 9100
 speed 10000
 unreliable-los auto
 no shutdown
!
interface Ethernet1
--more--
Startup-configuration

The startup-configuration is the configuration that will be applied on the next reboot.  To save the running-configuration use the command:

copy running-configuration startup-configuration
Restoring Factory-Default Configuration                                                    

If you need to reset the switch to its original factory settings, use the following commands.

Warning: This will erase all configurations.

Switch-1# write erase 
Existing switch configuration files except management interface configuration will be removed, continue? [y/N]:y
Configuration erase command will take effect on the next reboot.

You need to reboot the switch after erasing the configuration so it boots on the empty configuration. 

Switch-1# reboot
Notes
  • Running vs Startup Configuration: Running is active immediately, Startup is used on boot.
  • Saving configuration: Always save important changes to avoid losing them after a reboot.