I didn’t have to work on MikroTik routers until now when most of our clients are Universities and it is needless to say how popular MikroTik boxes are to them. There would be no one without them. And, almost everyday we get calls from universities to provide technical supports by configuring or suggesting configurations for their MikroTik routers. Hence, I thought why not getting familiar with MT! Working with the new OS would be fun 🙂
The very first time when I was going to prepare a GNS3 Lab with MikroTik router on my Macbook I was fully stuck as I had no idea how this is going to work. The challenges are:
- I tried to get Winbox for Mac but there is none.
- I don’t know how to connect GNS3 Cloud with my Laptop.
Here’s how I make it work:
Download the softwares
- Download and install PlayOnMac (or any other application that runs .exe files on Mac). We need it to install and run winbox.exe as MikroTik does not have any macOS version for it. Once done, install WinBox. Here is a YouTube video that shows how to install a .exe application on Mac using PlayOnMac.
- Download and install GNS3. You need to run GNS3 as root administrator, so you must find the paht for this application and running from command line as follow:
Don’t panic seeing all the logs that populates your Teminal, it’s just generated because the GNS3 is running and going through those steps.
Fig 1: Running GNS3 as root on Mac.
- Add the MikroTik RouterOS Image in the QEMU VM. Just go to GNS3>Preferences>QEMU>Qemu VMs. Click “New” and give it a name. Browse and select the MikroTik RouterOS Image. From the “Network” you can increase the no. of ports according to your needs. I choose 5 Network Adapters as shown below:
Fig 2: Adding MikorTik Image in Qemu VM
- Download and install TapTun in your Macbook. The TunTap package will provide us with a collection of virtual network interfaces for the Mac operating system. The TAP drivers allow us to bridge our GNS3 virtual network with the physical Mac host. You can assign IP addresses to these adapters and generally use them for testing. By default, the TunTap adapter can’t really do anything useful by itself. We need to configure it. Unpack and install the downloaded TunTap package.Verify the TunTap package installed successfully. Run this command from Terminal.app:
A reboot of the computer may be required if the character device files are not listed in the output.
- To make QEMU gets connected to VM Host you should create a tap interface from GNS3 cloud options. Drag out a new cloud from the devices list in the left pane, right click it and choose “Configure”.
Expand the cloud group in the left pane then choose the “NIO TAP” tab in the right pane.
Under TAP interfaces (require root access) type /dev/tap0 as shown in Fig 3.
Click “Add” and now the new interface will show up inside the box, something like nio_tap:/dev/tap0. By the way, if you don’t click Add it won’t work – I’ve made this mistake many times. Anyways, now choose “OK”.
Fig 3: Adding TAP Interface
Alright, now drag out a network device like an Ethernet Switch and then click the Add a link button in the bottom left corner of the GNS3 window to connect any port on your Switch to the nio_tap:/dev/tap0 interface of your cloud.
The act of connecting this link causes GNS3 to create logical tap0 interface on your Mac.
Fig 4: Lab setup in GNS3
If this interface was created correctly you can verify the status of if on Terminal with ifconfig tap0 command:
But, as you can see, there is no IP address associated to tap0 interface. To assign an IP address to the tap0 interface:
Now check it again from the Terminal, the IP address should be shown.
- At this point you need to add the MikroTik Router to the topology, connect it to the Ethernet switch you created earlier. Just turn it on and connect it to the Switch as is showed in Fig 4. Open Console by right click on the Router. Login with the default user admin and with no password.
Fig 5: Starting MikroTik router console
- We need to put the Router interface connected to the switch in the same subnet as the tap0 interface. We are gonna use 10.0.0.1/24 in our case. First, check the interface NAME as it might not be same as the interface ID shown on GNS3 topology. In our case, GNS3 topology shows Router interface e0 is connected to the Switch but from Router’s console it shows ether1. configure IP address for the Ethernet interface.
Fig 6: Setting up IP address
- Now that we know tap0 works, we can bridge it to our real interface, which is en0 on my Mac.
We can view the virtual bridge and its members from Terminal:
At this point, you should be able to ping PC’s tap0 and Router’s ether1 from each other:
Fig 7: Ping test between Router (ether1) and PC (tap0) interface
- Now, open WinBox application that we set up previously using PlayOnMac. In the Connect To field type the MikroTik Router’s IP address (In our case, ether1 Interface which is 10.0.0.1), login as default user admin and hit Connect.
Fig 8: Connecting the Router with WinBox
This is it, you should now be able to get the known view of RouterOS WinBox.
Fig 9: WinBox console for MikroTik router
- You should be able to add more routers, finish connectivity and routing and complete your own lab. Have fun, happy networking 🙂
I would like to dedicate this post to my colleague Nazrul, who is experienced in MikroTik and helped me to run WinBox for the first time in GNS3 on Mac.