RouterOS Virtual Labs

We recently released a test version of our upcoming product Cloud Hosted Router (CHR) - a virtual RouterOS instance for the x86_64 architecture. The test version we currently offer has 1mbps limit per interface (in future we will offer unlimited speed with a paid subscription). Otherwise, it’s a fully functional RouterOS.

RouterOS Virtual Labs can be used in various scenarios, for example, to try out configuration before deploying it in production, when preparing for MikroTik Certification test or using CHR as a router for virtual servers, just to name a few.

Following are basic instructions to get started on creating RouterOS Virtual Labs using GNS3 (Graphical Network Simulator) tool on Windows desktop machine, Windows 8.1 to be specific but it should be similar on other Windows versions as well, just make sure it is 64bit version.

NOTE. GNS3 can be run also on Linux and Mac machines.

As of this writing (August 2015) the newest version of GNS3 is v1.3.9, it can be obtained here - https://github.com/GNS3/gns3-gui/releases/tag/v1.3.9 (or just head to http://www.gns3.com). As a hypervisor GNS3 can use either VirtualBox or Qemu. For running CHR, we suggest Qemu. It is already bundled with GNS3 installation. Currently, the newest version of Qemu for Windows is v2.4.0, but with GNS3 included is v2.2.0. If you want the newest, you can download it from http://qemu.weilnetz.de/w64/ and install separately. During installation, GNS3 will check for existing Qemu installation on your computer and will use that if true. In this guide, we will use separately installed Qemu.

  1. Install Qemu (using default settings)

  2. Install GNS3 (GNS3-1.3.9-all-in-one.exe) and uncheck Qemu
    01_CHR_GNS3.png
    Setup will download additional installation files as necessary.

NOTE. SolarWinds Response tool reports that computer name can only contain ‘a-z’, ‘A-Z’, ‘0-9’, ‘.’ and ‘-’ as characters. Underscore ‘_’ is not valid and if you want to use this tool computer name will have to be changed.

  1. For Virtual RouterOS instances to have access to the Internet (or at least Windows host machine) a loopback interface has to be created and Internet Connection Sharing enabled.

To do so, execute command: ‘hdwwiz.exe’ (as Administrator) - Add Hardware Wizard will open.

Install the hardware that I manually select from a list (Advanced) → Network Adapters → Microsoft → Microsoft Loopback adapter. If there is no such choice Microsoft KM-TEST Loopback Adapter should be chosen.
02_CHR_GNS3.png
Open ‘Control Panel → Network and Sharing center → Change adapter settings’. There will be a new network adapter and it should have a name ‘Ethernet 2’ (or some other number if there are more ethernet devices on the computer). For the sake of recognizability, we suggest renaming the interface to ‘Loopback’ or some other apparent name.

Next, enable Internet Connection Sharing, select the network interface which is used to connect your computer to the network (WiFi or wired) and open Properties → Sharing. Enable ‘Allow other network users to connect through this computer’s Internet connection’ and select ‘Loopback’ as Home Network Connection:
03_CHR_GNS3.png
Windows will automatically assign IP 192.168.137.1 to that interface and enable DHCP server on it.
04_CHR_GNS3.png
It is suggested to reboot the computer at this point!

  1. Download newest CHR image (.img file) here - http://www.mikrotik.com/download

  2. Open GNS3. To make it easier to move GNS3 projects between various computers, it is suggested to change GNS3 Paths (My projects, My binary images) to a universal folder, e.g. C:\GNS3. By default, it is C:\Users\YOUR_USERNAME\GNS3... It can be changed in Edit → Preferences
    05_CHR_GNS3.png

  3. Create RouterOS template: Edit → Preferences → Qemu VM’s → New → Type: Default → Choose a name → Choose amount of RAM to allocate for one RouterOS instance: 64MB is suggested → Chose disk image that was downloaded in step 4. Change network adapters to desired amount, e.g. 4
    06_CHR_GNS3.png
    Now RouterOS template is available from Browse Routers side panel.
    07_CHR_GNS3.png

  4. GNS3 has been set up for creating your RouterOS Virtual Lab. Drag and Drop RouterOS template on the main screen as many times as you need virtual routers. Connect them with links. To have access to the host computer’s Loopback interface, add ‘Cloud’ instance and configure its Ethernet to use that interface.
    08_CHR_GNS3.png
    Connect it to the RouterOS instance via Switch. As there already is a DHCP server on Windows Loopback interface, IP address on RouterOS can be obtained automatically, just configure

