TTR Networks

What is FSM?

Finite State Machine

An FSM (Finite State Machine) is a model of a system that is always in one of a fixed set of states and moves between them only on defined events.

A protocol specification written as an FSM lists every state, every event that can happen (a timer expiring, a packet arriving, a TCP connection opening or failing) and, for each combination, what the router does and which state it moves to next. That precision is what lets two independently written implementations interoperate. BGP defines six neighbour states:

  • Idle: not trying yet, or backing off after an error
  • Connect: waiting for the TCP connection to complete
  • Active: the connection attempt failed, trying again
  • OpenSent and OpenConfirm: OPEN messages exchanged, waiting for KEEPALIVE
  • Established: exchanging routes

OSPF neighbours have their own FSM: Down, Attempt, Init, 2-Way, ExStart, Exchange, Loading and Full. TCP connections follow one too, with states such as SYN-SENT, ESTABLISHED and TIME-WAIT.

For troubleshooting, the state a neighbour is stuck in tells you a lot about what's wrong. A BGP peer cycling between Connect and Active never completes TCP, so look at reachability, the source address or something blocking port 179. One that reaches OpenSent and falls back to Idle usually has a mismatched AS number or a rejected capability. An OSPF neighbour stuck in ExStart or Exchange often points to an MTU mismatch, while one that stops at 2-Way on a LAN is usually normal, because only the DR and BDR go to Full with everyone. A common beginner trap is that BGP's "Active" sounds healthy but means the session is down. The BGP Fundamentals lesson walks through the BGP FSM, and OSPF Fundamentals covers the neighbour states.

Lessons that use FSM

  • Debugging BGP: every session state, reproducedIntermediate · 60 min

    Break a working BGP lab a dozen ways and learn to read each failure: Idle, Connect, Active and OpenSent, max-prefix, firewalls, wrong AS, TTL, hold timers, missing policy and unreachable next hops, all with real FRR output and packet captures.

  • BGP FundamentalsIntermediate · 75 min

    How the Border Gateway Protocol glues the internet together: autonomous systems, sessions, path attributes, best-path selection, iBGP scaling and a hands-on eBGP lab with real FRR configuration.