ZTP Manager is a wrapper for the ISC DHCP Server which enables you to do zero-touch provisioning for network devices. The wrapper has a HTTP JSON API for ease of configuration.
This wrapper not only provides automatic configuration generation for the /etc/dhcp/dhcpd.conf
file, but also the /etc/default/isc-dhcp-server
file and initial golden configurations for the devices.
Take a fresh installation of Ubuntu LTS (16.04 / 18.04) and make sure everything is updated.
For docs, take a look here. Here is a YouTube video for the initial release! https://www.youtube.com/watch?v=3Wz4COk-ae4
Installation is super simple. You are required to know the physical interface you wish to servce DHCP on and the server URL for the API. Be sure to change the below line to reflect this. Both configuration items can be found at the end of the line.
curl -sSL https://raw.githubusercontent.com/networkbootstrap/ztpmanager/master/install.sh | bash -s -- --url=ztp.simpledemo.net --iface=ens34
If you take a look at the config.toml
file and you'll see one host already configured. It's possible to initially create hosts here as well as through the JSON API.
NOTE that when creating or deleting resources through the JSON API, you must save afterwards for the configuration change to impact the dhcpd.conf
file!!! This is important!!!
Create Hosts
curl -X POST \
-H 'Content-Type: application/json' \
-H "Authorization: Basic YWRtaW46UGFzc3cwcmQ=" \
-d '{
"ethernetaddress": "00:0c:29:4d:3d:cd",
"fixedipaddress": "192.168.50.101",
"hostname": "demo02",
"vendor": "junos"
}' \
REPLACE_WITH_SERVER_IP:1323/hosts
Delete Hosts
curl -X DELETE -H 'Content-Type: application/json' \
-H "Authorization: Basic YWRtaW46UGFzc3cwcmQ=" \
REPLACE_WITH_SERVER_IP:1323/hosts/REPLACE_WITH_HOST_IP
Get Hosts
curl -X GET -H "Authorization: Basic YWRtaW46UGFzc3cwcmQ=" \
http://REPLACE_WITH_SERVER_IP:1323/hosts
Get Individual Hosts
curl -X GET -H "Authorization: Basic YWRtaW46UGFzc3cwcmQ=" \
http://REPLACE_WITH_SERVER_IP:1323/hosts/REPLACE_WITH_HOST_IP
Save
curl -X POST -H 'Content-Type: application/json' \
-H "Authorization: Basic YWRtaW46UGFzc3cwcmQ=" \
REPLACE_WITH_SERVER_IP:1323/save