… updated on Friday, May 17, 2024 11:25 +0200
Running netlab and BGP Labs on Apple Silicon
I usually say that you cannot run netlab on Apple Silicon because the vendors don’t provide ARM images. However, when I saw an ARM version of the FRRouting container, I wondered whether I could run the BGP labs (admittedly only on FRR containers) on my M2 MacBook Pro.
TL&DR: Yes, you can do that.
Now for the recipe:
- Install multipass. I used Homebrew to install it.
- Start the default Ubuntu VM
% multipass shell
- Once you get the Ubuntu prompt, install Pip3 and netlab:
$ sudo apt-get update
$ sudo apt install python3-pip
$ pip3 install networklab
- Pip3 creates the
~/.local/bin
directory, which is not yet in the PATH. Logout (exit
or Ctrl-D) and reconnect to the Ubuntu VM (yet again, usingmultipass shell
) - Use
netlab install
to install Ubuntu tools, Containerlab, and Ansible
$ netlab install ubuntu containerlab ansible
- The installation script adds the current user to the
docker
group to allow you to start containers. However, the shell process in the current session is not yet a member of that group, and we probably don’t have enough disk space for the next step anyway. - Log out of the Ubuntu instance.
- Increase the instance disk size and restart it.
% multipass stop primary
% multipass set local.primary.disk=10G
% multipass shell
- You might have to increase the memory allocated to the VM and the number of virtual CPUs it gets. Add these commands in front of the
multipass shell
command:
% multipass set local.primary.cpus=4
% multipass set local.primary.memory=8G
- The multipass instance does not have the Linux kernel drivers we need for FRR management VRF and MPLS forwarding. Log into the Ubuntu instance and install the missing generic Linux drivers:
sudo apt install linux-generic
- Log out of the VM, restart it, and log in:
% multipass restart primary
% multipass shell
- Start a simple lab to test the installation
$ netlab test clab
You’re ready to run labs using FRR containers on your Apple laptop. Install BGP labs and have fun ;)
This is great; thanks for sharing, Ivan. May I know the specs of your Mac Book Pro?
I was testing the labs on a MacBook Air (M2) with 8 GB of RAM
Hi Ivan, thanks for sharing this. However, there seem to be an issue when running the bgp lab 0-ffrouting.
and then the deployment seems to fail too.
Did you change the external devices from Cumulus Linux to FRR (https://bgplabs.net/1-setup/#setting-up-the-labs)?
I had changed them in the defaults.yml, but apparently the issue was that I needed to change them in the lab's topology.yml file too. Thanks!
Ouch, good one. Will fix. Thank you!
Thanks a million for reporting this. Fixed, a plugin switches the devices in that lab from CL to FRR when running on aarch64 architecture.
Anyone having issues installing containerlab?
Install containerlab version 0.49.0 Downloading https://github.com/srl-labs/containerlab/releases/download/v0.49.0/containerlab_0.49.0_linux_amd64.deb curl: (60) SSL certificate problem: unable to get local issuer certificate More details here: https://curl.se/docs/sslcerts.html
curl failed to verify the legitimacy of the server and therefore could not establish a secure connection to it. To learn more about this situation and how to fix it, please visit the web page mentioned above. Failed to install containerlab with the arguments provided: -v 0.49.0 Accepted cli arguments are: [--help|-h ] ->> prints this help [--version|-v <desired_version>] . When not defined it fetches the latest release from GitHub e.g. --version v0.1.1 [--use-pkg] ->> install from deb/rpm packages [--no-sudo] ->> install without sudo [--verify-checksum] ->> verify checksum of the downloaded file For support, go to https://github.com/srl-labs/containerlab/issues
Installation script containerlab.sh failed, exiting...
I have no idea what happened to you. I started a fresh multipass Ubuntu 22.04 instance, followed the recipe, and got containerlab 0.49.0 installed.
I did a bit of a search on the error message you got, and all hits hint that it's a local SSL/CA issue.
Did you try to install containerlab on some other platform? Please note that a fresh Ubuntu 22.04 instance is the only environment in which I have any chance of figuring out what might be wrong. Trying to replicate anything else is way beyond my skill set.
Got it working by exporting local trusted root certs to ubuntu instance and updating the certs. I think because of the company's IT certs. Thanks
buntu@primary:~$ pip3 install networklab error: externally-managed-environment
× This environment is externally managed ╰─> To install Python packages system-wide, try apt install python3-xyz, where xyz is the package you are trying to install.
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages. hint: See PEP 668 for the detailed specification.
python3 -m venv .venv . .venv/bin/activate
pip3 install networklab