Configuration Management
This section describes the steps to save and manage the configuration files on the SONiC switch.
Save Startup-Config
Follow the step below to save the config DB configuration into default /etc/sonic/config_db.json.
|
Step |
Command |
Description |
|---|---|---|
|
1 |
config save [-y | --yes] [<filename>] sudo config save –y |
Save the running configuration to be part of startup configuration. |
The example below shows the commands used to save startup config in default file.
|
admin@sonic:~$ sudo config save -y |
|
|
Running command: /usr/local/bin/sonic-cfggen -d --print-data > /etc/sonic/config_db.json |
|
|
admin@sonic: ~$ sudo reboot |
Note: Truncated output is added here. |
|
requested COLD shutdown |
|
|
/var/log: 205.9 MiB (215916544 bytes) trimmed on /dev/loop1 |
|
|
Tue 30 Nov 2021 02:16:00 PM UTC Issuing OS-level reboot ... |
|
Save Running Configuration to File
Follow the step below to save the config DB configuration into the user-specified filename.
|
Step |
Command |
Description |
|---|---|---|
|
1 |
config save [-y | --yes] [<filename>] sudo config save -y /etc/sonic/config2.json |
Save the running configuration to the filename mentioned.
|
The example below shows the commands used to write existing switch configuration to a file.
|
admin@sonic: ~$ sudo config save -y /etc/sonic/config2.json |
|
Running command: /usr/local/bin/sonic-cfggen -d --print-data > /etc/sonic/config2.json |
Erase Startup-Config
Follow the steps below to erase the existing config DB configuration and store the default configuration into /etc/sonic/config_db.json.
|
Step |
Command |
Description |
|---|---|---|
|
1 |
sudo rm /etc/sonic/config_db.json |
Remove /etc/sonic/config_db.json. |
|
2 |
sudo config-setup factory |
Generate the factory default configuration. |
|
3 |
sudo reboot |
Restore the default configuration file on /etc/sonic/config_db.json. |
The example below shows the commands used to erase the startup config.
|
admin@sonic: ~$ sudo rm /etc/sonic/config_db.json |
|
admin@sonic: ~$ sudo config-setup factory |
|
admin@sonic: ~$ sudo reboot |
Reset-to-Factory Defaults
Follow the step below to reset the switch to its factory default configuration.
|
Step |
Command |
Description |
|---|---|---|
|
1 |
sudo config system reset-to-factory |
Reset the switch to its factory default configuration. |
The example below shows the command used to reset the switch to its factory default configuration.
|
admin@sonic: ~$ sudo config system reset-to-factory |
|
This command will reset settings to factory defaults. After resetting to factory defaults, all configs will be lost and switch will be reloaded immediately. Do you really want to execute this command and reload the switch? [y/N]: y |
Boot-up Options
Follow the step below to display the images installed on the device.
|
Step |
Command |
Description |
|---|---|---|
|
1 |
show boot |
Display the images installed on the device. |
The example below shows the commands used to display the current boot options.
|
admin@sonic:~$ show boot |
|
Current: SONiC-OS-Supermicro_sse-g3748_3.2.0-0011 |
|
Next: SONiC-OS-Supermicro_sse-g3748_3.2.0-0011 |
|
Available: |
|
SONiC-OS-Supermicro_sse-g3748_3.2.0-0011 |
|
|
|
admin@sonic:~$ |
Warm Reboot
Follow the step below to warm reboot of the device.
|
Step |
Command |
Description |
|---|---|---|
|
1 |
sudo warm-reboot |
Initiate a warm reboot of the device. |
The example below shows the commands used to initiate a warm reboot of the device.
|
admin@sonic:~$ sudo warm-reboot -v |
|
Wed 21 Jul 2021 07:13:34 PM UTC Saving counters folder before warmboot... |
|
cat: /host/grub/grub.cfg: No such file or directory |
|
Wed 21 Jul 2021 07:13:35 PM UTC warm-reboot failure (1) cleanup ... |
|
Wed 21 Jul 2021 07:13:37 PM UTC Cancel warm-reboot: code (0) |
|
admin@sonic:~$ |