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
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.
3) 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.
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:
Windows will automatically assign IP 192.168.137.1 to that interface and enable DHCP server on it.
It is suggested to reboot the computer at this point!
4) Download newest CHR image (.img file) here - http://www.mikrotik.com/download
5) 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
6) 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
Now RouterOS template is available from Browse Routers side panel.
7) 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.
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
8) 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.
9) To manage RouterOS instances via Winbox from Windows machine, enable RoMON on all routers:
/tool romon set enabled=yes
To better distinguish routers from each other, rename each to have a different name, e.g.
/system identity set name=ROS_1
* 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/c ... rting.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