A First BGP Lab with netlab
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-r3netlab up
netlab connect r1
# vtysh
show bgp summary
show ip bgp
netlab downExpected 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
- Add
bgp.originateprefixes onr1and watch them onr2. - Tag a prefix with
no_export(previous chapter) and confirmr2’s downstream. - Compare the same graph under containerlab + FRR.
Sources
- netlab.tools documentation
- github.com/ipspace/netlab
- containerlab.dev (companion lab tool)