Exporting the RADV Router VM as OVA and Vagrant Box for Fast Deployment

Exporting the RADV Router VM as OVA and Vagrant Box for Fast Deployment#

Continuing the Lab Build Process

With the RADV Router now up and running, we’re continuing the lab build process by exporting the virtual machine as both an OVA and a Vagrant box. In our previous post, we stopped the OVA creation process, but now it’s time to complete it and ensure a repeatable deployment for the rest of the lab environment. This VM serves as the foundation for the entire lab, so getting it into a reusable format is crucial.

Why Export the VM as an OVA?

One of the main reasons I wanted to export the RADV Router VM as an OVA (Open Virtual Appliance) was to show how versatile and portable it can be. By converting the VM to an OVA, I make it much easier to move the machine across different platforms. It can be used not just in VirtualBox, but also in other hypervisors like VMware, Hyper-V, or even cloud environments.

The OVA format is a great way to package a virtual machine because it includes everything needed—virtual disk, settings, and configuration files—into one neat, transferable file. This makes it a handy tool for creating backups or sharing the environment. If I need to migrate to another hypervisor or shift to a cloud provider, I can do so without any hassle. For my lab setup, it’s a perfect solution when it comes to restoring to a known state or quickly deploying the environment again.

Exporting the VM as an OVA

Before creating the Vagrant box, I first needed to export the VM as an OVA to serve as a clean, portable backup. Using infrastructure as code principles throughout the lab, I used the following VirtualBox command to ensure a repeatable, command-line driven process:

VBoxManage export "AlmaLinux_RADV_NAT64_VM" \
--output D:\virtualmachines\IPV6Lab\AlmaLinux_RADV_NAT64.ova \
--ovf20 --manifest --vsys 0 --description "RADV Router for IPv6 Lab" \
--options manifest,nomacs

This ensures that the OVA includes all necessary settings while remaining in a portable format.

Creating the Vagrant Box

To make deployment fast and reproducible, I needed to create a Vagrant box from the existing VM. This follows the infrastructure as code principles that run throughout the lab, allowing me to define and automate the environment setup using code rather than relying on manual configuration.

I started by ensuring Vagrant was set up to store boxes in a dedicated location, preventing my main drive from filling up:

mkdir D:\virtualmachines\IPV6Lab\VagrantBoxes
$env:VAGRANT_HOME="D:\virtualmachines\IPV6Lab\VagrantBoxes"

Then, I added the box:

vagrant box add "AlmaLinux_RADV_NAT64" D:\virtualmachines\IPV6Lab\AlmaLinux_RADV_NAT64.box

However, during the first vagrant up, I ran into an issue: Vagrant was attempting to SSH into the machine, but this VM isn’t reachable via SSH. The usual SSH-related settings didn’t prevent the issue, so the simplest fix was to decrease the boot timeout:

config.vm.boot_timeout = 60

With that in place, I was able to bring up the VM successfully:

vagrant up --no-provision

Preserving the Network Configuration

Initially, Vagrant wasn’t keeping my manually configured network adapters. My VM had two named network interfaces:

  • NIC 1: NAT Network (IPv6TestLabNAT)
  • NIC 2: Internal Network (IPv6TestLabINT)

To ensure these were carried over without modification, I updated the Vagrantfile to specify them explicitly without altering the OS-level setup.

Vagrant.configure("2") do |config|
  config.vm.box = "AlmaLinux_RADV_NAT64"

  # Set VM Name and Group
  config.vm.provider "virtualbox" do |vb|
    vb.name = "AlmaLinux_RADV_NAT64_VM"
    vb.customize ["modifyvm", :id, "--groups", "/IPv6Lab"]

    vb.memory = 8192  # 8GB RAM
    vb.cpus = 1       # 1 CPU

    # Disable extra adapters
    vb.customize ["modifyvm", :id, "--nic3", "none"]
    vb.customize ["modifyvm", :id, "--nic4", "none"]

    # NIC 1: NAT Network
    vb.customize ["modifyvm", :id, "--nic1", "natnetwork"]
    vb.customize ["modifyvm", :id, "--nat-network1", "IPv6TestLabNAT"]

    # NIC 2: Internal Network
    vb.customize ["modifyvm", :id, "--nic2", "intnet"]
    vb.customize ["modifyvm", :id, "--intnet2", "IPv6TestLabINT"]

    # Keep ACPI enabled for shutdown handling
    vb.customize ["modifyvm", :id, "--acpi", "on"]
  end

  # Disable SSH completely
  config.ssh.insert_key = false
  config.ssh.private_key_path = nil
  config.ssh.username = nil

  # Set a high boot timeout to avoid SSH failure delays
  config.vm.boot_timeout = 60

  # Prevent provisioning
  config.vm.provision "shell", inline: "exit 0"
end

The Benefits of Vagrant in My Lab Setup

After exporting the VM as an OVA, I turned to Vagrant to make the whole process even smoother. Vagrant brings several big advantages to my lab setup:

  1. Automation and Consistency
    With Vagrant, I can define the entire VM configuration—such as hardware, network settings, and provisioning scripts—using a simple Vagrantfile. This means I can spin up identical environments in no time, ensuring the setup is always the same, no matter where I deploy it. It saves a lot of time and effort and makes sure everything is consistent across all environments.

  2. Portability Across Platforms
    Vagrant also makes it easy to deploy the same environment on different platforms. Whether I’m running it on my local machine or hosting it on a cloud server, Vagrant ensures that the environment is set up in exactly the same way every time. This is ideal for scaling or when I need to move the lab to different systems.

  3. Simplified Configuration Management
    With Vagrant, I can manage all the configuration details (like network settings, software installs, and system tweaks) through code. Rather than manually setting things up each time, Vagrant handles it all automatically, reducing the chances of mistakes and ensuring that all my machines are configured the same way.

  4. Isolation of Environments
    Another bonus is that Vagrant creates isolated environments for each project or lab setup. This means I can run multiple instances of the RADV Router VM or other parts of the network without worrying about conflicting settings or software. It’s perfect for testing or development because I can keep each environment clean and separate from the others.

  5. Easier Collaboration and Sharing
    Once the Vagrant box is created, sharing it with other team members is a breeze. They can simply add the box and bring up the environment on their own machines, no need to replicate the whole setup process. This makes it much easier to work together, especially when time is tight or if multiple people need to use the same setup.

Conclusion

By using Vagrant alongside the OVA export, I’ve created the foundation of a flexible, automated, and portable lab and deployed the first machine in the lab, the Router Advertisement Daemon router, which is essential for IPv6 to work. Key takeaways include:

  • Exporting the VM as an OVA for portability and backups.
  • Redirecting Vagrant storage to a dedicated location.
  • Decreasing the boot timeout to avoid SSH connection delays.
  • Explicitly preserving network adapter configurations via VirtualBox settings.
  • Naming and grouping the VM for better organisation in VirtualBox.

This streamlined approach not only saves time but also ensures that my lab setup remains consistent, regardless of where or how it's deployed. The next step will build on everything I've learned so far, applying the same principles and methods to configure and deploy the DNS64 server for the lab.

Comments

Popular posts from this blog

Installing and Using Git on Windows

Learning How to Deploy a AlmaLinux VM With Packer (Part 1)

Welcome and Introduction