This repository outlines the steps needed to create a virtual network with Arista cEOS container image running on a Virtual Instance in Google Cloud Platform (GCP) utilizing ContainerLab.
NOTE: It is not a requirement to run a VM in GCP. You may use a VM of your choice that supports Docker and ContainerLab and skip steps 1 & 2.
You need a Gmail account and then you can activate your GCP account. Details on how to create your GCP Free Account can be found here. Free $300 Credit to use for 90 days. No autocharge after free trial ends.
Typical VM Usage Fee is: $0.25/hr (8 vCPUs 32GM RAM)
Disk and Public Static IP Address - additional cost (but minimal)
From GCP Console, go to the Compute Engine section. If this is your first time creating a VM instance in GCP, you will need to enable Compute Engine API. This takes a few seconds to complete.
Once complete, you will be able to add a new VM Instance by clicking CREATE INSTANCE
. Use the follow instance attributes to create a VM capable of sufficiently running several cEOS instances for your ContainerLab environiment. Detailed instructions to create a VM Instance can be found here.
Parameter | Value |
---|---|
Name | < hostname of VM > |
Region | < your choice > |
Zone | < your choice > |
Machine Series | E2 |
Machine type | e2-standard-8 (8vCPUs and 32GB RAM) |
Boot Disk | |
Operating System | Ubuntu |
Version | 20.04 LTS |
Boot disk type | Balanced persistent disk |
Size (GB) | 20 |
Firewall | |
Allow HTTP Access | Yes |
Now click CREATE
at the bottom.
After Instance boots, add your Public SSH Key to the VM Instance. In GCP, edit your VM instance and scroll down to the Security and Access
section. Click ADD ITEM
to add your ssh key. Then click SAVE
at the bottom.
Mac:
ssh-keygen -t rsa
Windows:
Now SSH to VM instance using the assigned public IP address. Note you can make this a static address if desired.
Below is a simplified one liner bash script that will install docker to your Linux VM.
bash -c "$(curl https://raw.githubusercontent.com/PacketAnglers/containerlab/main/images/installdocker.sh)"
NOTE: Logout and log back in to enable sudo permissions to Docker.
Under Arista-Support-Software download a cEOS image of your choice. Arista account required. Create a free account with your business email if needed.
Now import this image into Docker - takes approximately 30 secs. Be patient.
# Sample import command, modify as needed for the image you downloaded
docker import cEOS-lab-4.30.3M.tar.xz ceos:4.30.3M
This is a one line install script. It will detect the OS
bash -c "$(curl -sL https://get.containerlab.dev)"
git clone https://github.com/PacketAnglers/containerlab.git
Below is a simple L2LS Topology that is part of the repo you just cloned.
sudo clab deploy -t containerlab/topologies/L2LS/L2LS.yaml --reconfigure
Point your browser to the the public IP of your VM at this URL:
http://< VM public ip >/graphite
Click on SPINE1 to connect via a web/ssh session (IPv4/SSH) link.
Login with credentials:
username:
adminpassword:
admin
Connect to HostA and try pinging HostB.
admin@HOSTA:~$ ping 10.20.20.100
When you are done using your lab, run the destroy command to shutdown the lab clean up docker containers.
sudo clab destroy -t containerlab/topologies/L2LS/L2LS.yaml
From GCP Console, make sure you shutdown your VM when you are not using it. You also can create Instance Schedules to ensure VMs are shutdown at a certain time of day.
NOTE: This works as well.
sudo shutdown -h now