Adding FortiGate VM into Proxmox
More often than not, when you think of a hypervisor, you think of VMware, Microsoft, Oracle, etc. There are a lot of different virtualization technologies out there but I am a HUGE fan of one in particular that may not have a lot of recognition by most. That hypervisor is called Proxmox. There’s a multitude of reasons why it tops my list for hypervisors, but going into depth around that is out of scope for this particular blog post.
Everyone pretty much knows how to import an “OVF/OVA” into the VMWare/Microsoft hypervisor solutions and even if you do not, there’s a slew of documentation/articles out there to teach you how to do it. But, when it comes to importing the equivalent into Proxmox, there is not a ton of documentation. Below is a guide on how to take the standard FortiGate KVM image and import it into Proxmox for use as a virtual machine.
This particular article makes a few assumptions (such as you are using ZFS as your VM storage) in that you know the basics when it comes to Proxmox. I will write more articles about that hypervisor in the future, however this guide does not go into the initial set-up of the Proxmox hypervisor to perform the subsequent steps.
Uploading VM Image to Proxmox
The first step is to acquire the base image file for FortiOS and upload it to Proxmox so it can be used to create the FortiGate. The procedure below gives the steps to achieve this:
1.Acquire the KVM image (qcow2 file format) for the FortiGate to deploy in Proxmox
2. Unzip the image to reveal the qcow2 file
3. Upload that image via SCP to your Proxmox server
Create Virtual Machine on Proxmox
After uploading the VM image file to Proxmox, the next step is to create a VM that will be used for the FortiGate VM. Below is the procedure to walk through these steps:
1.After logging into the Proxmox GUI, select “Create VM.
2.In the “Create: Virtual Machine| General” tab, fill in the “Name:” (i.e. proxmox-fgt) | Click “Next”
3. On the “Create: Virtual Machine| OS” tab, select “Do not use any media”; Set “Guest OS:” to “Type:Linux”;”Version: 4.X/3.X/2.6 Kernel”
4. On the “Create: Virtual Machine | Hard Disk” tab, select “Bus/Device: SCSI”;”Storage:<vm datastore> (non ZFS)”;”Disk size (GiB): 2GB” | Click “Next”
5. On the “Create: Virtual Machine | CPU” tab, set “Sockets:1″;”Cores:1″;”Type: Default(kvm64)” | Click “Next”
6. On the “Create: Virtual Machine | Memory” tab, set “Memory (MiB): 1024” | Click “Next”
7. Create: Virtual Machine | Network” tab, select “Bridge: <VM bridge with Internet connectivity>”;”Model: VirtIO(Paravirtualized)” | Click “Next”
8. Review the settings under the “Confirm” tab and click “Finish” to create the VM:
9. After the VM has been created, add an additional “Hard Disk” by clicking on the VM | Click “Hardware” | Click “Add” | Click “Hard Disk”:
10. On the “Add: Hard Disk” dialog, set “Bus/Device: SCSI:1 <next available id>”; “Storage: <vm storage> (ZFS)”;”Disk size (GiB): 32″ | Click “Add”
Once completing the steps above, validate the settings in the Proxmox VM details panel:
Pro Tip: When creating the VM, stick to 1 CPU and no more than 1024 MB so you can access the full FortiGate WebGUI without restriction when it boots.
Copying the FortiGate image file to VM
1.Copy the qcow2 file that you uploaded in step 3 over the hard drive file that was just created for your FortiGate VM via the following command:
cp -v fortios.qcow2 /var/lib/vz/images/<id of vm>/vm-<id>-disk-1.qcow2
2. Move hard drive to the ZFS storage *only required if you are using ZFS*
3.After disk has been moved successfully, power on the FortiGate VM
4.Validate via the console the FortiGate boots
5.Once the FortiGate reboots to format the log disk, you should be met with a login prompt just like a factory reset FortiGate
If you successfully complete these steps, you can proceed to configure your FortiGate just as you would do a physical appliance. There will be future articles where I will talk about using the FortiGate VM on Proxmox. I hope this helps you get your lab up with the FortiGate and running!