Sunday, 9 March 2014

Installing Mikrotik RouterOS in VirtualBox

MikroTik RouterOS is a Linux based operating system that runs on  proprietary hardware (RouterBOARD), or on standard x86-based computers.
Some training videos here

You can install it in VirtualBox and play around with this virtual device.

Go to their website and download the latest Router OS for PC/86
At this time v5.18 is latest stable available version. Also available in torrent.

Create a new Virtual Machine in VirtualBox as per example below.

















Check the interfaces 
 [admin@MikroTik] > interface print  
 Flags: D - dynamic, X - disabled, R - running, S - slave  
 # NAME TYPE MTU L2MTU MAX-L2MTU  
 0 R ether1 ether 1500  

and add  dhcp-client on ether1 and enable it
 ip dhcp-client add interface=ether1  
 ip dhcp-client enable number=0  

Previously I have setup the network adapter to be "Bridge" so the virtual Mikrotik machine can see the my 3rd party (dhcp) router and get ip address
 [admin@MikroTik] > ip address print   
 Flags: X - disabled, I - invalid, D - dynamic  
 # ADDRESS NETWORK INTERFACE  
  0 D 192.168.0.102/24 192.168.0.0 ether1  

I then added a second Ethernet adapter on my computer and in order to see it on Mikrotik as ether2 I had to restart it.
 [admin@MikroTik] > interface print  
 Flags: D - dynamic, X - disabled, R - running, S - slave   
 # NAME TYPE MTU L2MTU MAX-L2MTU   
 0 R ether1 ether 1500   
 1 R ether2 ether 1500   
 [admin@MikroTik] > interface print   
 Flags: D - dynamic, X - disabled, R - running, S - slave   
 # NAME TYPE MTU L2MTU MAX-L2MTU   
 0 R ether1 ether 1500   
 1 R ether2 ether 1500  
I enable dhcp client on ether2 and as it was connected to another DHCP server it got ip address. 
 [admin@MikroTik] > ip dhcp-client add interface=ether2  
 [admin@MikroTik] > ip dhcp-client print  
 [admin@MikroTik] > ip dhcp-client enable numbers=0   
 Flags: X - disabled, I - invalid   
 # INTERFACE USE-PEER-DNS ADD-DEFAULT-ROUTE STATUS ADDRESS  
 0 X ether2 yes yes  
 [admin@MikroTik] > ip address print  
 Flags: X - disabled, I - invalid, D - dynamic  
 # ADDRESS NETWORK INTERFACE  
 1 D 192.168.2.10/24 192.168.2.0 ether2  


Then we can check if it can reach the Internet.

 [admin@MikroTik] > ping 8.8.8.8  
 HOST SIZE TTL TIME STATUS  
 8.8.8.8 56 49 62ms  
 8.8.8.8 56 49 63ms  
 8.8.8.8 56 49 63ms  
 8.8.8.8 56 49 62ms  
 sent=4 received=4 packet-loss=0% min-rtt=62ms avg-rtt=62ms max-rtt=63ms 

No comments:

Post a Comment