Žilinská univerzita > Fakulta riadenia a informatiky > Katedra informačných sietí

Making a qemu MikroTik router for GNS3 under Win7

The article just continue within the set of articles (Cisco, Juniper) how  to prepare emulated software routers usable for usage within GNS3 simulator and supports the way of learning by doing. Smilarly like it with Juniper for example there are several ways how to emulate MikroTIK routers using GNS3 and make them usable for buidling advanced networking topologies. Be able to make and run MikroTIK inside of GNS3 we have several ways available:

  • using qemu
  • using virtualbox
  • using vmware

browsing the web and supporting open and memory frendly solutions I prefer using Qemu, as it is provide small memory foot print (http://mum.mikrotik.com/presentations/ID13/rofiq.pdf) and therefore aloows to run bigger topologies. 

Using qemu to run MikroTIK router inside of GNS3

Prerequisities and environments

  • All is running inside of my Win 7 64 bit OS.
  • Installed GNS3. I prefer to install version for win 64 bit. Download here. I'm using version 1.1.
  • Installed Qemu, I'm using version which is packed together with gns3 1.1.

Steps

There are only few steps and the process is straightforward

  • Download mikrotik Router OS image for x86 from here.
  • Ccreate qemu virtual disk 
  • Intall mikroTIK
  • Import Qemu machine into GNS3
  • Run an example topology inside of GNS3 with qemu machines

Step 1)

So, as the first step download Mikrotik RouterOS iso file for x86 architecture (i'm using mikrotik-6.22.iso) and move the iso file to the folder where is your qemu installed. In my case

c:\Program Files\GNS3\qemu>

Step 2)

Now we will create a qemu virtual image file where we will install mikrotik OS. So run from the qemu install folder:

qemu-img create -f qcow2 mikrotik6-22.img 256M

where the command create an Qemu image disk named mikrotik6-22.img  with the size of 256MB. The output look like

c:\Program Files\GNS3\qemu>qemu-img create -f qcow2 mikrotik6-22.img 256M
Formatting 'mikrotik6-22.img', fmt=qcow2 size=268435456 encryption=off cluster_size=65536 lazy_refcounts=off

Step 3)

and run

qemu-system-i386w.exe -m 256 -hda mikrotik6-22.img -cdrom mikrotik-6.22.iso -boot d -localtime

The command starts Qemu machine with previously created disk mikrotik6-22.img, with 256MB of RAM and attached CDROM with RouteOS ISO image.

Qemu should start immediately inside of a new window (note, Ctrl + Alt willl release the coursor).

install mikrotik qemu-1

 

 

and after few second qemu will show the MikroTIK installatiion menu:

install mikrotik qemu-2

 

 
choose your preferred options (I've selected all of them)
mikrotik-qemu-3
 
and continue with the installation pressing the "I" option, then asnwer "No" for question if you like yo keep the old configuration, and after warning message type "y".
 
The installation process will finish very soon (on my Lenovo core i5 with 8GB of RAM) and it will ask for reboot. Press enter to reboot!
 
While system is rebooting, quit Qemu (closing the window or by by pressing Ctrl-Alt-2, and then typing: "quit"), or it will boot fast again with CDROM.
 
Now we will try boot and run our Mikrotik RouterOS, so type
qemu-system-i386w.exe -hda mikrotik6-22.img -boot c
and we should see
mikrotik-qemu-4
 
and after a while mikroTIK login prompt
mikrotik-qemu-5
 

Step 4)

Be carefull, qemu which is installed together with GNS3 package will not create final qemu.img (mikrotik6-22.img) within the same directory as we run the commands, i.e.
c:\Program Files\GNS3\qemu>
 
but it is using general GNS3 store folder, which is in my case
 C:\Users\install\AppData\Local\VirtualStore\Program Files\GNS3\qemu
 
I'm not using it so i will move the img file to the folder where I have all images, i.e.
C:\Program Files\GNS3\images
So If you prefer this way to find the image and move it.

Step 5) 

 
Import MikroTIK image to the Qemu in GNS3. To do that
Now we will add the mikrotik router, which just we create, into the qemu VMs list. To do that start GNS3 and go to the menu with Qemu VMs preferences
Edit--> Preferences--> QEMU--> QEMU VMs
click on the New button
qemu-install-mikrotik6
 
Type the name of router
qemu-install-mikrotik7
 
next select the qemu binary (x64 is default) and the amount of RAM for Mikrotik qemu machine:
qemu-install-mikrotik6
 
 
select the mikrotik disk image and click finish:
qemu-install-mikrotik10
 
 
then select the GNS3 mikrotik box and click on edit, we will just add some network interfaces, because there is only one:
qemu-install-mikrotik11
 
 
Then select the Network tab. Change the number of interfaces and click on Apply.
qemu-install-mikrotik13
 
final!
we are able to create a topo and start to learn!
 
big topo
 
start the machine and log in using default login admin with no password, if you have licence key apply it, otherwise keep the fresh copy of your installed Mikrotik image, as after 24 hours of its usage it will be locked
after login
Groups: