Installing a Mikrotik CHR virtual router
In Yandex Cloud, you can deploy a virtual Mikrotik Cloud Hosted Router on a ready-made VM image. To install the Mikrotik Cloud Hosted Router and check how it runs:
- Get your cloud ready.
- Create a VM with the Mikrotik Cloud Hosted Router.
- Log in to your VM and change your password.
- Create a test VM.
- Check the connection between the router and test VM.
If you no longer need the resources you created, delete them.
Get your cloud ready
Sign up for Yandex Cloud and create a billing account:
- Navigate to the management console
and log in to Yandex Cloud or create a new account. - On the Yandex Cloud Billing
page, make sure you have a billing account linked and it has theACTIVEorTRIAL_ACTIVEstatus. If you do not have a billing account, create one and link a cloud to it.
If you have an active billing account, you can navigate to the cloud page
Learn more about clouds and folders here.
Required paid resources
Alert
When using a Mikrotik Cloud Hosted Router image without a license, the router throughput is limited to 1 Mbps. To remove this limitation, install a license
The cost of using a virtual router and a test VM includes:
- Fee for the disks and continuously running VMs (see Yandex Compute Cloud pricing).
- Fee for using a public IP address (see Yandex Virtual Private Cloud pricing).
Create a VM with the Mikrotik Cloud Hosted Router
-
On the folder dashboard of the management console
, click Create resource and selectVirtual machine instance. -
Select Advanced setup.
-
Under Boot disk image, in the Product search field, enter
Cloud Hosted Routerand select a public Cloud Hosted Router image. -
Under Location, select an availability zone to create your VM in. If you do not know which availability zone you need, leave the default one.
-
Under Computing resources, navigate to the
Customtab and specify the required platform, number of vCPUs, and the amount of RAM:- Platform:
Intel Ice Lake - vCPU:
2 - Guaranteed vCPU performance:
100% - RAM:
2 GB
- Platform:
-
Under Network settings:
- In the Subnet field, select the network and subnet to connect your VM to. If the required network or subnet is not there, create it.
- Under Public IP address, leave
Autoto assign a random external IP address to your VM from the Yandex Cloud pool. Alternatively, select a static address from the list if you reserved one.
-
Under Access, select SSH key and specify the VM access credentials:
- Under Login, enter the username. Do not use
rootor other reserved usernames. -
In the SSH key field, select the SSH key saved in your organization user profile.
If there are no SSH keys in your profile or you want to add a new key:
-
Click Add key.
-
Enter a name for the SSH key.
-
Select one of the following:
-
Enter manually: Paste the contents of the public SSH key. You need to create an SSH key pair on your own. -
Load from file: Upload the public part of the SSH key. You need to create an SSH key pair on your own. -
Generate key: Automatically create an SSH key pair.When adding a new SSH key, an archive containing the key pair will be created and downloaded. In Linux or macOS-based operating systems, unpack the archive to the
/home/<user_name>/.sshdirectory. In Windows, unpack the archive to theC:\Users\<user_name>/.sshdirectory. You do not need additionally enter the public key in the management console.
-
-
Click Add.
The system will add the SSH key to your organization user profile. If the organization has disabled the ability for users to add SSH keys to their profiles, the added public SSH key will only be saved in the user profile inside the newly created resource.
-
Note that you only need this data for VM creation. You cannot use the data for router access.
- Under Login, enter the username. Do not use
-
Under General information, specify the VM name:
mikrotik-router. -
Click Create VM.
It may take a few minutes to create a VM. When the VM status changes to RUNNING, you can log in.
Alert
Set a complex administrator password immediately after VM creation. To keep access to the router, you need to change the admin password within 5 minutes after the start.
Change the administrator password on the router
The router is created with a public IP address, so you need to change the default administrator password for security reasons.
- In the management console
, select the folder. - In the list of services, select Compute Cloud.
- Copy the
mikrotik-routerVM public IP address and open it in your browser. - On the page that opens, enter the VM’s internal IP address in the IP Address field.
- In the Password field, enter the new administrator password, confirm it in the Confirm Password field, and click Apply Configuration. You can apply other settings later.
Create a test VM
Create a test VM in the subnet that hosts the router, to test connectivity between the router and VM.
-
On the folder dashboard of the management console
, click Create resource and selectVirtual machine instance. -
Select Advanced setup.
-
Under Boot disk image, in the Product search field, enter
Ubuntuand select a public Ubuntu image. -
Under Location, select the availability zone the
mikrotik-routerVM resides in. -
Under Computing resources, navigate to the
Customtab and specify the platform, number of vCPUs, and RAM size:- Platform:
Intel Ice Lake - vCPU:
2 - Guaranteed vCPU performance:
20% - RAM:
1 GB
- Platform:
-
Under Network settings:
- In the Subnet field, select the network and subnet hosting the
mikrotik-routerVM. - In the Public IP address field, select
No address.
- In the Subnet field, select the network and subnet hosting the
-
Under Access, select SSH key and specify the VM access credentials:
- Under Login, enter the username. Do not use
rootor other reserved usernames. To perform operations requiring superuser privileges, use thesudocommand. -
In the SSH key field, select the SSH key saved in your organization user profile.
If there are no SSH keys in your profile or you want to add a new key:
-
Click Add key.
-
Enter a name for the SSH key.
-
Select one of the following:
-
Enter manually: Paste the contents of the public SSH key. You need to create an SSH key pair on your own. -
Load from file: Upload the public part of the SSH key. You need to create an SSH key pair on your own. -
Generate key: Automatically create an SSH key pair.When adding a new SSH key, an archive containing the key pair will be created and downloaded. In Linux or macOS-based operating systems, unpack the archive to the
/home/<user_name>/.sshdirectory. In Windows, unpack the archive to theC:\Users\<user_name>/.sshdirectory. You do not need additionally enter the public key in the management console.
-
-
Click Add.
The system will add the SSH key to your organization user profile. If the organization has disabled the ability for users to add SSH keys to their profiles, the added public SSH key will only be saved in the user profile inside the newly created resource.
-
- Under Login, enter the username. Do not use
-
Under General information, specify the VM name:
test-vm. -
Click Create VM.
Check the connection between the router and test VM
Alert
If you use WinBox to access the router, connect to the router using the VM IP address. MAC access is not supported in Yandex Cloud.
Make sure that a network connection is established between the router and test VM:
- Open the router's administrator interface in the browser.
- Click Terminal.
- In the terminal that opens, run the
ping <test_VM_internal_IP_address>command.
If the packets reach the test VM, you can start configuring the router. You can find the router manual in the Mikrotik documentation
Delete the resources you created
To stop paying for the deployed resources, delete the mikrotik-router and test-vm VMs.
If you reserved a public static IP address, delete it.