FreeTransit Learning Centre
Courses, videos and practical exercises for learning inter-domain routing and BGP policy.
BGP foundations
BGP is a policy protocol. Establishing a session is the easy part; deciding what to accept, prefer and export is the real work.
What to learn first
IP routing and CIDR
You should understand:
- binary prefix lengths and subnet boundaries;
- longest-prefix matching;
- connected, static and dynamic routes;
- default routes and more-specific routes;
- IPv4 and IPv6 addressing;
- forwarding versus the routing control plane.
Start with APNIC Academy — Routing Fundamentals. The course includes routing basics and introductory examples for BGP, OSPF and IS-IS.
BGP concepts
Learn these concepts before configuration syntax:
- autonomous systems and AS numbers;
- eBGP versus iBGP;
- BGP session states and messages;
- network origination;
- path-vector routing;
- address families;
- next-hop resolution;
- best-path selection;
- customer, provider and peer relationships.
Recommended material:
- APNIC Academy — Introduction to BGP
- DE-CIX BGP webinar series
- APNIC IPv4/IPv6 BGP workshop playlist on YouTube
- APNIC — Intro to BGP video
BGP attributes and policy
At minimum, understand:
AS_PATHfor loop detection and path policy;NEXT_HOPand why a received path can be unusable;LOCAL_PREFfor choosing an outbound path inside your AS;MEDas a limited inter-AS hint;- standard, large and well-known communities;
- AS-path prepending and its limitations;
- why inbound traffic engineering is never fully under your control.
Useful resources:
- BGP communities 101 — media.ccc.de
- Open-source BGP routing-policy labs
- Use BGP communities in routing policies — practical lab
A safe first lab
Use documentation address space and private ASNs only. Keep the lab disconnected from production routing.
Suggested topology:
- AS64512: your test network, with two routers;
- AS64513: simulated provider A;
- AS64514: simulated provider B;
192.0.2.0/24: originated by AS64512;198.51.100.0/24: originated by AS64513;203.0.113.0/24: originated by AS64514;- IPv6 documentation prefixes from
2001:db8::/32for the IPv6 version of the lab.
Complete these exercises:
- Establish one IPv4 and one IPv6 eBGP session.
- Originate exactly one prefix from each AS.
- Apply explicit import and export policies with a final deny.
- Verify that AS64512 exports only its own prefix.
- Add a second provider and use local preference to choose the preferred outbound path.
- Use AS-path prepending on one link and observe how the other AS chooses a path.
- Attach a community and use it to change local preference.
- Set a realistic prefix limit and test the failure behaviour.
- Leak routes learned from provider A toward provider B and confirm that the export policy blocks them.
- Remove the export policy in the lab, observe the leak, restore the policy and document the rollback.
- Shut a session gracefully and confirm that traffic moves as expected.
- Repeat the exercises for IPv6 rather than assuming the IPv4 policy automatically protects IPv6.
Lab platforms
BGP Labs
BGP Labs provides open-source exercises for eBGP, iBGP, routing policy, communities, route reflectors, prefix limits and failure scenarios. It supports multiple network operating systems, including FRRouting, Junos, RouterOS and VyOS.
Containerlab
Containerlab creates repeatable container-based network topologies. Start with the FRRouting example and then review the peering lab.
FRRouting
FRRouting is suitable for a low-cost Linux lab:
Do not copy a configuration into production without understanding its default behaviour, software version and platform-specific differences.
Move on when
Continue to the DN42 and operational-security sections when you can:
- build the lab again without following a line-by-line configuration;
- explain every accepted and exported route;
- demonstrate that a simulated route leak is blocked;
- recover from a broken policy through out-of-band access;
- verify both the local routing table and the advertisements sent to each neighbour.