{"id":561,"date":"2017-08-26T19:09:47","date_gmt":"2017-08-26T18:09:47","guid":{"rendered":"http:\/\/darkandscary.co.uk\/?p=561"},"modified":"2017-08-26T19:09:47","modified_gmt":"2017-08-26T18:09:47","slug":"creating-a-virtual-router-in-kvm","status":"publish","type":"post","link":"https:\/\/darkandscary.co.uk\/?p=561","title":{"rendered":"Creating a virtual router in KVM"},"content":{"rendered":"<p>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<br \/>\nMikrotik have also upgraded their software, so I am intending to use version 6.40.2 of the router OS.<\/p>\n<p>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:<\/p>\n<p>In the Virtual Machine manager, double click on QEMU\/KVM to connect to the hypervisor, then click on the storage tab. Highlight the &#8216;VMachines&#8217; pool and click on the blue cross where it says &#8216;Volumes&#8217; to create the virtual hard disk in the VMachines storage pool.<\/p>\n<figure id=\"attachment_563\" aria-describedby=\"caption-attachment-563\" style=\"width: 756px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/SelectingNewVolume.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-563 size-full\" src=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/SelectingNewVolume.png\" alt=\"\" width=\"756\" height=\"528\" srcset=\"https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/SelectingNewVolume.png 756w, https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/SelectingNewVolume-300x210.png 300w\" sizes=\"auto, (max-width: 756px) 100vw, 756px\" \/><\/a><figcaption id=\"caption-attachment-563\" class=\"wp-caption-text\">Add a new storage Volume, (NOT Pool)<\/figcaption><\/figure>\n<p>Edit the name and size of the disk and set it to use the qcow2 format.<\/p>\n<figure id=\"attachment_567\" aria-describedby=\"caption-attachment-567\" style=\"width: 372px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/CreateMRouterDisk.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-567 size-full\" src=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/CreateMRouterDisk.png\" alt=\"\" width=\"372\" height=\"419\" srcset=\"https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/CreateMRouterDisk.png 372w, https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/CreateMRouterDisk-266x300.png 266w\" sizes=\"auto, (max-width: 372px) 100vw, 372px\" \/><\/a><figcaption id=\"caption-attachment-567\" class=\"wp-caption-text\">Setting the parameters for the new disk<\/figcaption><\/figure>\n<p>The storage pool now looks like this:<\/p>\n<figure id=\"attachment_571\" aria-describedby=\"caption-attachment-571\" style=\"width: 756px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewDiskInPool.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-571 size-full\" src=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewDiskInPool.png\" alt=\"\" width=\"756\" height=\"528\" srcset=\"https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewDiskInPool.png 756w, https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewDiskInPool-300x210.png 300w\" sizes=\"auto, (max-width: 756px) 100vw, 756px\" \/><\/a><figcaption id=\"caption-attachment-571\" class=\"wp-caption-text\">Newly created 10G disk for the router<\/figcaption><\/figure>\n<p>I can now create the router by returning to the Virtual Machine Manager and clicking on the &#8216;Create a new virtual machine&#8217; icon at the top left:<\/p>\n<figure id=\"attachment_575\" aria-describedby=\"caption-attachment-575\" style=\"width: 556px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/CreateNewMachine.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-575 size-full\" src=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/CreateNewMachine.png\" alt=\"\" width=\"556\" height=\"578\" srcset=\"https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/CreateNewMachine.png 556w, https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/CreateNewMachine-289x300.png 289w\" sizes=\"auto, (max-width: 556px) 100vw, 556px\" \/><\/a><figcaption id=\"caption-attachment-575\" class=\"wp-caption-text\">Click the New Virtual machine icon, top left.<\/figcaption><\/figure>\n<p>Configure the new machine to use a local install media, and because the router software is 32-bit, use an i686 architecture.<\/p>\n<figure id=\"attachment_577\" aria-describedby=\"caption-attachment-577\" style=\"width: 406px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewMachineParams1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-577 size-full\" src=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewMachineParams1.png\" alt=\"\" width=\"406\" height=\"443\" srcset=\"https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewMachineParams1.png 406w, https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewMachineParams1-275x300.png 275w\" sizes=\"auto, (max-width: 406px) 100vw, 406px\" \/><\/a><figcaption id=\"caption-attachment-577\" class=\"wp-caption-text\">Local install media and i686 architecture<\/figcaption><\/figure>\n<p>Click &#8216;Forward&#8217; and on the next pane, select the &#8216;Use ISO image&#8217; option and browse the ISO pool for the router downloaded earlier.<\/p>\n<figure id=\"attachment_581\" aria-describedby=\"caption-attachment-581\" style=\"width: 420px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewMachineParams2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-581 size-full\" src=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewMachineParams2.png\" alt=\"\" width=\"420\" height=\"428\" srcset=\"https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewMachineParams2.png 420w, https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewMachineParams2-294x300.png 294w\" sizes=\"auto, (max-width: 420px) 100vw, 420px\" \/><\/a><figcaption id=\"caption-attachment-581\" class=\"wp-caption-text\">Select the Mikrotik router ISO<\/figcaption><\/figure>\n<p>Click &#8216;Forward&#8217;. I will allocate 2 Gigabytes of RAM to the router (the maximum it currently supports) and two processor cores.<\/p>\n<figure id=\"attachment_583\" aria-describedby=\"caption-attachment-583\" style=\"width: 406px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewMachineParams3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-583 size-full\" src=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewMachineParams3.png\" alt=\"\" width=\"406\" height=\"428\" srcset=\"https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewMachineParams3.png 406w, https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewMachineParams3-285x300.png 285w\" sizes=\"auto, (max-width: 406px) 100vw, 406px\" \/><\/a><figcaption id=\"caption-attachment-583\" class=\"wp-caption-text\">Allocate 2 Gigs of RAM and 2 processor cores<\/figcaption><\/figure>\n<p>Clicking &#8216;Forward&#8217; takes me to a pane where I can select the hard disk image I created earlier.<\/p>\n<figure id=\"attachment_585\" aria-describedby=\"caption-attachment-585\" style=\"width: 406px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewMachineParams4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-585 size-full\" src=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewMachineParams4.png\" alt=\"\" width=\"406\" height=\"428\" srcset=\"https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewMachineParams4.png 406w, https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewMachineParams4-285x300.png 285w\" sizes=\"auto, (max-width: 406px) 100vw, 406px\" \/><\/a><figcaption id=\"caption-attachment-585\" class=\"wp-caption-text\">Select the hard disk image created earlier<\/figcaption><\/figure>\n<p>Clicking &#8216;Forward&#8217; allows me to name this virtual machine, in this case &#8216;MRouter&#8217;. 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&#8230;<\/p>\n<figure id=\"attachment_587\" aria-describedby=\"caption-attachment-587\" style=\"width: 530px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewMachineParams5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-587 size-full\" src=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewMachineParams5.png\" alt=\"\" width=\"530\" height=\"455\" srcset=\"https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewMachineParams5.png 530w, https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewMachineParams5-300x258.png 300w\" sizes=\"auto, (max-width: 530px) 100vw, 530px\" \/><\/a><figcaption id=\"caption-attachment-587\" class=\"wp-caption-text\">Name the machine and connect it to the house network.<\/figcaption><\/figure>\n<p>Click &#8216;Forward&#8217; and I get the customisation panel. I will add three more network interfaces and connect them to each virtual network in turn.<\/p>\n<figure id=\"attachment_589\" aria-describedby=\"caption-attachment-589\" style=\"width: 811px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewMachineParams6.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-589 size-full\" src=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewMachineParams6.png\" alt=\"\" width=\"811\" height=\"628\" srcset=\"https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewMachineParams6.png 811w, https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewMachineParams6-300x232.png 300w, https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewMachineParams6-768x595.png 768w\" sizes=\"auto, (max-width: 811px) 100vw, 811px\" \/><\/a><figcaption id=\"caption-attachment-589\" class=\"wp-caption-text\">Click on &#8216;Add hardware&#8217; to create new virtual network interfaces<\/figcaption><\/figure>\n<p>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:<\/p>\n<figure id=\"attachment_591\" aria-describedby=\"caption-attachment-591\" style=\"width: 803px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewMachineParams7.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-591 size-full\" src=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewMachineParams7.png\" alt=\"\" width=\"803\" height=\"574\" srcset=\"https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewMachineParams7.png 803w, https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewMachineParams7-300x214.png 300w, https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/NewMachineParams7-768x549.png 768w\" sizes=\"auto, (max-width: 803px) 100vw, 803px\" \/><\/a><figcaption id=\"caption-attachment-591\" class=\"wp-caption-text\">Creating a new adapter and connecting it to a network<\/figcaption><\/figure>\n<p>When all three adapters are added, the virtual machine can be started by clicking on the green tick marked &#8216;Begin Installation&#8217;. I now get a window showing the running virtual machine. Using the on screen instructions I selected various packages to install as follows:<\/p>\n<figure id=\"attachment_593\" aria-describedby=\"caption-attachment-593\" style=\"width: 811px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/MRouterInitialSettings.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-593 size-full\" src=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/MRouterInitialSettings.png\" alt=\"\" width=\"811\" height=\"628\" srcset=\"https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/MRouterInitialSettings.png 811w, https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/MRouterInitialSettings-300x232.png 300w, https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/MRouterInitialSettings-768x595.png 768w\" sizes=\"auto, (max-width: 811px) 100vw, 811px\" \/><\/a><figcaption id=\"caption-attachment-593\" class=\"wp-caption-text\">Initial package selection<\/figcaption><\/figure>\n<p>Press &#8216;i&#8217; to install&#8230; say no to keeping the old configuration and yes to continuing&#8230;<\/p>\n<p>Press enter to reboot and&#8230;<\/p>\n<figure id=\"attachment_597\" aria-describedby=\"caption-attachment-597\" style=\"width: 811px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/RouterFirstBoot.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-597 size-full\" src=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/RouterFirstBoot.png\" alt=\"\" width=\"811\" height=\"628\" srcset=\"https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/RouterFirstBoot.png 811w, https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/RouterFirstBoot-300x232.png 300w, https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/08\/RouterFirstBoot-768x595.png 768w\" sizes=\"auto, (max-width: 811px) 100vw, 811px\" \/><\/a><figcaption id=\"caption-attachment-597\" class=\"wp-caption-text\">Waiting for login&#8230;<\/figcaption><\/figure>\n<p>More on what to do in the next post&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &hellip; <a href=\"https:\/\/darkandscary.co.uk\/?p=561\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Creating a virtual router in KVM<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,21],"tags":[],"class_list":["post-561","post","type-post","status-publish","format-standard","hentry","category-linux","category-virtualisation"],"_links":{"self":[{"href":"https:\/\/darkandscary.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/561","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/darkandscary.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/darkandscary.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/darkandscary.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/darkandscary.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=561"}],"version-history":[{"count":7,"href":"https:\/\/darkandscary.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/561\/revisions"}],"predecessor-version":[{"id":601,"href":"https:\/\/darkandscary.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/561\/revisions\/601"}],"wp:attachment":[{"href":"https:\/\/darkandscary.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=561"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/darkandscary.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=561"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/darkandscary.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=561"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}