Module 2 – Lab 4 – Zero Touch Provisioning

The network team was tasked with configuring SONIC on multiple devices using ZTP. They created a configuration file and used a DHCP server. The switches automatically downloaded the configuration file and uploaded the new configuration file to the devices using ZTP. The ZTP saved the Network Team time and effort to prepare the switch to run.

Your task is to configure SONIC to use ZTP. Check DHCP configuration on SW1 switch and upload configuration to the device.  

Step 1: Update DHCP server configuration on SERVER1 to use ZTP service:

There is an existing HTTP/DHCP server SERVER1 in your management network.  
The DHCP/HTTP configuration and ZTP json file is already there. Log in to the SERVER1  
(login credentials: stordis / route2open), and update DHCP configuration to use ZTP service. 

Step 2: Enable ZTP service on SW1 switch:

Enable ZTP service on switch SW1 to start ZTP process. All necessary files to run ZTP are on SERVER1 in directory /etc/www/html/ztp.  

Step 3: Check results of ZTP service on SW1 switch:

Verify config.db configuration has been downloaded correctly by SW1 from server SERVER1. 

  • Default authentication is login: admin passwords: YourPaSsWoRd 
  • ZTP in SONIC is enabled by default after installation. In our lab, ZTP on the switch SW1 is disabled.  
  • You need to use DHCP server to run ZTP  
  • ZTP will start when no startup configuration file (/etc/sonic/config_db.json) is found on the switch. 
      •  

The purpose of this lab is to practice setting up the configuration using the ZTP service on a SONIC NOS switch. Through the exercise, you will learn how to change the DHCP server configuration for the ZTP service, and how to enable the ZTP service on the switch. 

Below is an example of the flow of this lab. 

 

Step 1: Configuration and activation of the ZTP service on SW1 switch:

Check that the startup configuration file (/etc/sonic/config_db.json) is on the switch. If the configuration file existed, then remove it. 

1. admin@sonic:~$ ls /etc/sonic/config_db.json 

2. /etc/sonic/config_db.json 

3. admin@sonic:~$ sudo rm /etc/sonic/config_db.json 

4. admin@sonic:~$ 

 

To enable ZTP use command below: 

1. admin@sonic:~$ sudo ztp enable y 

 

To save the changes and start the SW1 switch with ZTP service, restart the device. 

1. admin@sonic:~$ sudo reboot 

 

Step 2: Check result of ZTP service on SW1 switch: 

Verify the new configuration on the switch SW1 

 

Check the ZTP status of process.  

1. admin@r2osw1:~$ soniccli 

2. r2osw1# show ztp-status 

 

Below are logs from the SW1 with output of show ztp-status command  

 1. Apr 23 18:55:50.173214 System is ready 

 2.   

 3. r2osw1 login: admin 

 4. Password: 

 5. Last login: Fri Apr 22 23:49:11 UTC 2022 on ttyS0 

 6. Linux r2osw1 4.19.092amd64 #1 SMP Debian 4.19.118-2+deb10u1 (2020-06-07) x86_64 

 7. You are on 

 8.   ____   ___  _   _ _  ____ 

 9. / ___| / _ \| \ | (_)/ ___| 

10. \___ \| | | |  \| | | | 

11.   ___) | |_| | || | |___ 

12. |____/ \___/|_| \_|_|\____| 

13.   

14. Software for Open Networking in the Cloud  

15.   

16. Unauthorized access and/or use are prohibited. 

17. All access and/or use are subject to monitoring. 

18.   

19. Help: http://azure.github.io/SONiC/ 

20.   

21. admin@r2osw1:~$ soniccli 

22. r2osw1# show ztp-status 

23. ======================================== 

24. ZTP 

25. ======================================== 

26. ZTP Admin Mode      : True 

27. ZTP Service         : Inactive 

28. ZTP Status          : SUCCESS 

29. ZTP Source          : dhcpopt67 (eth0) 

30. ZTP Runtime         : 08m 58s 

31. ZTP Timestamp       : 20230423 18:55:36 UTC 

32. ZTP JSON Version    : 1.0 

33.   

34.   

35. ——————————————— 

36. 01configdbjson 

37. ——————————————— 

38. Status              : SUCCESS 

39. Runtime             : 03m 12s 

40. Timestamp           : 20230423 18:51:34 UTC 

41. Ignore Result       : False 

42. Halt on Failure     : False 

43.   

44. ——————————————— 

45. 02connectivitycheck 

46. ——————————————— 

47. Status              : SUCCESS 

48. Runtime             : 03s 

49. Timestamp           : 20230423 18:55:36 UTC 

50. Ignore Result       : False 

51. Halt on Failure     : False 

52. r2osw1#  

 

Verify the IP address configuration on port eth0 on switch SW1 after uploading a new configuration by ZTP. 

1. admin@r2osw1:~$ soniccli  

2. r2osw1# configure terminal  

 3. r2osw1(config)# interface Management 0 

 4. sonic(confifeth0)# show configuration 

5. ! 

6. interface Management 0 

7. description Management0 

8. mtu 1500 

9. autoneg on 

10. speed 1000 

11. ip address 10.10.1.66/24 

12. r2osw1(confifeth0)# 

 

In this step, you can also use the show ip interfaces command to display the IP configuration information of the network interfaces. You will see what address has been assigned by the DHCP server. In this case it is 10.10.1.66 

 

1. r2osw1# show ip interfaces 

2. Flags: UUnnumbered interface, AAnycast IP 

3. —————————————————————————————————————- 

4. Interface IP address/mask VRF Admin/Oper Flags 

5. —————————————————————————————————————- 

6. eth0 10.10.1.66/24 up/up 

7. sonic# 

X