Giter Club home page Giter Club logo

containerlab's Introduction

Arista Virtual Network using GCP and ContainerLab

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.

Step 1: Create GCP Account

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)

Step 2: Create VM Instance

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.

2.1 - Create VM Instance with the following attributes:

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.

2.2 Add SSH Keys fort Authentication

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:

    • Use existing keys or generate a new key pair with ssh-keygen
    • ssh-keygen -t rsa
    • Detailed instructions can be found here
    • Add Public Key to Host
    • Connect to Host using favorite SSH client
  • Windows:

    • Various methods to generate ssh keys can be found here
    • Add Public Key to the Host
    • Connect to Host using Private Key

2.3 - Connect to VM.

Now SSH to VM instance using the assigned public IP address. Note you can make this a static address if desired.

Step 3: Install Docker

Below is a simplified one liner bash script that will install docker to your Linux VM.

bash -c "$(curl http://www.packetanglers.com/installdocker.sh)"

NOTE: Logout and log back in to enable sudo permissions to Docker.

Step 4: Download cEOS Image and import into Docker

The following 2 commands will download an Arista cEOS Container image file and then import it into Docker.

curl http://www.packetanglers.com/images/cEOS-lab-4.29.1F.tar.xz -o cEOS-lab-4.29.1F.tar.xz

Now import this image into Docker - takes approximately 30 secs. Be patient.

docker import cEOS-lab-4.29.1F.tar.xz ceos:4.29.1F

Step 5: Install ContainerLab

This is a one line install script. It will detect the OS

bash -c "$(curl -sL https://get.containerlab.dev)"

Step 6: Clone Example L2LS ContainerLab Topology Repo

git clone https://github.com/PacketAnglers/containerlab.git

Step 7: Start ContainerLab

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

Step 8: Connect to your ContainerLab

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: admin
  • password: admin

Connect to HostA and try pinging HostB.

admin@HOSTA:~$ ping 10.20.20.100

Step 9: Destroy Lab

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

Step 10: Shutdown VM

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

Next Steps

  • Try modifying the topology file to add more nodes and connections.
  • You can save/update startup configs to match your environment.

containerlab's People

Contributors

daadam4 avatar kolson22 avatar matt852 avatar mthiel117 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.