Difference between revisions of "Juniper ZTP/Homer"
| Line 70: | Line 70: | ||
lsw1-a3-dfw 1H IN A 10.193.0.103 | lsw1-a3-dfw 1H IN A 10.193.0.103 | ||
lsw1-a4-dfw 1H IN A 10.193.0.104 | lsw1-a4-dfw 1H IN A 10.193.0.104 | ||
| + | |||
| + | ===Script=== | ||
| + | |||
| + | This Python scrip will read data from a csv file and generate the juniper_ztp file using a template. | ||
| + | |||
| + | - cvs file | ||
| + | In a real world, working with real switches you can get the mgmt interface MAC directly from the sticker on the box the switch came in. You don't have to power on and connect to the switch before getting the inforamtion. | ||
| + | |||
| + | hostname,mgmt_ip,cidr_bits,mac_address | ||
| + | lsw1-a1-dfw,10.193.0.101,24,50:00:00:0e:00:00 | ||
| + | lsw1-a2-dfw,10.193.0.102,24,50:00:00:16:00:00 | ||
| + | lsw1-a3-dfw,10.193.0.103,24,50:00:00:17:00:00 | ||
| + | lsw1-a4-dfw,10.193.0.104,24,50:00:00:18:00:00 | ||
| + | |||
| + | - template | ||
Revision as of 01:36, 6 February 2023
Goal
In this Tutorial, we are going to setup a ZTP environment to be able to run the basic configuration on a new Juniper switch. Once the basic configuration is done, we will run homer to deploy the switch configuration. If you want to know more about homer please check: https://wikitech.wikimedia.org/wiki/Homer
Prerequisites
For this tutorial I will be using :
- EVE-NG 2.0.3-112
- VQFX model: vqfx-10000 running JUNOS 19.4R1.10
- DHPC/TFTP VM (IP:10.192.16.5/install1001.dfw.labnet)
- Homer VM(IP:10.192.32.17/homer1001.dfw.labnet)
- Netbox VM(IP:10.192.32.3/netbox1001.dfw.labnet)
- DNS server(IP:10.192.16.2/ns0.dfw.labnet)
All the VM's are running on Proxmox 7.3.4
Diagram
Setup and Configuration
The section is the just the section needed to make ztp work.
Note: We will generate the juniper_ztp file using later on a python script
DHCP configuration
#######################################################################
# ZTP Sample Config begins here:
#######################################################################
option option-150 code 150 = ip-address;
set vendor-string = option vendor-class-identifier;
option space ZTP;
option ZTP.image-file-name code 0 = text;
option ZTP.config-file-name code 1 = text;
option ZTP.image-file-type code 2 = text;
option ZTP.transfer-mode code 3 = text;
option ZTP.alt-imagefile-name code 4 = text;
option ZTP-encapsulation code 43 = encapsulate ZTP;
# mgmt nework
subnet 10.193.0.0 netmask 255.255.255.0 {
authoritative;
option subnet-mask 255.255.255.0;
option option-150 10.192.16.5; #TFTP server
option routers 10.193.0.1;
option broadcast-address 10.193.0.255;
option domain-name "mgmt.dfw.labnet";
default-lease-time 600;
max-lease-time 7200;
}
group {
vendor-option-space ZTP;
include "/etc/dhcp/juniper_ztp";
}
DNS entries for the 4 switches
$ORIGIN 0.193.10.in-addr.arpa. --- 101 1H IN PTR lsw1-a1-dfw.mgmt.dfw.labnet. 102 1H IN PTR lsw1-a2-dfw.mgmt.dfw.labnet. 103 1H IN PTR lsw1-a3-dfw.mgmt.dfw.labnet. 104 1H IN PTR lsw1-a4-dfw.mgmt.dfw.labnet. $ORIGIN mgmt.dfw.labnet. --- lsw1-a1-dfw 1H IN A 10.193.0.101 lsw1-a2-dfw 1H IN A 10.193.0.102 lsw1-a3-dfw 1H IN A 10.193.0.103 lsw1-a4-dfw 1H IN A 10.193.0.104
Script
This Python scrip will read data from a csv file and generate the juniper_ztp file using a template.
- cvs file In a real world, working with real switches you can get the mgmt interface MAC directly from the sticker on the box the switch came in. You don't have to power on and connect to the switch before getting the inforamtion.
hostname,mgmt_ip,cidr_bits,mac_address lsw1-a1-dfw,10.193.0.101,24,50:00:00:0e:00:00 lsw1-a2-dfw,10.193.0.102,24,50:00:00:16:00:00 lsw1-a3-dfw,10.193.0.103,24,50:00:00:17:00:00 lsw1-a4-dfw,10.193.0.104,24,50:00:00:18:00:00
- template