Skip to content

muhafdal/mkt-vb-routeros

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 

Repository files navigation

Mikrotik Simulation

VirtualBox 6.1.50 (on Linux)

Mikrotik RouterOS: 6.49.17

WinBox

Simulate MikroTik RouterOS in VirtualBox and configure it via Winbox

Create a virtual machine file

Click New
1
Enter the name, in this case, use 'Mikrotik' and then click Next
2
Set the memory size to 512 MB (optional)
3
Choose 'Create a virtual hard disk now'
4
Choose 'VDI (VirtualBox Disk Image)'
5
Choose 'Dynamically allocated'
6
Set 2 GB (optional)
7
Enable both Adapter 1 and Adapter 2, then choose NAT
NAT (Network Address Translation) is chosen in VirtualBox to provide internet access to the virtual machine (VM) through the host machine. It allows the VM to share the host's IP address, making it easy to set up without complex network configuration.
8
Enable Adapter 3 and choose Host-only Adapter (optional)
9
Click OK, and then press Start

Start the virtual machine

Click the icon pointed to by the arrow.
10
Click Add
11
Select the MikroTik RouterOS ISO file
12
Click Choose
13
Click Start
14
Choose the software installation option
In this case, press 'a' to select all, then press 'i' to install.
15
Press 'n' for 'Do you want to keep the old configuration?' and then press 'y' to Continue
Before rebooting, right-click the icon pointed to by the arrow, then click the MikroTik RouterOS ISO file
16
Force Unmount
After installing MikroTik RouterOS, we need to force unmount the installation media (ISO) to prevent the virtual machine from booting from it again. This ensures the VM boots from the hard disk where RouterOS is installed, avoiding boot errors or conflicts.
17

Login to MikroTik, default user is 'admin' and the password is empty

17-2
Press 'n' for 'Do you want to see the software license' option
18
We need to set a new password
19

Open WinBox

Select the IP address; it should be 0.0.0.0 because the IP has not been set yet. If an error occurs, look for another IP with the same MAC address or the same Board's Port.
Use the 'admin' login and the new password that was set previously
20
Like this one
21

Configure MikroTik

Click on 'Interfaces' and rename ether1 to ether1-Internet and ether2 to ether2-Client
21-2
Click on 'IP > Addresses > New'. Set the IP address to 10.0.2.20/24 and set the interface to 'ether1-Internet'
To get this IP, I created a Windows virtual machine and set its network adapter to NAT.
WVM
As we can see, the Windows virtual machine has the IP 10.0.2.15/24, which is in the same network as 10.0.2.20/24
22
Click 'New' again and set the IP address to be used by the client
In this case, I set it to 192.168.14.1/24 and set the interface to 'ether2-Client'.
23
Click on 'IP > DNS' and set the DNS servers to 8.8.8.8 and 8.8.4.4 (Google's DNS)
24
Click on 'IP > Routes > New' and add the gateway 10.0.2.2, which is the NAT gateway
25
Click on 'IP > DHCP Server > DHCP Setup', select 'ether2-Client', then click 'Next' until the setup is complete
26
Click on 'IP > NAT', select 'srcnat' for Chain, and set the Out. Interface to 'ether1-Internet'

  • srcnat (Source NAT) is used to change the source IP address of outgoing packets, typically to allow devices in a private network to access the internet using the router's public IP.
  • Out. Interface refers to the router interface that sends packets out to the external network, such as the internet. For example, if your router connects to the internet via ether1-Internet, you set Out. Interface to ether1-Internet to apply NAT on packets leaving through that interface.
    27
    For Action, select 'masquerade'
    Masquerade is a type of Source NAT that allows devices on a private network to access the internet using the router's public IP address. It changes the source IP of outgoing packets to the router's public IP, making it ideal for networks with dynamic IP addresses.
    28
    Change Adapter 2 on the MikroTik VM to 'Internal Network' We can set the name to 'Mikrotik' (optional).
    29
    Change Adapter on the Windows VM to 'Internal Network' and set the name to 'Mikrotik' as well
    30
    Check the IP address on the Windows VM. We get the IP 192.168.14.254 (DHCP).
    31
    We can also check 'IP > DHCP Server > Leases' to see which client has received the IP.
    32
    Check the ping to the gateway and Google
    33