ELEC3506

RoutingLecture 6 PDF18 min

BGP policy and route selection

How a learned BGP path turns into a forwarding-table entry via intra-domain routing, why hot potato routing ignores inter-domain cost, how policy is enforced simply by choosing not to advertise, and the criteria BGP uses to pick between competing routes.

By the end of this page you should be able to

  • Trace a BGP path advertisement through to a router's forwarding table entry
  • Explain hot potato routing and why it ignores AS-hop cost
  • Give two ways an AS enforces routing policy purely through its advertising choices
  • List BGP's route selection criteria in priority order

The idea

Learning a path with BGP is only half the job. A router inside an AS still has to turn “the route to X goes through gateway 1c” into an actual forwarding decision — which physical interface a packet for X leaves on. And once more than one path exists, something has to pick between them, and that something is allowed to care about the AS’s own priorities as much as about which path is objectively shortest.

How it works

BGP path advertisement — propagation

The lecture works through path propagation across three ASes:

  • AS2 router 2c receives path advertisement AS3, X (via eBGP) from AS3 router 3a.
  • Based on AS2’s policy, 2c accepts path AS3, X and propagates it (via iBGP) to all AS2 routers.
  • Based on AS2’s policy, AS2 router 2a then advertises (via eBGP) path AS2, AS3, X onward to AS1 router 1c.

How it works

Multiple path learning

A gateway router can end up hearing about the same destination more than once, from different directions. In the lecture’s example:

  • AS1 gateway router 1c learns path AS2, AS3, X from 2a.
  • AS1 gateway router 1c also learns path AS3, X directly from 3a.
  • Based on policy, 1c chooses path AS3, X (the shorter of the two) and advertises it within AS1 via iBGP.

Worked example

From a learned path to a forwarding table entry

Every router in AS1 has learned, via iBGP from 1c, that the path to X goes through 1c. How does each router turn that into a forwarding decision?

  1. Each router already runs its own intra-domain routing (OSPF), which already tells it which interface reaches 1c.

  2. At router 1d: OSPF intra-domain routing says “to get to 1c, use interface 1.” Since the path to X goes through 1c, 1d also uses interface 1 to get to X.

  3. At router 1a: OSPF intra-domain routing says “to get to 1c, use interface 2.” So 1a also uses interface 2 to get to X.

  4. Resulting forwarding table entries:

    RouterDestinationInterface
    1d1c1
    1dX1
    1a1c2
    1aX2

Each router ends up with two entries built the same way — one for the gateway itself, one for the external destination reached through it, both pointing at the same interface.

Answer1d uses interface 1 for both 1c and X; 1a uses interface 2 for both — because each router reuses its own intra-domain interface toward the gateway

How it works

Hot potato routing

Router 2d learns, via iBGP, that it can reach X through either gateway 2a or gateway 2c. Hot potato routing is the rule for choosing between them: pick whichever local gateway has the least intra-domain cost to reach, without worrying about the inter-domain (AS-hop) cost at all.

In the lecture’s own example, 2d chooses 2aeven though 2a is more AS hops away from X — because reaching 2a costs less inside AS2’s own network than reaching 2c does. The name reflects the idea: get the traffic off your own network as quickly as possible, and let the receiving AS worry about the rest of the journey.

Where marks get lost

Hot potato optimises the wrong thing on purpose

It looks like a bad routing decision to send traffic to the more distant gateway, but hot potato routing is deliberately optimising local cost, not end-to-end cost. Do not describe this as a flaw or an inefficiency in an exam answer — it is the defined behaviour, and the “why” is exactly that inter-domain cost is not this router’s concern.

How it works

Achieving policy purely through advertisements

BGP enforces policy without any extra mechanism beyond controlling what gets advertised to whom.

Example 1 — avoiding transit traffic. Provider network A advertises path A, w to both provider B and provider C. B chooses not to advertise B, A, w onward to C. The reasoning: B gets no “revenue” for routing C, B, A, w, since none of C, A, or w are B’s customers — this is a typical real-world ISP policy of only routing traffic to and from its own customers. As a result, C never learns about the C, B, A, w path, and instead routes to w via C, A, w directly, without going through B at all.

Example 2 — a dual-homed customer refusing transit. Networks A, B and C are providers; x, w and y are their customers. x is dual-homed, meaning it is attached to two provider networks at once. The policy x wants to enforce: it does not want to route traffic from B to C via itself. x achieves this the same way — it simply does not advertise to B a route to C.

How it works

BGP route selection

A router may learn more than one route to the same destination AS. BGP selects between them using these criteria, in order:

  1. Local preference value attribute — a policy decision.
  2. Shortest AS-PATH.
  3. Closest NEXT-HOP router — this is hot potato routing.
  4. Additional criteria.

Check yourself

  • A router turns a learned BGP path into a forwarding entry by reusing its own intra-domain route to the relevant gateway.
  • Hot potato routing picks the local gateway with the least intra-domain cost, ignoring AS-hop count entirely.
  • Policy is enforced simply by choosing not to advertise a route onward — no separate blocking mechanism is needed.
  • Route selection order: local preference, then shortest AS-PATH, then closest NEXT-HOP (hot potato), then additional criteria.

In the exam

  • Trace the two-step forwarding logic exactly: iBGP tells a router which gateway leads to a destination; the router’s own intra-domain protocol tells it which interface leads to that gateway; the destination inherits that same interface.
  • State hot potato routing’s rule precisely — least intra-domain cost to the gateway, inter-domain cost ignored — and be ready to explain why that is not a mistake.
  • Both policy examples reduce to the same trick: withhold an advertisement, and the neighbour that never learns a route can never use it. No firewall or filter is needed.
  • Memorise the route selection order. A question can give you two candidate routes and ask which wins — work down the list from local preference first, not straight to AS-PATH length.

Check yourself

  1. Router 1d learns via iBGP that the path to destination X goes through gateway router 1c. 1d's own OSPF says interface 1 reaches 1c. What interface does 1d use to reach X?
  2. Router 2d can reach destination X via two local gateways: 2a (more AS hops to X) or 2c (fewer AS hops to X). Under hot potato routing, which does it choose, and why?
  3. An ISP that only wants to route traffic to and from its own customers, and never carry transit traffic between two other ISPs, achieves this purely by:
  4. What are BGP's route selection criteria, in the order the lecture gives them?