Creating a Mikrotik CHR - RouterOS 7 - Bhyve VM in FreeBSD
While I love FreeBSD-based router solutions (OPNsense, PFsense, etc.), I also appreciate and use MikroTik devices and software. They produce and sell reasonably-priced, efficient hardware, and have implemented some interesting proprietary solutions (EoIP, etc.). Additionally, they’re a European company. From the smallest Wi-Fi router to the largest enterprise routing platform, they employ the same software with (almost) the same features.
That’s why I’m also implementing virtualized MikroTik CHR solutions - they’re lightweight, efficient, and can handle a significant amount of traffic with minimal resource overhead.
Our FreeBSD hypervisors run vm-bhyve as a lightweight, efficient, and intelligent management tool for VMs.
Even though MikroTik states that bhyve is not supported (as they believe it’s merely a paravirtualization software), CHR based on RouterOS 6 works flawlessly, following the hints provided by the vm-bhyve documentation.
Unfortunately, things change when dealing with RouterOS 7. It doesn’t boot at all, and if you upgrade from RoS 6 to RoS 7, it ceases to function entirely.
It seems that the MikroTik CHR image based on RouterOS 7 has an unusual partition table, somewhere between MBR and GPT. For this reason, Proxmox (KVM) doesn’t experience any issues, while bhyve seems unable to properly boot the VM. I conducted several tests, but the best solution was suggested by user kriszos on the MikroTik forum (even if kriszos was dealing with Hyper-V).
The script should be used on a machine with the following tools installed: gdisk, wget, unzip, qemu-img, qemu-nbd, and rsync:
|
|
I used the script on a machine with Proxmox installed, and it worked correctly. Once the relevant image was obtained, it was converted to raw format to be fed to bhyve:
|
|
Now that we have the correct image available, here’s an example of a VM configuration managed by vm-bhyve:
|
|
Related Content
- How We Are Migrating (Many Of) Our Servers From Linux to FreeBSD - Part 3 - Proxmox to FreeBSD
- Creating an Alpine Linux VM on Bhyve - With Root on ZFS (Optionally Encrypted)
- Deploying a Piece of the Fediverse
- How to Force Reboot a Frozen Linux or FreeBSD Machine
- Installing Mastodon Inside a FreeBSD Jail