Skip to content

Lab examples#

containerlab aims to provide a simple, intuitive and yet customizable way to run container based labs. To help our users get a glimpse on the features containerlab packages, we ship some essential lab topologies within the containerlab package.

Note

The lab examples featured on this site are very simple on purpose. They meant to show how to add different node kinds to the topology, but they were not designed to showcase a certain use case or lab scenario.

For real-world lab use cases and scenarios, please refer to the clab-topo topic on GitHub, where the community shares their labs checked into GitHub repositories.

We encourage the community to share their labs by adding the clab-topo topic to the repositories containing containerlab topology files; this way we can build a distributed, decentralized, and rich catalog of community-sourced labs for everyone's benefit!

Some labs were contributed to clabs.netdevops.me web site along with the comprehensive description.

These lab examples are meant to be used as-is or as a base layer to a more customized or elaborated lab scenarios. Once containerlab is installed, you will find the lab examples directories by the /etc/containerlab/lab-examples path. Copy those directories over to your working directory to start using the provided labs.

The source code of the lab examples is contained within the containerlab repo unless mentioned otherwise; any questions, issues or contributions related to the provided examples can be addressed via Github issues.

Each lab comes with a definitive description that can be found in this documentation section.

How to deploy a lab from the lab catalog?#

Running the labs from the catalog is easy.

Copy lab catalog#

First, you need to copy the lab catalog to some place, for example to a current working directory. By copying labs from their original place we ensure that the changes we might make to the lab files will not be overwritten once we upgrade containerlab. To copy the entire catalog into your working directory:

# copy over the srl02 lab files
cp -a /etc/containerlab/lab-examples/* .

as a result of this command you will get several directories copied to the current working directory.

Note

Some big labs or community provided labs are typically stored in a separate git repository. To fetch those labs you will need to clone the lab' repo instead of copying the directories from /etc/containerlab/lab-examples.

Get the lab name#

Every lab in the catalog has a unique short name. For example this lab states in the summary table that it's name is srl02. You will find a folder matching this name in your working directory, change into it:

cd srl02

Check images and licenses#

Within the lab directory you will find the files that are used in the lab. Usually, only the topology definition file and, sometimes, config files are present in the lab directory.

If you check the topology file you will see if any license files are required and what images are specified for each node/kind.

Either change the topology file to point to the right image/license or change the image/license to match the topo definition file values.

Deploy the lab#

You are ready to deploy!

containerlab deploy -t <topo-file>

SSH access#

For nodes that come up with ssh enabled, the following lines can be added to the ~/.ssh/config file on the containerlab host system to simplify access and prevent future ssh key warnings:

Host clab-*
  User root
  StrictHostKeyChecking no
  UserKnownHostsFile /dev/null