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:

% 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, using multipass 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 ;)

Next: SR Linux Containers Run on Apple Silicon Continue

4 comments:

  1. This is great; thanks for sharing, Ivan. May I know the specs of your Mac Book Pro? 

    Replies
    1. I was testing the labs on a MacBook Air (M2) with 8 GB of RAM

  2. Hi Ivan, thanks for sharing this. However, there seem to be an issue when running the bgp lab 0-ffrouting.

    ERRO[0000] failed deploy links for node "rtr": failed to Statfs "/proc/4928/ns/net": no such file or directory
    

    and then the deployment seems to fail too.

    fatal: [x1]: UNREACHABLE! => changed=false
      msg: 'Failed to create temporary directory. In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote tmp path in ansible.cfg to a path rooted in "/tmp", for more error information use -vvv. Failed command was: ( umask 77 && mkdir -p "` echo ~/.ansible/tmp `"&& mkdir "` echo ~/.ansible/tmp/ansible-tmp-1710850548.1555705-5034-172158355871746 `" && echo ansible-tmp-1710850548.1555705-5034-172158355871746="` echo ~/.ansible/tmp/ansible-tmp-1710850548.1555705-5034-172158355871746 `" ), exited with result 1'
      unreachable: true
    
    Replies
    1. Did you change the external devices from Cumulus Linux to FRR (https://bgplabs.net/1-setup/#setting-up-the-labs)?

    2. 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!

    3. Ouch, good one. Will fix. Thank you!

    4. Thanks a million for reporting this. Fixed, a plugin switches the devices in that lab from CL to FRR when running on aarch64 architecture.

  3. 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...

    Replies
    1. 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.

    2. 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

  4. 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.

    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.
    
    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.
    
    See /usr/share/doc/python3.12/README.venv for more information.
    

    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.

    Replies
    1. Try this instead:

      python3 -m venv .venv . .venv/bin/activate

      pip3 install networklab

Add comment
Sidebar