DHCP ZTP
ZTP is a kind of extension to DHCP and ZTP relies on DHCP. If a device is ZTP ready, it will have ZTP vendor specific options that you can do when the device boots up or when its DHCP lease is renewed.
The list of options is provided by the manufacturer. Options can include, boot file, firmware upgrade, configuration file to load… These options are loaded when the device contacts the DHCP server for its IP address… or when it’s time to renew its DHCP release.
You will also need to a repository where the iso, configuration file, scripts… will be stored and available for download with either HTTP, HTTPS, FTP, TFTP, SSH or SCP.
Configure a Nodegrid to be a DHCP server (see Knowledge Base for more info).
Nodegrid supports the following options:
#
# Define ZPE vendor specific information option
#
option space zpe;
option zpe.ztp-signature code 1 = text;
option zpe.ztp-server-url code 2 = text;
option zpe.ztp-image-filename code 3 = text;
option zpe.ztp-config-filename code 4 = text;
option zpe.ztp-username code 5 = text;
option zpe.ztp-password code 6 = text;
option zpe.ztp-certificate code 7 = text;
option zpe.ztp-script-filename code 8 = text;
option zpe.ztp-confirm-md5 code 9 = text;
option zpe-encapsulation code 43 = encapsulate zpe;
Once configured as a DHCP server, add the ZPE vendor specific information above to /etc/dhcp/dhcpd.conf before the specified subnet range that you selected when setting up DHCP.
Then depending on what you want to accomplish you can add the ZPE specific option to the IP subnet range.
For example:
In the example above for host link-1 with MAC address e4:1a:2c:01:0e:e0, when the device boots up and after contacting the DHCP server, the following files: set-hostname.cli and init-link-1.sh will be downloaded from the web server: 192.168.101.2 and executed on link-1.
set-hostname.cli would look like:
set /settings/network_settings hostname=LINK-1
commit
For the option ztp-script-filename, the script file needs to have on the first line the standard Linux shebang definition. For example if you have a bash script, the 1st line should be:
|
option space ‘name’ |
defines the list of option available for the space name, which will be in front of each of options |
|
‘name’.ztp-signature |
is for the vendor ZTP process to execute. For |
|
‘name’.ztp-server-url |
URL link to where to download the files for ZTP (HTTP, HTTPS, FTP, TFTP, SSH or SCP) |
|
‘name’.ztp-image-filename |
ISO filename for upgrade |
|
‘name’.ztp-config-filename |
CLI file to execute |
|
‘name’.ztp-username |
Username if needed for ztp-server-url |
|
‘name’.ztp-password |
Password if needed for ztp-server-url |
|
‘name’.ztp-certificate |
Certificate to use if needed for ztp-server-url |
|
‘name’.ztp-script-filename |
Script (Shell, Bash, Python…) to execute |
|
‘name’.ztp-confirm-md5 |
Values can be yes or no. If yes, if the files/scripts… change it will be re-executed. If no, only a file name change in the configuration will permit a re-execution. The default is yes. |
|
‘name’.zpe-encapsulation |
DHCP option code to use (Nodegrid uses DHCP option code 43) |
ZTP logs are in /var/zpt/ztp.log