Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/caveats.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ diag debug application httpsd -1
**FRR VM caveats:**

* The VM version of FRR is a Debian VM. The FRR package is downloaded and installed during **vagrant up** processing in the libvirt environment. To postpone the FRR installation to the initial configuration process, set the node variable **netlab_quick_start** to `true`.
* You can [build a custom FRR VM](build-frr) with a preinstalled **frr** package to speed up the **vagrant up** processing.

**FRR container caveats:**

Expand Down
45 changes: 45 additions & 0 deletions docs/labs/frr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
(build-frr)=
# Building an FRRouting Libvirt Box

By default, _netlab_ uses Debian Vagrant boxes to start FRRouting virtual machines. The Debian boxes do not contain the FRR package (or a few other packages). These packages are installed whenever a lab starts, resulting in significantly longer start times.

You can use the **netlab libvirt package** command to build a custom FRRouting Vagrant box:

* Use the **netlab show images -d frr** to find the Debian release we use for FRR virtual machines
* Download the latest relevant Debian **-generic-amd64.qcow2** image from [Debian Official Cloud Images](https://cloud.debian.org/images/cloud/) (the Bookworm images are [here](https://cloud.debian.org/images/cloud/bookworm/latest/)) into an empty directory
* Execute **netlab libvirt package frr _img-file-name_** and follow the instructions

```{warning}
If you're using a *‌netlab* release older than 1.8.2, or if you're using a Linux distribution other than Ubuntu, please [read the box-building caveats first](libvirt-box-caveats.md).
```

**netlab libvirt package** starts the Debian VM and uses **cloud-init** to configure it, install additional software packages, and shut it down.

All you have to do is identify the FRR version that was installed on the VM and pass it to the **netlab libvirt package** command when it asks for the box version. Scroll through the printouts and find the end-of-installation message that should look similar to this:

```
[ 21.094634] cloud-init[500]: Installation complete
[ 21.095042] cloud-init[500]: =================================
[ 21.100452] cloud-init[500]: FRR version installed: 10.5.1
[ 21.100844] cloud-init[500]: =================================
```

```{tip}
If the installation process fails, the VM remains running. You can log in as user **vagrant** (password **vagrant**) and investigate the cause of the error (or [open an issue](https://github.com/ipspace/netlab/issues/new/choose)). To disconnect from the VM, use the **virsh** disconnect sequence (usually `Ctrl-]`).
```

After finishing the box-building process, the **netlab libvirt package** command tells you how to use the custom box in a lab topology or as a default FRR box:

```
You created a custom Vagrant box. To use this box in a lab topology, add the
following setting to the lab topology:

defaults.devices.frr.libvirt.image: netlab/frr

Alternatively, use the "netlab defaults" command to set the custom box as the
directory-, project- or user default, for example:

netlab defaults devices.frr.libvirt.image=netlab/frr
```

