Helpful first: How one request crosses the network · Network layers and where attacks live
By the end you can
- OSPF and IS-IS route traffic inside one Autonomous System, and BGP exchanges routes between Autonomous Systems
- The longest matching prefix wins first, and BGP best-path attributes choose only among routes for the same prefix
- RPKI ROAs stop unauthorized origins, and OTC roles and prefix filters stop route leaks
Inside an Autonomous System versus across the Internet
An Autonomous System, or AS, is a group of IP networks under one routing policy. RFC 1930 defines the model. Each AS holds a unique 16-bit or 32-bit Autonomous System Number, called an ASN. Meridian runs AS 64512, and Kestrel runs AS 64510.
No single protocol fits both one company's routers and the whole Internet. Inside an AS, one team owns every link and wants fast convergence. Convergence means every router has the same view of the network again after a change. The protocols for this job are Interior Gateway Protocols, or IGPs.
Two link-state IGPs lead modern networks: Open Shortest Path First, or OSPF, and Intermediate System to Intermediate System, or IS-IS. Every router floods link-state advertisements, or LSAs, across the area and runs Dijkstra shortest-path math on one shared map. Routing Information Protocol, or RIP, counts up to 15 hops. Enhanced Interior Gateway Routing Protocol, or EIGRP, uses the Diffusing Update Algorithm to find fast backup paths.
Independent organizations do not share their internal maps, and each one keeps control of its own policy. Exterior Gateway Protocols, or EGPs, connect separate Autonomous Systems. Border Gateway Protocol version 4, or BGP-4, is the path-vector EGP that connects Autonomous Systems across the Internet. RFC 4271 defines it.
Inside one AS: OSPF or IS-IS
- Single administrative owner
- Floods link-state topology map
- Dijkstra picks lowest link cost
- Built for fast internal convergence
Between ASes: BGP-4
- Independent networks and contracts
- Advertises prefixes and AS_PATH
- Policy attributes pick one best path
- Built for scale and administrative control
| Protocol | Scope and type | Algorithm and metric | Admin distance (Cisco default) | Where it fits best |
|---|---|---|---|---|
| RIP | IGP, distance-vector | Bellman-Ford, hop count up to 15, UDP port 520 | 120 | Small legacy or lab networks only |
| EIGRP | IGP, advanced distance-vector | DUAL, bandwidth and delay composite, IP protocol 88, RFC 7868 | 90 | Cisco-centric enterprise networks needing fast backup paths |
| OSPF | IGP, link-state | Dijkstra SPF, interface cost (often from bandwidth) across Area 0, IP protocol 89, RFC 2328 | 110 | Multi-vendor enterprise cores and campus networks |
| IS-IS | IGP, link-state | Dijkstra SPF, administrative cost directly over Layer 2, Level 1 and Level 2 | 115 | Large service provider backbones and scalable cores |
| BGP-4 | EGP and iBGP, path-vector | Policy attributes and AS_PATH over TCP port 179, RFC 4271 | 20 eBGP, 200 iBGP | Internet peering, multi-homed edges, and large data centers |
SORT IT OUT
Kael lists four routing tasks on Meridian and partner networks. Match each job to the protocol family built for it.
Show the answers
- Link-state IGP. OSPF and IS-IS flood link-state advertisements inside one AS and run Dijkstra shortest-path math.
- Path-vector EGP. BGP exchanges prefixes and policy attributes across independent Autonomous Systems.
- Distance-vector IGP. RIP uses periodic Bellman-Ford hop counts inside small networks and treats 16 hops as unreachable.
- Path-vector EGP. BGP records each ASN in AS_PATH and discards updates that already contain the router's own ASN.
How BGP builds sessions and picks one best path
Two BGP neighbors connect over TCP port 179 for reliable, ordered delivery. Each session moves through six states, from Idle to Established. The neighbors use five message types, such as OPEN, UPDATE, and KEEPALIVE. The quick reference lists every state and message.
External BGP, or eBGP, links routers in different Autonomous Systems, usually with TTL 1. Internal BGP, or iBGP, shares those external routes inside the same AS. iBGP keeps the NEXT_ unchanged unless a border router sets next-. Meridian's border routers set it, so the next hop is a border router loopback. Meridian Core uses OSPF to reach that loopback.
BGP chooses a path by policy, not by link speed. When several valid routes match the same prefix, BGP checks their attributes in a fixed order and installs one winner. BGP checks the highest LOCAL_ before AS_. Meridian can use this to prefer one upstream provider, even when its path is longer.
If LOCAL_ ties, BGP moves to the next check and stops at the first check that picks a winner. The figure below shows the main checks in order. The quick reference lists the full order.
- 1. Highest LOCAL_PREFAS-wide outbound policy preference, common vendor default 100
- 2. Shortest AS_PATHFewer Autonomous System hops in the path
- 3. ORIGIN and MEDIGP beats Incomplete, then lowest MED from same AS
- 4. eBGP over iBGPDirect external exit beats an internal relay
- 5. Lowest IGP costClosest OSPF or IS-IS path to the BGP NEXT_HOP
WORKED EXAMPLE
Two routes for Kestrel's /24, one winner
- List the candidates. Meridian Core learns two valid routes for
203., Kestrel's prefix. One comes through Transit A. One comes through Transit B.0. 113. 0/ 24 - Compare LOCAL_PREF. Kael set
LOCAL_150 on Transit A routes. Suppose Transit B routes keep the common vendor default of 100. Transit A wins.PREF - Stop at the first winner. Suppose Transit B's path is shorter, with 2 AS hops against 3. BGP never looks at
AS_length, becausePATH LOCAL_already decided.PREF - Try a tie. If both routes carried
LOCAL_100, the next check isPREF AS_. Transit B, with fewer hops, would win.PATH - Mind the limit. Both routes are for the same
/. A route for a more specific prefix, such as a24 /, never enters this comparison. Forwarding picks it first, by longest-prefix match.25
Result: Meridian Core sends traffic for the / through Transit A. Policy decided it, not path length.
PUT IT IN ORDER
Meridian Core receives several valid BGP routes for the same /24 prefix and uses standard vendor-neutral attributes. Put these decision checks in the order the router evaluates them.
- Prefer the candidate with the shortest AS_PATH
- Prefer eBGP routes over iBGP routes
- Prefer the lowest internal IGP cost to reach NEXT_HOP
- Prefer the candidate with the highest LOCAL_PREF
Show the answer
- Prefer the candidate with the highest LOCAL_PREF
- Prefer the candidate with the shortest AS_PATH
- Prefer eBGP routes over iBGP routes
- Prefer the lowest internal IGP cost to reach NEXT_HOP
Outbound policy via LOCAL_PREF overrides path length. If policy ties, BGP checks shortest AS_PATH, then ORIGIN and MED, then eBGP over iBGP, and then internal IGP distance to the next hop.
Hijacks, route leaks, and RPKI origin validation
Base BGP has no built-in cryptographic check on who owns a prefix. If a peer claims someone else's address block, unguarded routers believe it. The forwarding information base, or FIB, is the table a router uses to forward each packet. The FIB uses longest-prefix match before any BGP attribute matters. For any address inside 203., that rogue route beats the legitimate 203.. Many networks also filter IPv4 routes longer than /. That limit is an operator convention, not a protocol rule, so a real / can reach fewer networks than a /.
Resource Public Key Infrastructure, or RPKI, lets routers reject a route from an unauthorized origin AS. RFC 6811 and NIST SP 800-189 describe this check. The address holder signs a Route Origin Authorization, or ROA. The ROA names the origin ASN and the maximum prefix length. Routers that run Route Origin Validation, or ROV, can drop Invalid routes before they install them. RFC 6811 leaves that choice to local policy.
A ROA covers only the origin ASN and the maximum prefix length. It does not sign the rest of the AS_, so origin validation does not stop a route leak. RFC 7908 defines a route leak as an announcement that goes beyond its intended scope. A common case is a hairpin turn: a multi-homed customer learns routes from one ISP and exports them to another ISP.
Leaks and session attacks need more than one control. Outbound prefix lists enforce deny-by-default export rules. RFC 9234 adds the Only-to-Customer, or OTC, attribute. Autonomous System Provider Authorization, or ASPA, checks provider pairs. ASPA is still an IETF draft in November 2026. TCP Authentication Option, or TCP-AO, and Generalized TTL Security Mechanism, or GTSM, protect the session on port 179.
SPOT THE PROBLEM
Vera Vance, Principal Security Architect, reviews Edge South's BGP configuration on AS 64512. Meridian is a multi-homed customer of Transit A and Transit B. Flag the lines that invite a hijack, session attack, or route leak.
Show the answers
- rpki-rov policy accept-invalid-with-lower-localpref Lowering LOCAL_PREF on an RPKI Invalid sub-prefix like a /25 still installs it into the FIB, where longest-prefix match beats a legitimate /24. Drop Invalid routes instead.
- neighbor 192.0.2.6 export-policy permit-any Permitting every route outbound exports Transit A prefixes out to Transit B, causing an RFC 7908 route leak. Export only Meridian's own prefixes.
Traffic engineering and modern BGP extensions
Operators use different tools for outbound and inbound traffic. Your AS controls outbound traffic directly. To steer it, set LOCAL_ on incoming eBGP updates. Inbound traffic is harder to control, because remote networks run their own policies. Operators can only influence it with AS_ prepending, MED, or BGP communities.
In a large network, a full iBGP mesh needs a session between every pair of routers. The number of sessions grows with the square of the router count. Route reflectors, defined in RFC 4456, let internal routers peer with a few central reflectors. The ORIGINATOR_ and CLUSTER_ attributes stop loops. Confederations, defined in RFC 5065, divide a large AS into sub-ASes.
Modern BGP carries much more than IPv4 routes. Multiprotocol BGP in RFC 4760 advertises IPv6 unicast, MPLS Layer 3 VPNs, and Ethernet VPN overlays in data centers. BGP Link-State feeds topology to controllers, and BGP Flowspec pushes DDoS drop rules to border routers.
| Extension | Standard | What it carries or solves |
|---|---|---|
| Multiprotocol BGP | RFC 4760 | Carries IPv6 unicast, L3VPN, and data-center EVPN address families over one BGP session |
| Route Reflectors | RFC 4456 | Removes the iBGP full-mesh requirement inside large networks using ORIGINATOR_ and CLUSTER_ |
| Large Communities | RFC 8092 | Attaches 96-bit policy tags so 32-bit ASNs can signal blackholing, region, or export scope |
| BGP Flowspec | RFC 8955 and RFC 8956 | Distributes match-and-drop or rate-limit rules to border routers for DDoS mitigation |
| BGP Link-State | RFC 9552 | Exports internal OSPF or IS-IS topology graphs to traffic-engineering controllers |
CHECK YOUR JUDGMENT
At 04:10, Kael pulls Edge South's BGP log. Kestrel holds 203.0.113.0/24 and announces it from AS 64510 through Transit A. For six minutes, a network behind Transit B announced 203.0.113.128/25 from AS 64599. Transit A had the higher LOCAL_PREF of 150, but Meridian Core still sent Kestrel's telemetry to Transit B. Why did Transit B win, and what stops it?
CASE FILE · CASE 10 · ENTRY 2 OF 8
Answer the closing question correctly to add this entry to your case file.
The most specific prefix wins first
An unvalidated / is more specific than Kestrel's /, so the forwarding lookup picks it, and BGP's best-path rules never compare the two.
Next episode: Inside Station South, Kael still has 212 ports in one flat zone waiting for boundaries.
Review sheet: exam notes and quick reference
Control A process, configuration, or technology meant to reduce a named risk or detect a named failure.
Port A number on a host that distinguishes one listening service from another.
Backup A copy of data kept so integrity and availability can be restored after loss, preferably beyond the production identity’s reach.
TCP The protocol that gives two machines a reliable, ordered stream of bytes. It opens each connection with a three-packet handshake and confirms every byte received.
BGP The protocol that networks on the internet use to tell each other which address ranges they can reach. Each network chooses one path to each range by policy.
DDoS An attack that makes a service unavailable by overwhelming it with traffic or requests from many sources at once.