Click New
Enter the name, in this case, use 'Mikrotik' and then click Next
Set the memory size to 512 MB (optional)
Choose 'Create a virtual hard disk now'
Choose 'VDI (VirtualBox Disk Image)'
Choose 'Dynamically allocated'
Set 2 GB (optional)
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.
Enable Adapter 3 and choose Host-only Adapter (optional)
Click OK, and then press Start
Click the icon pointed to by the arrow.
Click Add
Select the MikroTik RouterOS ISO file
Click Choose
Click Start
Choose the software installation option
In this case, press 'a' to select all, then press 'i' to install.
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
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.
Press 'n' for 'Do you want to see the software license' option
We need to set a new password
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
Like this one
Click on 'Interfaces' and rename ether1 to ether1-Internet and ether2 to ether2-Client
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.
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
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'.
Click on 'IP > DNS' and set the DNS servers to 8.8.8.8 and 8.8.4.4 (Google's DNS)
Click on 'IP > Routes > New' and add the gateway 10.0.2.2, which is the NAT gateway
Click on 'IP > DHCP Server > DHCP Setup', select 'ether2-Client', then click 'Next' until the setup is complete
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.
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.
Change Adapter 2 on the MikroTik VM to 'Internal Network' We can set the name to 'Mikrotik' (optional).
Change Adapter on the Windows VM to 'Internal Network' and set the name to 'Mikrotik' as well
Check the IP address on the Windows VM. We get the IP 192.168.14.254 (DHCP).
We can also check 'IP > DHCP Server > Leases' to see which client has received the IP.
Check the ping to the gateway and Google