Example for Implementing ZTP Deployment through DHCP
Overview
Figure 1. Typical topology of ZTP implementation
In Figure 1, switches are configured respectively as the DHCP client and DHCP server. The client uses information configured on a DHCP server to locate the software image and configuration files on the TFTP server, and then download specified files to upgrade system and load configurations.
The data plan is shown as below:
Device | Interface | VLAN and IP Address |
---|---|---|
DHCP server | te-1/1/1 te-1/1/2 te-1/1/3 | VLAN: 10 IP address: 192.168.10.2/24 |
TFTP server | eth0 | IP address: 192.168.10.1/24 |
The image information of Client1 and Client2, and the files to be loaded are shown as below:
Device | Current version | Files to be loaded |
Client1 | PicOS-9.8.7 | Image: PICOS-9.8.7-main-43d73dd983-x86v.bin Command file: ztpl2l3_cfg.cli |
Client2 | PicOS-4.4.0 |
Procedure
DHCP Server
Step 1 Configure VLAN and interface.
admin@PICOS# set vlans vlan-id 10
admin@ PICOS # set interface gigabit-ethernet te-1/1/1 family ethernet-switching native-vlan-id 10
admin@ PICOS # set interface gigabit-ethernet te-1/1/2 family ethernet-switching native-vlan-id 10
admin@ PICOS # set interface gigabit-ethernet te-1/1/3 family ethernet-switching native-vlan-id 10
admin@ PICOS # set vlans vlan-id 10 l3-interface vlan10
admin@ PICOS # set l3-interface vlan-interface vlan10 address 192.168.10.2 prefix-length 24
admin@ PICOS # commit
Step 2 Configure DHCP pool.
admin@PICOS# set protocols dhcp server pool pool1 network address 192.168.10.2 prefix-length 24
admin@PICOS# set protocols dhcp server pool pool1 lease-time 1440
admin@ PICOS # set protocols dhcp server pool pool1 range range1 low 192.168.10.3
admin@ PICOS # set protocols dhcp server pool pool1 range range1 high 192.168.10.20
admin@ PICOS # set protocols dhcp server pool pool1 tftp-server 192.168.10.1
admin@ PICOS # set protocols dhcp server pool pool1 bootfile-name file-path provision.sh
admin@ PICOS # set ip routing enable true
admin@ PICOS # commit
TFTP Server
Step 1 Set the basic configuration of TFTP server.
Make sure that the TFTP server is network reachable, which can communicate with the DHCP server and DHCP client.
Step 2 Configure files needed to be saved in the TFTP server.
For the provision file provision.sh, you need to run generate_script with options 7 and 10 selected to generate it. For details, see Option Description of Shell Script.
For the L2/L3 command file ztpl2l3_cfg.cli, you can modify it as needed, such as configuring VLAN20 and VLAN30.
Step 3 Save the image file, provision script and L2/L3 command file to the working path of TFTP server.
The working path of TFTP server here is /home/admin/tftp, and you should modify it based on the actual circumstances.
Step 4 Generate the MD5 file.
Enter the directory which saves image file, and run the following Linux command to generate MD5 file. The generated MD5 file will be saved in this directory.
The MD5 file name must be the format of image-file-name.md5, otherwise the DHCP server cannot recognize it.
admin@TFTP:~$ cd /home/admin/tftp
admin@TFTP:~/tftp$ md5sum onie-installer-picos-9.8.7-main-43d73dd983x86v.bin > onie-installer-picos-9.8.7-main-43d73dd983-x86v.bin.md5
Step 5 View the files saved in the directory of /home/admin/tftp.
DHCP Client
After completing the above configuration, start client1 and client2.
Verifying the Configuration
View the upgrade process of client1 and client2.
Client1: for the version is already V9.8.7, it directly loads L2/L3 command configurations.
Client2: for the version is V4.4.0, it upgrades to V9.8.7 and then loads L2/L3 command configurations.
View the L2/L3 command configurations of client1 and client2.
Copyright © 2024 Pica8 Inc. All Rights Reserved.