DHCP ZTP

DHCP ZTP


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.


DHCP Configuration


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:

#!/bin/bash
And for Python3:
#!/usr/bin/python3

ZPE options:


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)



Troubleshooting:


ZTP logs are in /var/zpt/ztp.log



ZTP with the S/N of the Nodegrid appliance

In this section, we are going to see how we can leverage an additional field, received in the DHCP exchange: the appliance's S/N. 

Indeed, the S/N appears in the DORA exchange, between the DHCP server (ZTP server) and the DHCP client (the new Nodegrid unit to deploy): 


The purpose of using the S/N is to be able to differentiate the config files to apply in ZTP, depending on the unit deployed. While the firmware and the script file (note: the script file is for passwords change mainly) are usually identical regardless of the unit deployed, the configuration file can change significantly from one unit to another. 

Configuration: 
In the dhcpd.conf (located at /etc/dhcp), you have to modify the "subnet" section (the section right after the statement "discovery-rules no;"), the following way: 

[...]
discovery-rules no;

set serial_number = suffix(option vendor-class-identifier, 9);

subnet 10.X.Y.Z netmask 255.255.255.X {
#range low_ip high_ip;
        option domain-name "";
        option routers 10.X.Y.Z;
        default-lease-time 86400;
        max-lease-time 86400;
        range 10.X.Y.Z 10.X.Y.Z;
        if option vendor-class-identifier ~~ concat(".*",serial_number,"\.cli$") {
               option zpe.ztp-config-filename concat(serial_number,".cli");
        }
}

The network engineer has to prepare, beforehand, the various config files "serial_number.cli", and store them in the ZTP server's datastore. In the present case, it was only the 234131424.cli  (cf the S/N captured, as shown in the screen shot above). During the DHCP exchange, the ZTP server gets the S/N, and automatically attributes the file "serial_number.cli" for application. 

    • Related Articles

    • DHCP Server Lease Management

      Nodegrid version 5.10.x provides better visibility into your DHCP network and offers a new feature ease management of your DHCP network. You can find these improvements under Tracking-->Network-->DHCP. The DHCP section here is now split between ...
    • Creating a DHCP server on Interface BACKPLANE0 in Nodegrid

      To configure and enable the DHCP server in Nodegrid Manager: 1. Add a subnet From the Web UI: Click on the Network icon and select DHCP from the menu bar Click Add to create a DHCP range Click on Add and fill in the Subnet, Network and Router IP ...
    • DHCP request to the Server

      After reboot, Nodegrid sends DHCP requests and wait up to 30sec to receive a lease from a server. If that time expires (i.e. no lease assigned), Nodegrid assigns static IP 192.168.160.10 to eth0 or 192.168.161.10 to eth1 so the users have a way to ...
    • Zero Touch Provisioning (ZTP) using USB

      Description: Zero Touch Provisioning using the USB drive is a process that allows the self provisioning to be automated with files created in the USB. The ZTP will fully configured a Nodegrid to a functional states which allows users access to the ...
    • HowTo: Install Nodegrid via PXE Boot

      PXE Boot Setup for ZPE Nodegrid Console Servers Overview This guide describes how to set up PXE (Pre-boot eXecution Environment) network booting for ZPE Nodegrid Console Servers. Both Legacy BIOS and UEFI boot modes are supported. PXE boot allows ...