You're reading the deprecated documentation on readthedocs.io. The documentation has moved to netlab.tools.

Building a Juniper vPTX (vJunos EVO) Libvirt Box

Juniper vPTX (known as vJunos EVO or vJunos Evolved) is supported by the netlab libvirt package command. To build it:

  • Create an empty directory on a Ubuntu machine with libvirt and Vagrant.

  • Download the Juniper vPTX QCOW image from here, and place into that directory

  • Execute netlab libvirt package vptx virtual-disk-file-name and follow the instructions

Warning

  • The ‌netlab libvirt package vptx command has been tested on Ubuntu 20.04 LTS and might not work on other Linux distros.

Warning

  • Juniper vJunos EVO uses Linux instead of BSD as base OS. There are some basic differences from a “default” JunOS instance, including the management interface name, which becames “re0:mgmt-0”.

Initial Device Configuration

Initial device configuration is copied from a disk image created by the installation process. You’ll have to save it and shut down the VM. netlab libvirt config vptx command displays the build recipe:

Creating initial configuration for Juniper vPTX (vJunos EVO)
===============================================

Initial configuration for the vPTX device is prepared in a bootstrap disk image (pre-install hook).
After the system boots and displays the 'login' prompt:

* Login with username 'vagrant' and password 'Vagrant'
* Verify that the VM got a management IP address with 
  'show interfaces terse | match re0'
* Verify that the FPC 0 is online with 
  'show chassis fpc'
* Shut down the VM with 'request system power-off' (confirm with 'yes')

NOTES:
* The management traffic is isolated in a dedicated management VRF (mgmt_junos).
* It seems that the DHCP client in the vPTX instance is randomly failing to get the IPv4 address
  on the management interface.
  
You can use the following instructions to create and install a cron script in the vPTX box that
will check if the DHCP client has failed every 2 minutes, and restart the DHCP client if needed.

* Login via SSH with username 'root' and password 'Vagrant'
* Execute the following commands:

cat > /home/root/dhcp_check.sh <<EOL
PATH=\$PATH:/bin:/usr/sbin
L=/var/log/dhcp_check_hack.log

date > \$L

cli -c "show dhcp client binding" >> \$L 2>&1

cli -c "show dhcp client binding" | grep "re0:mgmt-0" | grep FAIL > /dev/null 2>&1

if [ \$? -eq 0 ]; then
  echo "DHCP IN FAIL STATE. RESTARTING PROCESS." >> \$L
  cli -c "restart dhcp-managerd" > /dev/null 2>&1
  cp \$L /var/log/dhcp_check_run.log
  sleep 10
fi
EOL

cat > /etc/cron.d/dhcp_check <<EOL
*/2    *       *       *       *       root    /bin/bash /home/root/dhcp_check.sh
EOL

* Shut down the VM (as above, from the Junos CLI)