Build Your First Lab in Containerlab with FRRouting

Introduction

In this tutorial, we’ll build our first virtual network using Containerlab and FRRouting (FRR). We’ll deploy three routers, configure OSPF, and verify connectivity between their loopback interfaces. This simple lab introduces the workflow we’ll use in more advanced networking exercises.

The lab is independent of the hypervisor used to host Containerlab. If you haven’t installed it yet, start with my Containerlab installation guide for Ubuntu Server on Proxmox.

Prerequisites

  • A working Containerlab and Docker installation on Linux
  • Terminal access and permission to run Docker and Containerlab commands
  • A text editor such as nano
  • Internet access to pull the FRRouting image, if not already cached

Video Walkthrough

Our Three-Router OSPF Topology

We’ll connect R1, R2, and R3 in a triangle. Each router has two point-to-point connections and a loopback interface. All three routers will run OSPF in area 0, advertising their connected links and loopbacks.

Three FRRouting routers R1, R2 and R3 connected in a triangle for a single-area OSPF lab.

Create the Lab Files

First, create a directory for the lab and navigate into it:

mkdir -p ~/containerlab/labs/myfirstlab
cd ~/containerlab/labs/myfirstlab

Now create the topology file, myfirstlab.clab.yaml:

nano myfirstlab.clab.yaml

Paste the following YAML, keeping the indentation intact:

name: myfirstlab

topology:
  defaults:
    kind: frr
    image: quay.io/frrouting/frr:containerlab-10.7.1
    daemons:
      - ospfd

  nodes:
    r1:
      startup-config: r1.conf
    r2:
      startup-config: r2.conf
    r3:
      startup-config: r3.conf

  links:
    - endpoints: ["r1:eth1", "r2:eth1"]
    - endpoints: ["r1:eth2", "r3:eth1"]
    - endpoints: ["r2:eth2", "r3:eth2"]

The nodes section defines our three FRRouting containers. The links section connects their interfaces, while startup-config identifies the configuration file for each router. The ospfd daemon provides OSPF functionality.

Configure the Routers

Create r1.conf, r2.conf, and r3.conf in the same directory as the YAML file. Each router has two transit interfaces and a loopback address.

R1: r1.conf

frr defaults traditional
hostname R1
!
interface eth1
ip address 10.0.12.1/30
!
interface eth2
ip address 10.0.13.1/30
!
interface lo
ip address 1.1.1.1/32
!
router ospf
ospf router-id 1.1.1.1
network 10.0.12.0/30 area 0
network 10.0.13.0/30 area 0
network 1.1.1.1/32 area 0
!

R2: r2.conf

frr defaults traditional
hostname R2
!
interface eth1
ip address 10.0.12.2/30
!
interface eth2
ip address 10.0.23.1/30
!
interface lo
ip address 2.2.2.2/32
!
router ospf
ospf router-id 2.2.2.2
network 10.0.12.0/30 area 0
network 10.0.23.0/30 area 0
network 2.2.2.2/32 area 0
!

R3: r3.conf

frr defaults traditional
hostname R3
!
interface eth1
ip address 10.0.13.2/30
!
interface eth2
ip address 10.0.23.2/30
!
interface lo
ip address 3.3.3.3/32
!
router ospf
ospf router-id 3.3.3.3
network 10.0.13.0/30 area 0
network 10.0.23.0/30 area 0
network 3.3.3.3/32 area 0
!

Each /30 subnet addresses a point-to-point link, while each /32 identifies a router’s loopback. The OSPF network statements enable OSPF on matching interfaces in area 0, allowing the routers to form adjacencies and advertise their networks. We’ll use the loopbacks to test connectivity.

Deploy the Lab

With all four files saved in the same directory, deploy the lab from the Linux shell:

sudo containerlab deploy -t myfirstlab.clab.yaml

Containerlab creates one container per router and connects their interfaces. A successful deployment lists all three routers.

Containerlab deployment output listing the three FRRouting containers.

Verify OSPF and Routing

From the Linux shell, open R1’s FRRouting command-line interface:

docker exec -it clab-myfirstlab-r1 vtysh

vtysh provides an integrated CLI for FRRouting. Check the interfaces, OSPF neighbors, and learned routes:

show interface brief
show ip ospf neighbor
show ip route ospf

R1 should have two OSPF neighbors in the Full state and routes to R2’s 2.2.2.2/32 and R3’s 3.3.3.3/32 loopbacks. The neighbor command confirms OSPF adjacencies, while the routing table confirms the routes were learned.

R1 FRRouting CLI showing interface information and two OSPF neighbors.

Test Connectivity

While still in R1’s vtysh CLI, ping the loopback addresses of R2 and R3 directly from the R1 prompt, as shown in the screenshot:

ping 2.2.2.2
ping 3.3.3.3

Successful replies demonstrate that the remote loopbacks are reachable. If the tests fail, inspect the interface addresses, OSPF neighbors, and learned routes.

Terminal output showing ping replies from the test lab.

Summary

We’ve deployed our first three-router network in Containerlab, configured OSPF using FRRouting, and verified that the routers can exchange routes and reach each other’s loopbacks. We now have a repeatable process: define the topology, create the configurations, deploy the lab, and test connectivity.

This is just the beginning of the Building a Free Enterprise Networking Lab series. We’ll build on this foundation in future networking labs.

When you’re finished, remove the running lab with:

sudo containerlab destroy -t myfirstlab.clab.yaml

Leave a Comment