BGP Sessions and AS Paths
Why networks need BGP
Imagine three independent networks, each administered by a different team. Each team decides which destinations it can reach and which neighbors it trusts to carry traffic. An autonomous system (AS) is a routing domain with a coherent external routing policy; its AS number (ASN) identifies it in BGP. BGP-4 exchanges reachability between ASes and can distribute that information within an AS. It does not discover physical cable layouts or measure the fastest Internet path. Internal routing such as OSPF can still provide connectivity between BGP speakers.
Read a fictional AS path
In this paper topology, AS 64498 originates a documentation prefix. The two inter-AS links represent eBGP (external BGP). Each ordinary eBGP advertisement adds the advertising AS at the front of the path. At AS 64496, the path lists the neighboring AS first and the originating AS last in this simple ordered example. Two routers inside AS 64496 can share the route using iBGP (internal BGP) without adding 64496 to AS_PATH. If an ordinary received path already contains the local ASN, exclude it from selection to prevent an AS-level loop. This is not a guarantee against every possible forwarding loop.
Prefix: 203.0.113.0/24AS 64496 --- AS 64497 --- AS 64498At AS 64497: AS_PATH = 64498At AS 64496: AS_PATH = 64497 64498Session lifecycle and messages
BGP uses TCP, normally with destination port 179 for the connection initiator. A TCP connection alone does not establish a BGP session: the peers must exchange acceptable OPEN messages (including ASN and hold time information) and confirm them with KEEPALIVE. The finite-state machine names Idle, Connect, Active, OpenSent, OpenConfirm and Established. Active often means a connection attempt or retry, not successful route exchange. In Established, UPDATE messages advertise reachability (NLRI, Network Layer Reachability Information) and attributes or withdraw previous routes. KEEPALIVE maintains the session when applicable; NOTIFICATION reports errors or termination. Capability extensions add behaviors beyond this base model.
Troubleshoot with evidence
A fictional peer stuck in Active warrants checking the expected neighbor address, underlay reachability, TCP policy and listener. OpenSent problems may instead involve incompatible OPEN parameters. Established with zero accepted prefixes calls for checking address-family negotiation, advertised routes and import/export policy. Never infer a successful data path from Established alone. For practice, trace a changed AS path in the manual lab. All ASNs and prefixes here are for documentation; do not connect to external peers.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
BGP Sessions and AS Paths Quiz
Apply BGP reasoning to fictional routing evidence.
Two routers in AS 64496 exchange routes with each other. Which session type is this?
AS 64497 learns an ordinary path 64498 64499 and advertises it to AS 64496. What path does 64496 receive?
Which received path should AS 64496 reject under the ordinary AS-loop check?
A peer has a TCP connection but is waiting for acceptance of its OPEN. Is the BGP session Established?
What does an UPDATE withdrawal represent?