Creating a virtual router in KVM

Its been a little while since a did some work on this project and in that time I have upgraded my virtualisation computer to run OpenSuse LEAP 42.3
Mikrotik have also upgraded their software, so I am intending to use version 6.40.2 of the router OS.

Having downloaded the OS file and made it available in the ISO store, before I can run it, I need to create some storage for the router OS to be installed into and to keep its configuration. I will create a 10 Gig virtual hard disk for it as follows:

In the Virtual Machine manager, double click on QEMU/KVM to connect to the hypervisor, then click on the storage tab. Highlight the ‘VMachines’ pool and click on the blue cross where it says ‘Volumes’ to create the virtual hard disk in the VMachines storage pool.

Add a new storage Volume, (NOT Pool)

Edit the name and size of the disk and set it to use the qcow2 format.

Setting the parameters for the new disk

The storage pool now looks like this:

Newly created 10G disk for the router

I can now create the router by returning to the Virtual Machine Manager and clicking on the ‘Create a new virtual machine’ icon at the top left:

Click the New Virtual machine icon, top left.

Configure the new machine to use a local install media, and because the router software is 32-bit, use an i686 architecture.

Local install media and i686 architecture

Click ‘Forward’ and on the next pane, select the ‘Use ISO image’ option and browse the ISO pool for the router downloaded earlier.

Select the Mikrotik router ISO

Click ‘Forward’. I will allocate 2 Gigabytes of RAM to the router (the maximum it currently supports) and two processor cores.

Allocate 2 Gigs of RAM and 2 processor cores

Clicking ‘Forward’ takes me to a pane where I can select the hard disk image I created earlier.

Select the hard disk image created earlier

Clicking ‘Forward’ allows me to name this virtual machine, in this case ‘MRouter’. Also note that by default I am connecting it to the house network, via the bridge connection I configured in an earlier post. Check the box to allow further configuration. There are more networks to add…

Name the machine and connect it to the house network.

Click ‘Forward’ and I get the customisation panel. I will add three more network interfaces and connect them to each virtual network in turn.

Click on ‘Add hardware’ to create new virtual network interfaces

Each new network adapter gets its own unique MAC address and can connect to any of the real or virtual networks available to the Virtual Machine Manager. For example:

Creating a new adapter and connecting it to a network

When all three adapters are added, the virtual machine can be started by clicking on the green tick marked ‘Begin Installation’. I now get a window showing the running virtual machine. Using the on screen instructions I selected various packages to install as follows:

Initial package selection

Press ‘i’ to install… say no to keeping the old configuration and yes to continuing…

Press enter to reboot and…

Waiting for login…

More on what to do in the next post…