Skip to content

Latest commit

 

History

History

vm

P4-Utils Virtual Machine

Important
In this section we explain how to build a VM with all the needed tools from scratch. However, since some part of the installation depends on Packer, and this tool sometimes gives problems we recommend to simply use the install script provided here and run it in a clean Ubuntu machine or VM.

Although P4-Utils can be installed directly on your system, running P4-Utils in a completely separated environment can be beneficial: in this way, installation and execution errors, that may arise, will not affect the whole system. For this reason, we recommend using one of the VM methods that we provide. In addition, since P4-Utils is only available on Linux, other OS users can run it in a Linux virtual machine.

We provide two different solutions for the P4-Utils VM and both are supported by a wide range of operating systems:

You can choose to download and use one of our preconfigured VMs or to build it yourself.

Important
Whether you are building your own VM or you are using the preconfigured images, you still need to install one of the above virtualizer according to your VM choice.

Build your own VM

To get started, you need to install the required software:

Note
Packer is a handy framework designed to automatically build custom VM images.

Clone the P4-Utils repository:

git clone https://github.com/nsg-ethz/p4-utils

Go to the Packer configurations folder:

cd p4-utils/vm

If you want to build the VirtualBox VM, execute:

./build-virtualbox.sh [--cpus 4] [--disk_size 25000] [--memory 4000] [--vm_name p4] [--username p4] [--password p4]

On the other hand, if you prefer the QEMU VM, run:

./build-qemu.sh [--cpus 4] [--disk_size 25000] [--memory 4000] [--vm_name p4] [--username p4] [--password p4]

According to the commands shown above, some parameters can be passed to the building scripts to customize the VM:

  • --cpus specifies the number of cores to use,
  • --disk_size is the size of the disk reserved by the VM in MBytes,
  • --memory is the amount of RAM to assign to the VM in MBytes,
  • --vm_name is the name of the VM,
  • --username is the login username,
  • --password is the login password.

Attention
The default VMs configuration parameters are shown above between square brakets. If you do not specify anything, they will be used to build your VM. However, please pass to the scripts the parameters that best fit your needs.

The building process will generate the following files:

  • If you chose the QEMU VM, in p4-utils/vm/output-ubuntu18044_qemu you will find a .qcow2 file to use to set up your VM.
  • If you chose the VirtualBox VM, in p4-utils/vm/output-ubuntu18044_vb you will find an .ova file to import in the VirtualBox VM manager.