/ip dhcp-client

accordingly.

  1. Boot routers one by one: right clicking on each and choosing Start. Or click “play” icon on top to start all instances at once. Double-clicking with a mouse on a running instance will open a terminal to its console.

  2. To manage RouterOS instances via Winbox from Windows machine, enable RoMON on all routers:

/tool romon set enabled=yes

and connect using RoMON to the RouterOS instance which is directly connected to Loopback interface. Read more about RoMON on our wiki - http://wiki.mikrotik.com/wiki/Manual:RoMON
09_CHR_GNS3.png
To better distinguish routers from each other, rename each to have a different name, e.g.

/system identity set name=ROS_1
  1. Here’s a simple 4 router setup connected to the Internet via Loopback interface. Static routing was configured and each of them was able to connect to the internet via the CHR631-1 router.
    10_CHR_GNS3.png
  • GNS3 includes VPCS (Virtual PC Simulator) - a simple network testing tool which has some essential commands like traceroute, ping, arp built in. It even has DHCP client. It can be connected to router or switch as necessary. If full fledged OS is needed, Qemu can run it too. One thing to note - Qemu is rather slow in running generic Linux LiveCD’s. VirtualBox is a better choice. As GNS3 supports both Qemu and VirtualBox, you can combine instances using both of these hypervisors.

  • GNS3 installation has Wireshark bundled with it. Wireshark is a powerful network packet analyzer which can be used to capture traffic on an interface. To see traffic on a link in GNS3, right-click on it and chose ‘Start capture’. Read more about Wireshark features here - https://www.wireshark.org/about.html

  • GNS3 stores all project files under one folder which is movable to another computer. RouterOS template image file (.img) should also be copied together with the project itself and placed into ‘GNS3/images’ folder on target machine.

  • Qemu stores images in qcow2 (copy-on-write) format. These images can be run separately from GNS3 if needed. For example, you could make a multiple virtual lab with multiple routers and afterwards deploy the same images in production. If in production environment different hypervisor is used, qcow2 image can be converted to various formats using ‘qemu-img convert’ command. See more - http://docs.openstack.org/image-guide/content/ch_converting.html

We’re just scratching the surface here on what can be done with CHR using GNS3, the rest is up to you. We would love to see your virtual lab setups, please post screenshots in this thread.


Additional notes:

  • When using Windows 8, if there are problems with pinging Loopback interface from the router or VPCS, try reinstalling Winpcap and run it using compatibility mode for Windows 7.

  • If there are problems with pinging Loopback interface from the router or VPCS, check that your antivirus and/or firewall is not blocking traffic from virtual RouterOS instances to the host machine.

  • When using Qemu as a hypervisor, it is possible to pass additional parameters using ‘options’ field in Qemu VM Configuration → Advanced Settings. For available Qemu parameters see - http://wiki.qemu.org/download/qemu-doc.html

I recently started using GNS3 with CHR images on a Windows laptop with modest RAM (4GB) connected to a remote GNS3server running on Ubuntu with 32GB of RAM.

It works perfectly!

Kasparskr,
tutorial is great and everything works in Windows 10 for version 1.3.9 of GNS3. Can You make the same tutrial for next version 1.4.0 where will be used Vmware images for GNS3 and RouterOS?

Great tutorial and works great!

May I ask you to do another one on unetlab? - www.unetlab.com

On the last release they added support for MikroTik RouterOS.

Would be great to see that too and your thought comparing gns and unetlab.

Thanks

As someone who uses GNS3/virtualization daily to simulate customer networks as well as do development, labs and benchmarking, this is Awesome!

Will be trying this today so I can post my screenshots! :smiley:

Hello,
I have problem with:

  1. I cannot capture packets beetwen CHR’s links - i can do that beetwen ethernet switch link and CHR link.
  2. After GNS3 update and CHR’s image to newest CHR 6.32 - CHR’s hosts in project stop working. In GNS everything look ok, images start up and links are green status, but if try to connect by console serial it looks like the CHR is hang(other thing i cannot pin it)

Is there any chance of emulating wireless interfaces with this setup?
For example, if you want to test WDS with some other settings and check how the network will behave.

