Manual:CHR GCE

From MikroTik Wiki
Jump to navigation Jump to search

RouterOS CHR supports Google Compute Engine since introduction of VirtIO-SCSI driver in version 6.42rc28. Launching your RouterOS in Google Compute Cloud requires a few modifications to the default RAW Disk image, because Google only allows disk images in 1GB size increments. The following instructions assume you have installed Google Cloud Console CLI tools, but you can do the exact steps from the Google Cloud Console in your web browser, via the GUI, if you don't like to install the CLI tools.

Download the raw disk image archive from Mikrotik

wget https://download2.mikrotik.com/routeros/6.42rc30/chr-6.42rc30.img.zip

Unzip the archive

unzip chr-6.42rc30.img

Expand the image size to 1GB

truncate --size=1G chr-6.42rc30.img

Create the image archive for Google GCE

mv chr-6.42rc30.img disk.raw
tar -Sczf chr-6.42rc30-image.tar.gz disk.raw

Create a bucket to store image archives

gsutil mb gs://cloud-hosted-router-images

Copy the new image to the bucket

gsutil cp chr-6.42rc30-image.tar.gz gs://cloud-hosted-router-images

Create an image for GCE from the archive

gcloud compute images create "routeros" \
--family=cloud-hosted-router \
--description "Mikrotik Cloud Hosted Router (CHR) is a RouterOS version intended for running as a virtual machine." \
--source-uri "https://storage.googleapis.com/cloud-hosted-router-images/chr-6.42rc30-image.tar.gz"

Create an instance

gcloud compute instances create "chr-1" \
--zone "us-central1-c" \
--machine-type "f1-micro" \
--image-family=cloud-hosted-router


Note: For GCE instances, packets leaving the instance must not exceed 1460 bytes. To account for the additional ESP overhead, the recommended MTU value is 1360.


macOS specifics

Please note, that when using macOS, you will need to install gnu-tar (built in macOS tar is not supported for some reason) and truncate via Homebrew. See above as to when the respective commands must be used.

For truncate:

brew install truncate
truncate -s 1G chr-6.42rc30.img

For gnu-tar:

brew install gnu-tar
gtar -Sczf chr-6.42rc30.tar.gz disk.raw