Zero Touch Provisioning
Zero Touch Provisioning installs or upgrades the software automatically on your new Juniper Networks devices with minimal manual intervention.
Zero Touch Provisioning Overview
Zero Touch Provisioning (ZTP) allows you to provision new Juniper Networks devices in your network automatically, with minimal manual intervention. You can use either management ports or network ports, depending on your device, to connect to the network. When you physically connect a device to the network and boot it with a default factory configuration, the device upgrades (or downgrades) the software release and autoinstalls a configuration file from the network. The configuration file can be a configuration or a script. Using scripts, you can create device-specific configuration files and perform HTTP request operations to web servers to download specific configuration files or software releases.
To locate the necessary software image and configuration files on the network, the device uses information that you have configured on a Dynamic Host Configuration Protocol (DHCP) server. If you do not configure the DHCP server to provide this information, the device boots with the preinstalled software and default factory configuration.
For Junos OS Evolved, Zero Touch Provisioning (ZTP) dynamically detects the port speed of WAN interfaces and uses this information to create ZTP server ports with the same speed. Devices running Junos OS Evolved support automation of the device configuration and software upgrade over the management interface of Routing Engine 0 (RE0) or over WAN interfaces.
Pre-Upgrade Scripts
You can use pre-upgrade scripts to perform any pre-provisioning tasks before ZTP upgrades any software images or configuration files. We support Bash, shell, and Python 3 scripts.
Some pre-provisioning tasks include:
-
Downloading signing keys or certificates for your third-party applications, and installing them on the device.
-
Specifying the management and WAN interface names and the speed of the WAN interfaces.
ZTP uses this information to avoid cycling through the unnecessary speed groups where the interface does not reside.
-
Toggling between using DHCPv4 option 43 suboption 5 as an FTP IP address and an HTTP port.
You can also use a pre-upgrade script to improve the convergence time
of ZTP. Create a file with the name of dhcp_interface
in the
/var/tmp
directory that contains the names of management interfaces, and
the names and speeds for WAN interfaces and reference this file in the pre-upgrade script.
Speed is optional for management interfaces. ZTP uses this information to avoid cycling
through the unnecessary speed groups where the interface does not reside. If there is an
interface failure, ZTP will only retry the failed interface up to five times. This process
improves convergence time because ZTP isn't cycling through interfaces that aren't required.
Here are some examples of the format for specifying the interface names and speeds in the pre-upgrade script.
For a WAN interface:
INTERFACE = <interface name> SPEED = <speed>
For a management interface:
INTERFACE = mgmt
Here is an example that shows the name of a WAN interface and its speed:
INTERFACE = et-0/0/1 SPEED = 4x25G
In the pre-upgrade script, you can specify whether DHCPv4 option 43
suboption 5 is used as an FTP IP address or an HTTP port. To use DHCPv4 option 43 suboption
5 as an HTTP port, create a file with the name of http_port
in the
/var/tmp/
directory. When the pre-upgrade script executes, and ZTP
discovers that there is an http_port
file located in the
/var/tmp/
directory, DHCPv4 option 43 suboption 5 is used as an HTTP
port. This port is used to download any software images or configuration files. If ZTP does
not discover this file, DHCPv4 option 43 suboption 5 is used as an FTP IP address, and uses
this address to download any software images or configuration files. This improvement leads
to faster convergence.
You can use DHCP option 43 suboption 9 for DHCPv4 and DHCP option 17 suboption 9 for DHCPv6 to specify the name of your pre-upgrade script as part of the bootstrap information.
To see which platforms support ZTP, in a browser, go to Feature Explorer. In the Explore Features section of the Feature Explorer page, select All Features. In the Features Grouped by Feature Family box, select Zero Touch Provisioning. You can also type the name of the feature in the Search for Features edit box. See the Release History Table at the end of this topic for more details of how ZTP support has expanded.
- ZTP Workflow
- Provisioning a Device Using a Script
- Zero Touch Provisioning Restart Process Triggers
- Zero Touch Provisioning on PTX10008 Routers running Junos OS Evolved
ZTP Workflow
When a device boots up with the default configuration, the following events take place:
-
DHCP client is run on supported interfaces.
-
DHCP server provisions an IP address and includes several DHCP options in the reply related to the ZTP process.
-
The device processes the DHCP options and locates configuration files, executes scripts, and upgrades and/or downgrades software.
-
If both the image and configuration files are present, the image is installed and the configuration is applied.
-
If only the image file is present, the image is installed on the device.
-
If the image is the same as the image already installed on the device, ZTP continues and skips the installation step.
-
If the image was unable to be fetched by the device, ZTP will try to fetch the image again.
-
If the image is corrupted, installation fails.
If installation fails for any reason, ZTP will retry on other interfaces.
-
If only the configuration file is present, the configuration is downloaded.
If the first line of the file consists of the #! characters followed by an interpreter path, then the file is considered a script, and the script is executed by the interpreter. If the script returns an error, ZTP will retry on other interfaces.
If the configuration file is unable to be downloaded, the ZTP process will try to download it again.
If the configuration file is corrupted, has syntax errors, or includes commands that are unsupported by the device, the device will be unable to commit, and ZTP will retry on other interfaces.
-
If there is no image or configuration file, ZTP will retry on other interfaces.
-
If there is no file server information, ZTP will retry on other interfaces.
-
Once the configuration is committed, the ZTP process is deemed successful and terminates.
Provisioning a Device Using a Script
During the ZTP process, when you connect and boot a new networking device, the device requests an IP address from the DHCP server. The server provides the IP address, and if configured, the filenames and locations for the software image and configuration file for the device. The configuration file can be a configuration or a script.
If a configuration file is provided, the operating system determines if the file is a
script based on the first line of the file. If the first line contains the characters
#!
followed by an interpreter path, the operating system treats the file
as a script and executes it with the specified interpreter.
If the script returns an error (that is, a nonzero value), ZTP will retry on other interfaces.
Table 1 outlines the supported script types, the corresponding interpreter path, and the platforms that support that script type during the ZTP process.
Script Type |
Interpreter Path |
Platform Support |
---|---|---|
Shell script |
|
All devices |
SLAX script |
|
All devices |
Python script |
|
Devices running Junos OS with Enhanced Automation Devices running Junos OS Evolved |
For security reasons, Junos OS has strict requirements for running unsigned Python scripts on devices running Junos OS. Only devices running Junos OS with Enhanced Automation and devices running Junos OS Evolved support using unsigned Python scripts in DHCP option 43 suboption 01.
If the operating system does not find the characters #!
followed by an
interpreter path, it treats the file as a configuration in text format and loads the
configuration on the device.
Zero Touch Provisioning Restart Process Triggers
ZTP restarts when any of the following events occur:
-
Request for configuration file, script file, or image file fails.
-
Configuration file is incorrect, and commit fails.
-
No configuration file and no image file is available.
-
Image file is corrupted, and installation fails.
-
No file server information is available.
-
DHCP server does not have valid ZTP parameters configured.
-
When none of the DHCP client interfaces goes to a bound state.
-
On Junos OS Evolved devices, if downloading a file fails, ZTP restarts.
When any of these events occur, ZTP resets the DHCP client state machine on all of the DHCP client-configured interfaces (management and network) and then restarts the state machine. Restarting the state machine enables the DHCP client to get the latest DHCP server-configured parameters.
Before ZTP restarts, approximately 15 to 30 seconds must elapse to allow enough time to build a list of bound and unbound DHCP client interfaces.
The list of bound and unbound DHCP client interfaces can contain:
-
No entries.
-
Multiple DHCP client interfaces.
Priority is given to the DHCP client interfaces that have received all ZTP parameters (software image file, configuration file, and file server information) from the DHCP server.
ZTP attempts to download the software image and configuration files from the file server. If that download fails, ZTP clears the DHCP client binding on that interface and restarts the state machine on other interfaces.
The ZTP restart process continues until there is either a successful software upgrade, or an operator manually commits a user configuration and deletes the ZTP configuration.
Zero Touch Provisioning on PTX10008 Routers running Junos OS Evolved
Zero Touch Provisioning (ZTP) allows you to provision your router in your network automatically, with minimal manual intervention. Starting in Junos OS Evolved Release 20.1R1, the PTX10008 devices support automation of the device configuration and software upgrade over the management interface of Routing Engine 0 (RE0).
ZTP is enabled on the PTX10008 device in the factory default mode. You can connect the
management interface (re0:mgmt-0) to a network with a Dynamic Host Configuration Protocol
(DHCP) server, and then add ZTP configuration to the DHCP server. Use the show
interfaces re0:mgmt-0
command on the PTX10008 device to find the MAC address of
the interface to use on the DHCP server configuration.
When the PTX10008 device is able to contact the DHCP server and retrieve ZTP parameters, it performs the following ZTP operations based on these parameters:
-
Fetches the specified image and/or configuration file using the specified protocol.
-
If an image is specified, ZTP installs the image on both Routing Engines and reboots the device.
-
If a configuration file is specified:
-
If the file is a Junos configuration, ZTP applies the configuration on the device.
-
If the file is a script, ZTP executes the script on the device.
-
Zero Touch Provisioning Using DHCP Options
Zero Touch Provisioning (ZTP) allows for automatic provisioning of Juniper Network devices that you add to your network. You can provision any supported device by using either a script to be executed or a configuration file to be loaded. You will also need to configure a DHCP server with required information, which is provided in this procedure, to use ZTP.
ZTP requires that your device is in a factory default state. The device from the
factory boots with preinstalled software and factory default configuration. On a
device that does not currently have the factory default configuration, you can issue
the request system zeroize
command.
Before you begin:
-
Ensure that the device has access to the following network resources:
-
The DHCP server that provides the location of the software image and configuration files on the network
Refer to your DHCP server documentation for configuration instructions.
-
The File Transfer Protocol (anonymous FTP), Hypertext Transfer Protocol (HTTP), or Hypertext Transfer Protocol Secure (HTTPS), or Trivial File Transfer Protocol (TFTP) server on which the software image and configuration files are stored
Note:Although TFTP is supported, we recommend that you use FTP or HTTP instead, because these transport protocols are more reliable.
CAUTION:HTTP URLs are limited to 256 characters in length.
-
A Domain Name System (DNS) server to perform reverse DNS lookup (not supported).
-
(Optional) An NTP server to perform time synchronization on the network
-
(Optional) A system log (syslog) server to manage system log messages and alerts.
Syslog messages will be forwarded to this syslog server during ZTP.
-
-
Locate and record the MAC address for your device.
On PTX10008 devices, the management MAC addresses are located on routing engines.
You cannot commit a configuration while the device is performing the software update process. If you commit a configuration while the device is performing the configuration file autoinstallation process, the process stops, and the configuration file is not downloaded from the network.
To enable zero touch provisioning for a device using DHCP options:
Zero Touch Provisioning Using DHCPv6 Options
Zero Touch Provisioning (ZTP) using DHCPv6 options isn't supported on Junos OS Flex images. A Flex image has the word "flex" in the filename. Here is an example filename of a Flex image: jinstall-host-qfx-5e-flex-x86-64-20.4R3.8-secure-signed.tgz.
The DHCPv6 protocol doesn't have a subnet option for the IA_NA (identity association for non-temporary addresses) to learn and install subnet routes. Instead, the subnet route is installed through Neighbor Discovery Protocol.
In IPv6, devices periodically advertise IPv6 prefixes along with other link parameters using Router Advertisement (RA) messages. On the client (Juniper device running ZTP), once the DHCPv6 client is bound, the Neighbor Discovery Protocol (NDP) will learn these prefixes and installs the prefix routes via the client interface, with the next hop as the link to the local address of the gateway device.
On the client device, router advertisement configuration is enabled by default along with the DHCPv6 configuration.
-
Ensure that the device has access to the following network resources:
-
The DHCP server that provides the location of the software image and configuration files on the network
Refer to your DHCP server documentation for configuration instructions.
-
The File Transfer Protocol (anonymous FTP), Trivial File Transfer Protocol (TFTP), Hypertext Transfer Protocol (HTTP) or Hypertext Transfer Protocol Secure (HTTPS) server on which the software image and configuration files are stored.
CAUTION:HTTP URLs are limited to 256 characters in length.
-
-
Locate and record the MAC address printed on the device.
Zero Touch Provisioning (ZTP) allows for automatic provisioning of Juniper Network devices that you add to your network. You can provision any supported device by using either a script to be executed or a configuration file to be loaded.
To use ZTP, you configure a DHCP server to provide the required information. If you
do not configure the DHCP server to provide this information, the device boots with
the preinstalled software and default factory configuration. If your device is not
in a factory default state, you can issue the request system
zeroize
command.
Optionally, you can configure an HTTP proxy server for either the phone-home server or redirect server. When the phone-home client receives information regarding the HTTP proxy server via DHCP option 17 suboption 8, it will create an HTTPS transparent tunnel with the proxy server. Once the tunnel is established, the phone-home client uses the tunnel as a proxy for the phone-home server or redirect server. The phone-home client downloads the software image and configuration file through the tunnel onto the device. Once bootstrapping is complete, the device reboots and the tunnel quits.
Starting in Junos OS Release 20.2R1-S1, the DHCPv6 client is supported the MX-Series, EX3400, EX4300, QFX5100, and QFX5200 switches. Both DHCPv4 and DHCPv6 clients are included as part of the default configuration. During the bootstrap process, the device first uses the DHCPv4 client to request for information regarding image and configuration file from the DHCP server. The device checks the DHCPv4 bindings sequentially. If there is a failure with one of the DHCPv4 bindings, the device will continue to check for bindings until provisioning is successful. If there are no DHCPv4 bindings, however, the device will check for DHCPv6 bindings and follow the same process as for DHCPv4 until the device can be provisioned successfully. The DHCP server uses DHCPv6 options 59 and 17 and applicable sub-options to exchange ZTP-related information between itself and the DHCP client.
You cannot commit a configuration while the device is performing the software update process. If you commit a configuration while the device is performing the configuration file autoinstallation process, the process stops, and the configuration file is not downloaded from the network.
To use zero touch provisioning for a device using DHCPv6 options:
Monitoring Zero Touch Provisioning
You can use the console and operational mode commands to monitor Zero Touch Provisioning.
For Junos OS Evolved, to monitor zero touch provisioning, use the show system ztp operational mode command.
- Using the Console to Monitor Zero Touch Provisioning in Junos OS Evolved
- Using the show dhcp client binding Command
- Using the show dhcpv6 client binding Command
Using the Console to Monitor Zero Touch Provisioning in Junos OS Evolved
Purpose
System log files provide information on the state of the auto-upgrade process, lists of bound and unbound DHCP client interfaces, IP addresses of file servers, names and locations of image and configuration files, and successful and failed attempts at fetching configuration and image files.
Action
Use the information in the console to monitor the auto-upgrade process.
Here is an example of output for Junos OS Evolved.
164.319243] ztp.py[15456]: 2019-07-11 17:54:25 INFO: ZTP: Booted with factory settings set auto-image-upgrade ztp.py[15456]: 2019-07-11 17:54:26 INFO: ZTP: loading config [ 184.456977] ztp.py[15456]: 2019-07-11 17:54:45 INFO: ZTP: Releasing prior dhcp state [ 184.520075] ztp.py[15456]: 2019-07-11 17:54:46 INFO: ZTP: initializing [ 184.520736] ztp.py[15456]: 2019-07-11 17:54:46 INFO: ZTP: Interface vmb0 Watching path /var/db/scripts/ztp/ztpopt.vmb0 [ 184.566657] ztp.py[15456]: 2019-07-11 17:54:46 INFO: ZTP: Interface vmb0v6 Watching path /var/db/scripts/ztp/ztpopt6.vmb0 [ 184.603976] ztp.py[15456]: 2019-07-11 17:54:46 INFO: ZTP: remove "chassis auto-image-upgrade" from config to abort ZTP [ 184.605897] ztp.py[15456]: 2019-07-11 17:54:46 INFO: ZTP: send DHCP discover on interface vmb0 [ 184.606083] ztp.py[15456]: 2019-07-11 17:54:46 INFO: ZTP: send DHCP discover on interface vmb0v6 [ 205.043925] ztp.py[15456]: 2019-07-11 17:55:06 INFO: ZTP: loading options config [ 225.528749] ztp.py[15456]: 2019-07-11 17:55:27 INFO: ZTP:(vmb0) Running: ['/sbin/dhclient', '-1', '-v', 'vmb0', '-cf', '/var /db/scripts/ztp/dhclient.conf', '-pf', '/var/db/scripts/ztp/vmb0.pid4'] [ 227.349638] ztp.py[15456]: 2019-07-11 17:55:28 INFO: ZTP: loading options config [ 248.512666] ztp.py[15456]: 2019-07-11 17:55:50 INFO: ZTP:(vmb0) Running: ['/sbin/dhclient', '-6', '-D', 'LL', '-1', '-v', 'v mb0', '-cf', '/var/db/scripts/ztp/dhclient6.conf', '-pf', '/var/db/scripts/ztp/vmb0.pid6'] [ 309.448411] ztp.py[15456]: 2019-07-11 17:56:50 ERROR: ZTP:(vmb0v6) Unable to get DhcpInfo [ 309.452340] ztp.py[15456]: 2019-07-11 17:56:50 INFO: ZTP: intf vmb0 ipaddr is 10.10.213.111 [ 309.453114] ztp.py[15456]: 2019-07-11 17:56:50 INFO: ZTP: intf vmb0 subnetmask is 255.255.255.0 [ 309.453379] ztp.py[15456]: 2019-07-11 17:56:50 INFO: ZTP: intf vmb0 option150addr is 10.10.213.1 [ 309.453619] ztp.py[15456]: 2019-07-11 17:56:50 INFO: ZTP: intf vmb0 option66addr is 10.10.213.1 [ 309.453836] ztp.py[15456]: 2019-07-11 17:56:50 INFO: ZTP: intf vmb0 host-name is sw-s3-u8-07 [ 309.454093] ztp.py[15456]: 2019-07-11 17:56:50 INFO: ZTP: intf vmb0 ntp server is ['10.129.255.62'] [ 309.454267] ztp.py[15456]: 2019-07-11 17:56:50 INFO: ZTP: intf vmb0 ntp server is ['10.129.255.62', '10.129.255.63'] [ 309.454451] ztp.py[15456]: 2019-07-11 17:56:50 INFO: ZTP: intf vmb0 log server is 10.10.213.1 [ 309.454673] ztp.py[15456]: 2019-07-11 17:56:50 INFO: ZTP: intf vmb0 image path is /ZTP_IMAGES/junos-evo-install-ptx-chassis-x 86-64-19.4EVO.iso [ 309.454886] ztp.py[15456]: 2019-07-11 17:56:50 INFO: ZTP: intf vmb0 config path is /ZTP_CONFIG/sw-s3-u8-07.cfg [ 309.455217] ztp.py[15456]: 2019-07-11 17:56:50 INFO: ZTP: intf vmb0 transfertype is tftp [ 309.457209] ztp.py[15456]: 2019-07-11 17:56:50 INFO: ZTP: Chose interface vmb0: [ 309.633177] ztp.py[15456]: 2019-07-11 17:56:51 INFO: ZTP: loading options config [ 333.584288] ztp.py[15456]: 2019-07-11 17:57:15 INFO: ZTP: downloading image file/ZTP_IMAGES/junos-evo-install-ptx-chassis-x86 -64-19.4-20190708.2-EVO.iso [ 333.584840] ztp.py[15456]: 2019-07-11 17:57:15 INFO: ZTP: downloading image file local /var/tmp/junos-evo-install-ptx-chassis -x86-64-19.4-20190708.2-EVO.iso [ 554.625986] ztp.py[15456]: No such vrf (None) [ 554.628523] ztp.py[15456]: 2019-07-11 18:00:56 INFO: ZTP: Downloaded image file [ 554.629289] ztp.py[15456]: 2019-07-11 18:00:56 INFO: ZTP: Downloading config file /ZTP_CONFIG/sw-s3-u8-07.cfg [ 555.198176] ztp.py[15456]: No such vrf (None) [ 555.200076] ztp.py[15456]: 2019-07-11 18:00:56 INFO: ZTP: Downloaded config file [ 555.201882] ztp.py[15456]: 2019-07-11 18:00:56 INFO: ZTP: loading options config 577.427218] ztp.py[15456]: 2019-07-11 18:01:18 INFO: ZTP: Upgrading image [ 577.427770] ztp.py[15456]: 2019-07-11 18:01:18 INFO: ZTP: Upgraded image localpath is /var/tmp/junos-evo-install-ptx-chassis-x86-64-19.4EVO.iso [ 577.483927] ztp.py[15456]: 2019-07-11 18:01:19 INFO: ZTP: Installing via CLI (/var/tmp/junos-evo-install-ptx-chassis-x86-64-19.4-20190708.2-EVO.iso) [ 577.484271] ztp.py[15456]: 2019-07-11 18:01:19 INFO: ZTP: Running: ['/usr/sbin/cli', '-c', 'show chassis hardware | display xml | match <name> | match "CB" | count'] [ 577.775918] ztp.py[15456]: 2019-07-11 18:01:19 INFO: ZTP: Dual-RE setup detected [ 577.776130] ztp.py[15456]: 2019-07-11 18:01:19 INFO: ZTP: Checking for second RE [ 577.776894] ztp.py[15456]: 2019-07-11 18:01:19 INFO: ZTP: Running: ['/usr/sbin/cli', '-c', 'show chassis hardware | display xml | match <name> | match "Routing Engine" | count'] [ 577.987278] ztp.py[15456]: 2019-07-11 18:01:19 INFO: Running: ['/usr/sbin/cli', '-c', 'request system software add /var/tmp/junos-evo-install-ptx-chassis-x86-64-19.4EVO.iso | display xml'] [ 738.153925] ztp.py[15456]: 2019-07-11 18:03:59 INFO: ZTP: wait returns: 0 [ 738.154148] ztp.py[15456]: 2019-07-11 18:03:59 INFO: ZTP: Return Code: 0 [ 738.154281] ztp.py[15456]: 2019-07-11 18:03:59 INFO: ZTP: Upgraded image status is 0 [ 738.154749] ztp.py[15456]: 2019-07-11 18:03:59 INFO: ZTP: Upgrade succeeded Rebooting [ 738.155372] ztp.py[15456]: 2019-07-11 18:03:5 Stopping Ethernet Bridge Filtering Tables...
Meaning
The console shows the progress of ZTP.
Using the show dhcp client binding Command
Purpose
Issue the show dhcp client binding
command to display DHCP
client binding information
Action
Issue the show dhcp client binding
command to display the IP
address of the DHCP client, the hardware address of the DHCP client, number of
seconds in which the DHCP client’s IP address lease expires, state of the DHCP
client IP address in the binding table, and the name of the interface that has
active client bindings.
show dhcp client binding
user@device# show dhcp client binding IP address Hardware address Expires State Interface 10.0.0.0 00:22:83:2a:db:dc 0 SELECTING irb.0 10.6.6.13 00:22:83:2a:db:dd 49201 BOUND vme.0 10.0.0.0 00:22:83:2a:db:df 0 SELECTING xe-0/0/0.0 10.0.0.0 00:22:83:2a:db:e0 0 SELECTING xe-0/0/1.0
Meaning
The output of this command shows that there is one client interface that is bound, and that there are three interfaces that are receiving DHCP offers from the DHCP server.
Using the show dhcpv6 client binding Command
Purpose
Issue the show dhcpv6 client binding
command to display DHCP
client binding information
Action
Issue the show dhcp6 client binding
command to display the IP
address of the DHCPv6 client, the hardware address of the DHCPv6 client, number
of seconds in which the DHCPv6 client’s IP address lease expires, state of the
DHCPv6 client IP address in the binding table, and the name of the interface
that has active client bindings.
show dhcpv6 client binding
user@device# show dhcpv6 client binding IP/prefix Expires State ClientType Interface Client DUID 2001:db8::10 57 SELECTING STATEFUL em0.0 LL0x3-54:4b:8c:d3:a2:34 2001:db8::10 46 SELECTING STATEFUL em2.0 LL0x3-54:4b:8c:d3:a2:35 2001:db8::10 38 SELECTING STATEFUL et-0/0/0:0.0 LL0x3-54:4b:8c:d3:a2:3b 2001:db8::10 530 BOUND STATEFUL et-0/0/0:1.0 LL0x3-54:4b:8c:d3:a2:3c
Meaning
The output of this command shows that there is one client interface that is bound, and that there are three interfaces that are receiving DHCPv6 offers from the DHCP server.
Change History Table
Feature support is determined by the platform and release you are using. Use Feature Explorer to determine if a feature is supported on your platform.