FreeTransit
Learning Centre navigation

FreeTransit Learning Centre

Courses, videos and exercises for learning inter-domain routing and BGP policy.

BGP foundations

Bringing up a BGP session takes a few lines of configuration. Most of the work, and most of the outages, come from policy: what you accept, what you prefer and what you pass on.

What to learn first

IP routing and CIDR

You should be comfortable with:

  • prefix lengths and subnet boundaries in binary
  • longest-prefix matching
  • connected, static and dynamic routes
  • default routes and more-specific routes
  • IPv4 and IPv6 addressing
  • the difference between forwarding and the routing control plane

APNIC Academy: Routing Fundamentals covers this and gives a first look at BGP, OSPF and IS-IS.

BGP concepts

Learn these before you learn any configuration syntax:

  • autonomous systems and AS numbers
  • eBGP and iBGP
  • session states and message types
  • how a network is originated
  • path-vector routing
  • address families
  • next-hop resolution
  • best-path selection
  • customer, provider and peer relationships

Material:

BGP attributes and policy

At minimum, know:

  • AS_PATH, used for loop detection and path policy
  • NEXT_HOP, and why a received path can be unusable
  • LOCAL_PREF, which picks your outbound path
  • MED, a weak hint between neighbouring ASes
  • standard, large and well-known communities
  • AS-path prepending, and why it often does less than you hope
  • why you can influence inbound traffic but never fully control it

Resources:

A first lab

Use private ASNs and documentation prefixes only, and keep the lab away from any production routing.

Topology:

  • AS64512: your test network, 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
  • prefixes from 2001:db8::/32 for the IPv6 version

Exercises:

  1. Bring up one IPv4 and one IPv6 eBGP session.
  2. Originate exactly one prefix from each AS.
  3. Write explicit import and export policies that end in a deny.
  4. Check that AS64512 exports only its own prefix.
  5. Add the second provider and use local preference to choose the outbound path.
  6. Prepend on one link and watch how the other ASes choose their path.
  7. Attach a community and use it to set local preference.
  8. Set a realistic prefix limit, exceed it, and see what your daemon does.
  9. Try to leak provider A's routes to provider B and confirm the export policy blocks them.
  10. Remove the export policy, watch the leak happen, restore the policy and write down how you rolled back.
  11. Shut a session gracefully and check that traffic moves the way you expected.
  12. Repeat everything for IPv6. An IPv4 policy does not protect IPv6.

Lab platforms

BGP Labs

BGP Labs has open-source exercises on eBGP, iBGP, routing policy, communities, route reflectors, prefix limits and failures. It runs on several network operating systems, among them FRRouting, Junos, RouterOS and VyOS.

Containerlab

Containerlab builds repeatable topologies from containers. Start with the FRRouting example, then try the peering lab.

FRRouting and BIRD

Both run on an ordinary Linux machine and cost nothing:

Don't paste a lab configuration into production until you know its defaults, the software version it was written for and how your platform differs.

Move on when

Go on to DN42 and the operations pages once you can:

  • rebuild the lab without following a configuration line by line
  • explain why each accepted and exported route is there
  • show that a simulated leak is blocked
  • recover from a broken policy through out-of-band access
  • check both your routing table and what you actually send to each neighbour