Finally, use the **netlab libvirt remove --box netlab/frr** command if you want to remove the custom FRR Vagrant box.
2 changes: 2 additions & 0 deletions docs/labs/libvirt.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ These documents contain box-building recipes using the **netlab libvirt** utilit
* [Cumulus Linux 5.x](cumulus_nvue.md)
* [Dell OS10](dellos10.md) by [Stefano Sasso](http://stefano.dscnet.org)
* [Fortinet FortiOS](fortios.md) - instructions based on the [work](https://blog.petecrocker.com/post/fortinet_vagrant_libvirt/) by [Pete Crocker](https://blog.petecrocker.com/about/) for 6.x/7.0 and updated for 7.4/7.6 in this [blog post](https://noodleops.space/2025-06/add-a-fortigate-in-your-virtual-lab-from-qcow-to-netlab-by-creating-a-vagrant-box/) by [Seb d'Argoeuves](https://noodlesops.space/about/).
* [FRRouting](frr.md) (Debian VM with preinstalled **frr** package)
* [Juniper vPTX](vptx.md)
* [Juniper vSRX 3.0](vsrx.md)
* [Mikrotik RouterOS 7](routeros7.md) - based on the original [Mikrotik RouterOS](http://stefano.dscnet.org/a/mikrotik_vagrant/) by [Stefano Sasso](http://stefano.dscnet.org)
Expand Down Expand Up @@ -304,6 +305,7 @@ providers.libvirt.probe: []
csr.md
cumulus_nvue.md
fortios.md
frr.md
iosv.md
iosvl2.md
iosxr.md
Expand Down
2 changes: 1 addition & 1 deletion docs/platforms.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ You cannot use all supported network devices with all virtualization providers.
| Cumulus Linux 5.x (NVUE) | ✅ | ✅ | ✅[❗](caveats-cumulus) |
| Dell OS10 | [✅](build-dellos10) | ❌ | ✅ |
| Fortinet FortiOS | ✅ | ❌ | ✅ |
| FRR | [❗](caveats-frr) | ✅[❗](caveats-frr) | ✅ |
| FRR | [✅](build-frr)[❗](caveats-frr) | ✅[❗](caveats-frr) | ✅ |
| Generic Linux (Ubuntu/Alpine) [❗](labs/linux.md) | ✅ | ✅ | ✅ |
| Juniper vMX | ❌ | ❌ | ✅[❗](clab-vrnetlab) |
| Juniper vPTX | [✅](build-vptx) | ❌ | ✅[❗](clab-vrnetlab) |
Expand Down
3 changes: 3 additions & 0 deletions netsim/devices/frr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ clab:

libvirt:
image: debian/bookworm64
create_image: netlab/frr
create_template: frr.xml.j2
create_iso: frr
group_vars:
ansible_connection: paramiko
ansible_user: vagrant
Expand Down
62 changes: 62 additions & 0 deletions netsim/install/libvirt/frr.xml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<domain type='kvm'>
<name>vm_box</name>
<memory unit='MiB'>1024</memory>
<currentMemory unit='MiB'>1024</currentMemory>
<vcpu placement='static'>1</vcpu>
<resource>
<partition>/machine</partition>
</resource>
<os>
<type arch='x86_64'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<cpu mode='host-model' check='partial'/>
<clock offset='utc' />
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<pm>
<suspend-to-mem enabled='no'/>
<suspend-to-disk enabled='no'/>
</pm>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='{{ user.cwd }}/vm.qcow2'/>
<backingStore />
<target dev='vda' bus='virtio'/>
<alias name='virtio-disk0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source file='{{ user.cwd }}/bootstrap.iso' index='1'/>
<backingStore/>
<target dev='hda' bus='ide'/>
<readonly/>
<alias name='ide0-0-0'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<controller type='usb'/>
<controller type='pci' index='0' model='pci-root'/>
<controller type='ide' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
<interface type='network'>
<source network='vagrant-libvirt'/>
<model type='virtio'/>
</interface>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<memballoon model='virtio'/>
</devices>
</domain>
1 change: 1 addition & 0 deletions netsim/install/libvirt/frr/meta-data
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
local-hostname: frr
84 changes: 84 additions & 0 deletions netsim/install/libvirt/frr/user-data
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#cloud-config
hostname: frr
create_hostname_file: true
fqdn: lab.local
ssh_pwauth: true
disable_root: false
system_info:
default_user:
name: vagrant

network:
version: 2
ethernets:
eth0:
dhcp4: true

users:
- name: vagrant
groups: [sudo]
shell: /bin/bash
sudo: ['ALL=(ALL) NOPASSWD:ALL']
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN1YdxBpNlzxDqfJyw/QKow1F+wvG9hXGoqiysfJOn5Y vagrant insecure public key

chpasswd:
expire: false
list: |
root:vagrant
vagrant:vagrant

bootcmd:
- sed -i 's/^GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200 net.ifnames=0 biosdevname=0"/' /etc/default/grub
- update-grub

runcmd:
- [ sh, "/etc/netlab-install.sh" ]

write_files:
- path: /etc/netlab-install.sh
permissions: '0755'
content: |
#!/bin/bash
Comment thread
ipspace marked this conversation as resolved.
set -e
export DEBIAN_FRONTEND=noninteractive
echo "Installing ifupdown, GPG, curl, and iproute2"
apt-get update -qq >/dev/null
apt-get install -qq ifupdown curl gnupg iproute2 >/dev/null
echo "Installing FRR"
curl -s https://deb.frrouting.org/frr/keys.asc >/etc/apt/trusted.gpg.d/frr.asc
FRRVER="frr-stable"
echo deb https://deb.frrouting.org/frr $(lsb_release -s -c) $FRRVER > /etc/apt/sources.list.d/frr.list
apt-get update -qq >/dev/null
apt-get install -qq frr frr-pythontools bridge-utils ethtool >/dev/null
systemctl disable systemd-networkd --now
systemctl mask systemd-networkd
systemctl disable systemd-resolved --now
systemctl mask systemd-resolved
systemctl enable networking --now
echo "Installation complete"
echo
echo
echo "================================="
echo "FRR version installed: $(dpkg-query -W -f='${Version}\n' frr | cut -d- -f1)"
echo "================================="
echo
echo
shutdown -P now
- path: /etc/network/interfaces
content: |
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp
- path: /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
content: |
network: {config: disabled}