Lightweight, fast to deploy, and reproducible containerlabs are meant to be shared via Git. But sometimes, you can't quite share the entire lab... Maybe the recipient doesn't have access to the container images or has other limitations that prevent them from running a copy of you lab.
Yet, you might find yourself in need to share access of your lab with one or many users. Quite often you want someone else to have a look at your lab when you found something or got stuck. Or maybe you are a lecturer and want to broadcast your lab interaction to your students.
Here we will discuss different ways how you can share your lab with others in a secure and interactive way.
SSHX is a web-based terminal emulator that allows you to share access to a terminal sessions with others and have a collaborative terminal experience.
Containerlab users can leverage this handy free service1 to share lab access with read/write and read-only access by adding a simple container with sshx to their set of lab nodes:
By adding the sshx node to this simple lab and deploying it, you will see an sshx link in the lab output:
# the rest of the deploy log is omitted for brevity21:44:15INFORunningpostdeployactionskind=nokia_srlinuxnode=srl
21:44:28INFOExecutedcommandnode=sshxcommand="ash -c curl -sSf https://sshx.io/get | sh > /dev/null"stdout=""21:44:28INFOExecutedcommandnode=sshxcommand="ash -c sshx -q --enable-readers > /tmp/sshx &"stdout=""21:44:28INFOExecutedcommandnode=sshxcommand="cat /tmp/sshx"stdout=│https://sshx.io/s/94eAaunO2L#CbTbaD6bqB90oU,mCIP5PtBmF41qL
21:44:28INFOAddinghostentriespath=/etc/hosts
21:44:28INFOAddingSSHconfigfornodespath=/etc/ssh/ssh_config.d/clab-shared-lab.conf
Take a look at the stdout line that contains the sshx link:
By pasting this link in a browser you will get a collaborative terminal session in the browser where you can open many shell windows that will belong to the sshx container that runs from the ghcr.io/srl-labs/network-multitool with lots of networking tools installed.
The great part is that this sshx container has access to all other lab nodes and you can refer to them by name, as they appear in your topology file. For example, we can ssh to the SR Linux container that is part of our lab:
Attentive reader also noticed that sshx link has two parts separated by a comma. If you copy the link from the beginning to a comma, you get a link that has read-only access. Share this link with someone and they will be able to see by can not touch...
The full link gives read/write access, and users with a link would be able to open terminals and execute commands in the shell.
You can also provide the sshx-based access to a lab on demand, even if your lab file did not feature the sshx node from the beginning. To do so, run the adhoc command to create a container in the docker network that your lab uses (clab by default):