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 security group.
- 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 create or select a folder for your infrastructure on 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 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 security group
To open the Mikrotik Cloud Hosted Router web UI from a browser in future, create a security group and allow inbound HTTP connections on port 80. For security, allow connecting only from your current public IP address. Also, allow the entire outbound traffic so that the router could access external resources, including the licensing server:
-
Get
the public IP address of the computer or network to connect to the router from. -
In the management console
, select the folder where you need to create a security group. -
Navigate
to Virtual Private Cloud. -
In the left-hand panel, select
Security groups. -
Click Create security group.
-
Specify the security group name:
mikrotik-router-group. -
In the Network field, select the network to assign the security group to. If you do not have the required network yet, create it.
-
Click Add and specify the new rule settings in the window that opens:
- Traffic direction:
Incoming. - Port range:
80. - Protocol:
TCP. - Source:
Address range. - IPv4 CIDR:
<your_public_IP_address>/32. - Description:
Mikrotik Router.
- Traffic direction:
-
Click Save.
-
Click Add again and specify the outgoing rule settings:
- Traffic direction:
Outgoing. - Port range:
Select all. - Protocol:
Any. - Destination name:
Address range. - IPv4 CIDR:
0.0.0.0/0. - Description:
Mikrotik Router Egress.
- Traffic direction:
-
Click Save.
-
Click Create.
Create a VM with the Mikrotik Cloud Hosted Router
-
In the management console
, navigate to the folder dashboard, click Create resource, and selectVirtual machine instance. -
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 platform, number of vCPUs, and 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 the previously created
mikrotik-router-groupsecurity group was assigned to and a subnet. If you do not have the required subnet yet, create it. - In the Public IP address field, select a static IP address from the list, or leave
Autoto assign your VM a random external IP address from the Yandex Cloud pool. - In the Security groups field, select the
mikrotik-router-groupgroup.
- In the Subnet field, select the network the previously created
-
Under Access, select SSH key and specify the VM access credentials:
- In the Login field, enter a 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.
- In the Login field, enter a 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. - Navigate
to 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.
-
In the management console
, navigate to the folder dashboard, click Create resource, and selectVirtual machine instance. -
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 amount of RAM:- 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:
- In the Login field, enter a 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.
-
- In the Login field, enter a 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.
- Enter the username:
admin. - Enter the previously specified administrator password.
- 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 resources you created: