Skip to content

Module FRR

sat edited this page Jan 3, 2026 · 2 revisions

Module: FRR

This page describes the FRR module for dot2net.

What is FRR?

FRRouting (FRR) is a free and open source Internet routing protocol suite for Linux and Unix platforms. It implements BGP, OSPF, RIP, IS-IS, PIM, LDP, BFD, Babel, PBR, OpenFabric and VRRP.

What the FRR Module Provides

Unlike Containerlab and TiNET modules, the FRR module does not generate output files. Instead, it provides FormatStyles for generating FRR-compatible configuration commands.

Provided FormatStyles

FormatStyle Name Purpose Output Format
frrCmd vtysh command format Shell commands for vtysh

frrCmd FormatStyle

The frrCmd FormatStyle formats configuration lines as vtysh commands suitable for shell execution:

vtysh -c "conf t" -c "router ospf" -c "router-id 10.255.0.1"

This is useful for the startup config block when you want to configure FRR via command line rather than configuration files.

Usage Example

Using frrCmd in startup

module:
  - containerlab
  - frr

nodeclass:
  - name: router
    values:
      image: quay.io/frrouting/frr:8.5.0
      kind: linux
    config:
      # Configure FRR via vtysh commands in startup
      - name: startup
        format: frrCmd
        template:
          - "conf t"
          - "router ospf"
          - "router-id {{ .ip_loopback }}"
          - "network {{ .ip_net }} area 0"

Generated Output

In topo.yaml exec section:

exec:
  - vtysh -c "conf t" -c "router ospf" -c "router-id 10.255.0.1" -c "network 10.0.0.0/24 area 0"

Alternative: Configuration File Approach

For more complex configurations, you may prefer using FRR configuration files instead of vtysh commands:

module:
  - containerlab

file:
  - name: frr.conf
    path: /etc/frr/frr.conf
  - name: daemons
    path: /etc/frr/daemons
  - name: vtysh.conf
    path: /etc/frr/vtysh.conf

nodeclass:
  - name: router
    values:
      image: quay.io/frrouting/frr:8.5.0
      kind: linux
    config:
      - file: frr.conf
        template:
          - "hostname {{ .name }}"
          - "!"
          - "router ospf"
          - " router-id {{ .ip_loopback }}"
          - "{{ .interfaces_ospf_network }}"
          - "!"
      - file: daemons
        sourcefile: ./daemons
      - file: vtysh.conf
        sourcefile: ./vtysh.conf
      - name: startup
        template:
          - "vtysh -b"  # Load configuration from frr.conf

Comparison: Commands vs Config Files

Approach Pros Cons
frrCmd (commands) Simple, no extra files Hard to debug, limited complexity
Config files Full FRR syntax, easier debugging Requires file setup (daemons, vtysh.conf)

Recommendation: Use config files for production scenarios; use frrCmd for simple tests or quick prototypes.

Required FRR Files

When using FRR with configuration files, you typically need:

File Purpose Example Content
frr.conf Main configuration Generated by dot2net
daemons Enable routing daemons ospfd=yes
vtysh.conf vtysh settings service integrated-vtysh-config

Example daemons file

zebra=yes
bgpd=no
ospfd=yes
ospf6d=no
ripd=no
ripngd=no
isisd=no
pimd=no
ldpd=no
nhrpd=no
eigrpd=no
babeld=no
sharpd=no
staticd=no
pbrd=no
bfdd=no
fabricd=no

Example vtysh.conf file

service integrated-vtysh-config

Complete Example with frrCmd

input.yaml

name: ospf_simple
module:
  - containerlab
  - frr

layer:
  - name: ip
    default_connect: true
    policy:
      - name: p2p
        range: 10.0.0.0/16
        prefix: 30
      - name: lo
        type: loopback
        range: 10.255.0.0/24

nodeclass:
  - name: router
    policy: [lo]
    values:
      image: quay.io/frrouting/frr:8.5.0
      kind: linux
    config:
      - name: startup
        format: frrCmd
        template:
          - "conf t"
          - "router ospf"
          - "router-id {{ .ip_loopback }}"
          - "{{ .interfaces_ospf_cmd }}"

interfaceclass:
  - name: default
    policy: [ip]
    config:
      - name: ospf_cmd
        format: frrCmd
        template:
          - "int {{ .name }}"
          - "ip addr {{ .ip_addr }}/{{ .ip_plen }}"
          - "router ospf"
          - "network {{ .ip_net }} area 0"

Generated topo.yaml

name: ospf_simple
topology:
  nodes:
    r1:
      kind: linux
      image: quay.io/frrouting/frr:8.5.0
      exec:
        - vtysh -c "conf t" -c "int net0" -c "ip addr 10.0.0.1/30" -c "router ospf" -c "network 10.0.0.0/30 area 0"
        - vtysh -c "conf t" -c "router ospf" -c "router-id 10.255.0.1"
    r2:
      kind: linux
      image: quay.io/frrouting/frr:8.5.0
      exec:
        - vtysh -c "conf t" -c "int net0" -c "ip addr 10.0.0.2/30" -c "router ospf" -c "network 10.0.0.0/30 area 0"
        - vtysh -c "conf t" -c "router ospf" -c "router-id 10.255.0.2"
  links:
    - endpoints: [r1:net0, r2:net0]

See Also

Clone this wiki locally