How to Creat a custom node type in UNL

Every node on Unetlab have their own template . So if you want to create a custom template for an other image like infoblox or Mcafee , simply use this tutorial.

  • Creating a custom node for infoblox VM Add infoblox node definition to initialization file /opt/unetlab/html/includes/init.php.

     'linux'            =>      'Linux',
     ‘infloblox’        =>      ‘infoblox’,
      ‘Mcafee’          =>      ‘Mcafee’,
      'mikrotik'        =>      'MikroTik RouterOS',
  •  Create a new Mcafee / infoblox / lamp  node template based on existing linu node template
$ cp /opt/unetlab/html/templates/linux.php /opt/unetlab/html/templates/infoblox.php
$ cp /opt/unetlab/html/templates/linux.php /opt/unetlab/html/templates/Mcafee.php
$ cp /opt/unetlab/html/templates/lamp.php /opt/unetlab/html/templates/lamp.php
  • Edit the template file replacing all occurences of ‘Linux’ with ‘mcafee’/ ‘infoblox’/ ‘lamp’
$ sed -i 's/Linux/Mcafee/g; s/linux/Mcafee/g' /opt/unetlab/html/templates/Mcafee.php
$ sed -i 's/Linux/lamp/g; s/linux/lamp/g’ /opt/unetlab/html/templates/lamp.php
$ sed -i 's/Linux/lamp/g; s/linux/lamp/g’ /opt/unetlab/html/templates/lamp.php
  • Edit the template file to double the RAM and CPU and pass all host’s CPU instructions to Mcafee ,  infoblox  , lamp nodes
$ sed -i 's/2048/4096/; s/(cpu.*) = 1/\1 = 2/; s/(order=)dc/\1cd -cpu host/' /opt/unetlab/html/templates/Mcafee.php
$ sed -i 's/2048/4096/; s/(cpu.*) = 1/\1 = 2/; s/(order=)dc/\1cd -cpu host/' /opt/unetlab/html/templates/infoblox.php
  • Create a new directory for Mcafee infoblox and lamp image
mkdir -p /opt/unetlab/addons/qemu/infoblox-1
mkdir -p /opt/unetlab/addons/qemu/Mcafee-1
mkdir -p /opt/unetlab/addons/qemu/lamp
  • converte image from vdmk to qcow2
tar -xvf McAfee_SecureWebGateway.ova
/opt/qemu/bin/qemu-img convert -f vmdk -O qcow2 McAfee_SecureWebGateway-disk1.vmdk virtioa.qcow2
mv virtioa.qcow2 /opt/unetlab/addons/qemu/Mcafee
/opt/unetlab/wrappers/unl_wrapper -a fixpermissions

Leave a comment