I have used GNS before but I worked with ethernet like interfaces and did not try wireless ones.

Thank you

there are no wireless virtual interfaces available.

Next, in GNS3 - check if your images ahve configuration - if you swap out the image, it will lose the configuration. The best course of action would be to use ‘/system package update’ for the upgrade.

It should be noted that GNS3 (and I’m assuming MikroTik?) are not opposed to having wireless interfaces be available, and are willing to support them.

Case in point:
https://community.gns3.com/ideas/1139

The problem is there’s no Hypervisor with such support. Not VirtualBox, not Qemu, not VMware even. Supporting a brand new type of virtual hardware is far different from making preexisting such devices communicate with one another (GNS3’s job) or making an OS have compatible drivers (RouterOS’ job).


I don’t suppose MikroTik might have some spare time (and/or “know how”) to contribute just one such device to just one open source Hypervisor (be it VirtualBox or Qemu) that is “conveniently” supported by RouterOS?

thank you for this. i’ve got a virtual router up and running.

is it possible however to access the webUI when you put the cloud interface on a VRF interface? i’m a RouterOS noob, so forgive me if this is a stupid question.

my reasoning for this is to keep my management of the virtual routers totally separate from lab i want to run.

Hello,
I have a problem do static routing the same like in first post’s example. I cannot ping GNS interface 192.168.137.1 from R2/R3/R4 but I can ping any other site in Internet. Other thing i could download and upgrade to newest firmware pacakge in R1/R3/R4 but in R2 i get info that I cannot connect - Error connection timeout - this is strange because I can ping any site in Internet - without GNS interface 192.168.137.1. There are not any firewall configuration - everything is open.

Config R1:

Config R2:

Config R3:

Config R4:

for those with VirtualBox or others that have problem that router stops immediately after it boots up - make sure that you have enabled your VM to expose virtualization bit to the guest.

On virtual box you can do this liek this:

VBoxManage setextradata [vmname|global] VBoxInternal/CPUM/EnableHVP 1

Janisk,
in my IP config is something wrong, or it is rather problem with GNS - problem defined post above.

I added to attachment and this link whole configuration to look.

http://niespielak.eu/niespielak.eu/ROS-Static.7z

you have to set up routing everywhere, that includes host holding GNS interface with address 192.168.137.1

R1 can ping it as it is in the same network. you can check with traceroute where your packets are going and what and where is happening.

I’m loving the ability to plan our network in my GNS3 lab, kudos for the low throughput x86 version!

GNS3 is great, but is currently causing me a few issues with resources. When running, 2 dynamips processes are created and each consumes a full CPU core. I’m running a quad core i5 machine here, which should be plenty, but these 2 processes are causing the machine to be unresponsive.

My setup is identical to that above - QEMU for virtualisation and the loopback interface for ICS in Windows. I have 6 ROS instances in my GNS3 project, plus a few generic GNS3 switches and the Cloud device connected to my loopback.

I’ve read around on idlepc settings related to IOS instances but can’t seem to find any way to improve performance on the ROS VM. I noticed that the dynamips batch file that launches the processes instructs a below average priority to the process already.

Has anyone ran into the same problem and is there anything can be done to improve it?

Huge facepalm moment for me. I had 2 Ethernet Switches in my topology and had configured a network loop. The high CPU usage was simply the 2 devices handling the huge traffic flowing over the loop.

I’ve since removed my loop and the CPU usage is now back down to almost zero.

I check again configuration - I do traceroute on every router except R1 - all pings to 192.168.137.1 all blocked on R1. It is strange because host addresed 192.168.137.1 have routing and can ping all interfaces for all Routers. At R1 there is not ant firewall and policies.

Other thing I can do traceroute from R2,R3,R4 to example 8.8.8.8 - on traceroute history i get information that host 192.168.137.1 is ok and route packets to another host - but it still not working if I try to ping 192.168.137.1 from R2,R3,R4 - in opposite ping from 192.168.137.1 works ok to R1,R2,R3,R4 interface addresses…

hi,

i ve installed gns3 with the guide but when i try to enter the console of my router is says

127.0.0.1:2001 Network error:connection refused


Any idea please ???

Hi, everybody i cannot make it to work.

When i am trying to connect to the console of the router i am getting the following error

127.0.0.1:2001 network error:connection refused

Am i missing something ?

Check If WinCap is installed correctly.