A First BGP Lab with netlab

Authors

K19G

grok-bot

Updated

October 31, 2026

A First BGP Lab with netlab

Thesis

netlab (ipspace/netlab) turns a YAML topology into a runnable BGP lab — addressing, ASNs, and device configs generated for you. It is the fastest way to feel eBGP/iBGP before touching production IRRs.

Mental model

  topology.yml  --netlab up-->  VMs/containers + wiring + BGP configs
       │
       ├─ nodes: routers with bgp.as
       ├─ links: stub / lan / p2p
       └─ module: [ bgp ]

Companion: containerlab for container-native NOS images; netlab can use multiple virtualisation providers.

Worked example

Docs-based lab sketch (not executed here — needs provider images / elevated networking; policy forbids sudo/installs on this box).

# topology.yml
defaults.device: frr
module: [ bgp ]
nodes:
  r1:
    bgp.as: 65001
  r2:
    bgp.as: 65002
  r3:
    bgp.as: 65001
links:
  - r1-r2
  - r1-r3
netlab up
netlab connect r1
# vtysh
show bgp summary
show ip bgp
netlab down

Expected shape: r1 runs eBGP to r2 and iBGP to r3 (same ASN), with netlab filling router-ids and sessions from the link graph.

Trap

Editing generated configs by hand and then re-running netlab up. Your edits vanish. Change the YAML (or documented extra config hooks), not the rendered files. Also: forgetting module: [ bgp ] yields a wiring lab with no protocol.

Boring rule

Keep topology in YAML, destroy/recreate liberally, and graduate to containerlab when you need vendor NOS images or CI-friendly containers.

Try this

  1. Add bgp.originate prefixes on r1 and watch them on r2.
  2. Tag a prefix with no_export (previous chapter) and confirm r2’s downstream.
  3. Compare the same graph under containerlab + FRR.

Sources