Configuration Guide
System Configuration Guide
20 min
device upgrade device upgrade the device supports multiple methods to copy version images onto the target device for upgrading copying images using copying images using in this scenario, the device and a file server establish communication the device functions as a tftp client, while the file server operates as a tftp server the objective is to download the version image stored on the server to the device, thereby accomplishing the software version upgrade 1 configure the ip address of the file server, ensuring that the file server and the device are routable 2 use the curl command to retrieve the version image from the tftp server admin\@sonic $ sudo curl f v s o tftp\ //192 168 2 165/asternos1 0 r0100p00t18 bin trying 192 168 2 165 69 getpeername() failed with errno 107 transport endpoint is not connected connected to 192 168 2 165 () port 69 (#0) getpeername() failed with errno 107 transport endpoint is not connected set timeouts for state 0; total 300000, retry 6 maxtry 50 got option=(tsize) value=(928851950) tsize parsed from oack (928851950) got option=(blksize) value=(512) blksize parsed from oack (512) requested (512) got option=(timeout) value=(6) connected for receive set timeouts for state 1; total 0, retry 72 maxtry 50 closing connection 0 admin\@sonic $ ls asternos1 0 r0100p00t18 bin copying images using scp copying images using scp 1 configure the ip address of the file server to ensure that the file server and the device are reachable via routing 2 on the device, use the scp command to complete the download of the version image admin\@sonic $ sudo scp server\@192 168 0 100 /share/ asternos v5 2r001 bin admin\@sonic $ ls asternos v5 2r001 bin copying images using a usb drive copying images using a usb drive this method is suitable when there is no network environment available, and you need to copy the version image to the device typically, the usb port of the device is located on the front panel 1 insert the usb drive containing the system image into the device's usb port 2 execute a command to view the disk name corresponding to the usb drive admin\@sonic $ sudo /sbin/fdisk l 3 create a directory for mounting the usb drive admin\@sonic $ sudo mkdir /mnt/usb/ 4 mount the usb drive take the example of /dev/sdb4 as the path for the usb drive, but please adjust according to the actual situation admin\@sonic $ sudo mount /dev/sdb4 /mnt/usb 5 navigate to the directory of the mounted disk and copy files from the disk to the device admin\@sonic $ cd /mnt/usb admin\@sonic /mnt/usb/$ sudo cp asternos v5 2r001 bin /home/admin admin\@sonic $ ls asternos v5 2r001 bin executing the upgrade command executing the upgrade command operation command description execute the upgrade command image update image name upgrade package storage path /home/admin if a configuration upgrade is required, please execute the "write" command to save the configuration before proceeding with the upgrade once the upgrade is completed without any errors, you'll need to manually restart the device to switch to the new version display the version show version ztp configuration ztp configuration introduction introduction zero touch provisioning (ztp) refers to the automatic loading of initialization files (configuration files, upgrade files) on newly manufactured or blank devices when they are powered on this functionality enables devices to be deployed and configured without requiring on site manual configuration as a result, ztp reduces labor costs and enhances deployment efficiency principle explanation principle explanation as illustrated in the diagram, a device awaiting configuration is connected to a dhcp relay device via its service port or management port upon powering on, the device checks whether a ztp initialization process has been carried out if yes, it loads the system configuration files and starts the device if not, the device enters the ztp initialization process through dhcp during this process, the device operates as a dhcp client and sends dhcp request packets to the dhcp server to obtain an ip address and the path to the required upgrade files based on the configuration information carried in the received dhcp response packet, the device automatically retrieves version and configuration files from the specified file server it then proceeds to execute the upgrade command and reboot the device upon completion of the device reboot, automatic loading of both the version and configuration is achieved dhcp server used to assign temporary management ip addresses to devices and provide the file server address tftp/ftp server stores the configuration files, version images required for ztp initialization, and user logs after upgrades are completed dhcp relay when the device to be upgraded and the dhcp server are in different network segments, a relay device is needed to forward dhcp packets devices can carry their hardware model and serial number in the packets tftp/ftp servers can name version files based on hardware models and name configuration files based on serial numbers, enabling provision of different versions and independent configuration files for devices of various models and serial numbers the workflow of ztp is illustrated in the diagram below configuring the dhcp server configuring the dhcp server the dhcp server passes network configuration parameters to the device through the option field when the device to be configured is not on the same subnet as the dhcp server, a dhcp relay needs to be configured to forward dhcp interaction messages when the device enters the ztp process, both the management port and service port of the device will send dhcpv4 discover messages, carrying option 67 to request the path to the intermediate file required for provisioning dhcp option parameters description dhcp option parameters description option number function option 1 sets the subnet mask for the ip address option 3 sets the gateway for the dhcp client option 6 sets the ip address of the dns server option 67 sets the path to the intermediate file such as ftp\ //ftpserver\ test\@192 168 0 10/ztp json configuring the file server configuring the file server the file server is used to store the files that need to be transferred during the ztp process, including intermediate files, image files, configuration files, and logs generally, a third party server is used as the file server, and during deployment, the network connectivity between the file server and the device must be ensured the file server supports tftp and ftp servers place the intermediate file and other provisioning files in the working directory of the file server and rename the files as specified image file the name should be the device type followed by bin configuration file the name should be the device serial number (sn) followed by bin for example, if the device sn is f020000a055, the configuration file name should be f020000a055 bin intermediate file the file must be named exactly ztp json logs logs generated by the device during the ztp process will be uploaded to the file server after the ztp process is completed or if it fails for some reason, to facilitate troubleshooting note the naming convention for image files and configuration files above is applicable when different types of devices have different version images and different devices load different configuration files if the devices undergoing ztp provisioning need to pull identical image and configuration files, you can also specify the same name as in the intermediate file preparing the configuration file preparing the configuration file ztp provisioning requires the pre preparation of provisioning files, including the configuration file and the intermediate file the configuration file is in json format, which the device loads to generate the configuration after startup the configuration file can be manually written or copied from another device to save the configuration file, execute the write command on the device the configuration file is saved in the /etc/sonic/ directory of the device, named in the format config db json then, export the configuration file using scp or other methods it is important to note that the configuration file must be written strictly in json format and comply with the device's requirements for the configuration file content it is recommended that users export the configuration file and modify it as needed, rather than writing the configuration file directly preparing the intermediate file preparing the intermediate file the intermediate file is used to inform the device about the paths of the version image and configuration file to be fetched, as well as the path where the log files generated during the ztp process need to be uploaded the file must be named ztp json { "ztp" { "01 configdb json" { "dynamic url" { "source" { "prefix" "tftp\ //199 0 0 1/", "identifier" "product name", "suffix" " json" }, "destination" "/etc/sonic/config db json" }, "save config"\ false }, "02 firmware" { "install" { "dynamic url" { "source" { "prefix" "tftp\ //199 0 0 1/", "identifier" "asternos1 0 r0100p00t17", "suffix" " bin" } }, "set default" true } } "03 upload log" { "dynamic upload url" { "destination" { "prefix" "tftp\ //199 0 0 1/", "identifier" "product name", "suffix" " log" } }, "reboot on success" true } } } field meanings field meanings field meaning configdb json prefix the absolute path of the configuration file identifier the configuration file name when the field content is serial number, it indicates that the field will be automatically filled with the device's sn code if there is no need to distinguish between different devices, a fixed configuration file name can be used suffix the file format, which must be json for configuration files firmware prefix the absolute path of the image file identifier the image file name when the field content is product name, it indicates that the field will be automatically filled with the device type if there is no need to distinguish between device types, a fixed name can be used suffix the file format, which must be bin for image files upload log prefix the specified path for uploading logs to the file server identifier the log file name suffix the log file format set default set the image as the default to be loaded at startup reboot on success automatically reboot the device after the ztp process is completed successfully configuration example configuration example network requirements network requirements a certain company has multiple devices that need to be deployed in bulk, upgraded, and configured to save on human resources and streamline the process, they plan to use zero touch provisioning for deployment procedure procedure 1 configure the dhcp server and add an option field to configure the ftp server address option bootfile name ”tftp\ //199 0 0 1/ztp json” 2 create a ztp file in the /ftpboot directory of the ftp server, and provide directory information for the required files during the ztp process { "ztp" { "01 configdb json" { "dynamic url" { "source" { "prefix" "tftp\ //199 0 0 1/", "identifier" "product name", "suffix" " json" }, "destination" "/etc/sonic/config db json" }, "save config"\ false }, "02 firmware" { "install" { "dynamic url" { "source" { "prefix" "tftp\ //199 0 0 1/", "identifier" "asternos1 0 r0100p00t17", "suffix" " bin" } }, "set default" true } } "03 upload log" { "dynamic upload url" { "destination" { "prefix" "tftp\ //199 0 0 1/", "identifier" "product name", "suffix" " log" } }, "reboot on success" true } } } 3 upload the required files to the directory specified in the ztp json file on the ftp server verify configuration verify configuration after device reboot, view device version and configuration sonic# show version sonic# show running config
