Interior vs Exterior Routing (IGP vs EGP)

Run a Speed Test

Routing protocols come in two families that answer two different questions. An interior gateway protocol answers "how do I cross my own network as efficiently as possible?" An exterior gateway protocol answers "how do I reach networks run by everyone else?" The first optimises for speed; the second negotiates policy. Together — typically OSPF inside and BGP at the border — they route the entire internet.

Two Scopes, Two Problems

The split comes straight from the structure of the internet as a collection of autonomous systems — independently operated networks, each under one administration. That structure creates two distinct routing problems:

  • Inside an autonomous system, every router is trusted and run by the same operator. The goal is purely technical: find the fastest, lowest-cost path between any two internal points. This is the job of an interior gateway protocol (IGP).
  • Between autonomous systems, routers belong to different companies with their own interests, contracts, and trust boundaries. The goal is no longer "shortest path" but "which path does policy and economics allow?" This is the job of an exterior gateway protocol (EGP).

Because the two problems have such different constraints, they are solved by different protocols with different design priorities. Trying to use one for the other's job fails badly — as the early internet discovered.

Interior Gateway Protocols: Optimise the Path

Inside a network, an IGP's mission is efficiency. The dominant example is OSPF (Open Shortest Path First), a link-state protocol. Every router floods information about its own links and their costs to all other routers, so each builds an identical map of the whole network. From that map, each router independently computes the shortest path to every destination using Dijkstra's algorithm, where "shortest" means lowest total link cost (typically derived from bandwidth — faster links cost less).

Key traits of IGPs:

  • They optimise a numeric metric (cost, hop count, or bandwidth) to find the best path.
  • They converge quickly when a link changes, because every router shares a full view.
  • They assume a single trusted administration — there is no need to distrust another router's advertisements.

Other IGPs include IS-IS (another link-state protocol favoured by large carriers), the older distance-vector RIP, and EIGRP. They differ in mechanics but share the same purpose: move traffic across one administrative domain as efficiently as possible. The routes they compute end up in each router's routing table.

Exterior Gateway Protocols: Honour the Policy

Between networks, the calculus changes completely. The one EGP in use today is BGP (Border Gateway Protocol), and it is built around policy rather than shortest path. When two autonomous systems connect, they exchange routes via BGP, and each side decides — based on its own rules — which routes to accept and which to advertise onward.

Why policy instead of metric? Because the "best" route between networks is a business question. A provider will prefer a free peering link over a paid transit link even if the paid path is technically shorter. It will not advertise one provider's routes to another, because it is not paid to carry that traffic. And it must scale to the internet's hundreds of thousands of routes without requiring anyone to reveal their internal topology. BGP's AS-path attribute also prevents loops and lets operators express preferences that have nothing to do with raw distance.

BGP, in short, trusts nothing by default and lets each network impose its own rules — the opposite of an IGP's single-administration assumption.

Side by Side

IGP (interior)EGP (exterior)
ScopeWithin one autonomous systemBetween autonomous systems
Decides byMetric — lowest cost / shortest pathPolicy — relationships and rules
Trust modelSingle trusted administrationIndependent, mutually distrustful parties
ScaleHundreds to thousands of routesThe entire internet's routes
ExamplesOSPF, IS-IS, RIP, EIGRPBGP
Optimises forSpeed and efficiencyControl and economics

How They Work Together

A real ISP does not choose one or the other — it runs both, at different layers. Internally, it runs an IGP such as OSPF or IS-IS so that traffic crosses its own backbone by the most efficient route. At its borders, it runs BGP to exchange reachability with other networks and decide how to reach the rest of the world. The IGP answers "how do I get across my own network to the right exit?"; BGP answers "which exit, and whose network beyond it?"

This division is why the path your packets take across the internet is shaped partly by physics and partly by contracts. Within each network they follow the IGP's fastest route; between networks they follow BGP's policy. When you run a traceroute and watch the hops cross from one provider to another, you are seeing the handoff from one network's interior routing to the next, stitched together by BGP — the bigger picture covered in how internet routing works.

Frequently Asked Questions

What is the difference between an IGP and an EGP?

An IGP routes within a single autonomous system, optimising for the lowest-cost path. An EGP routes between autonomous systems, choosing paths by policy and business relationships. OSPF is a common IGP; BGP is the EGP of the internet.

Is OSPF an IGP or EGP?

An IGP. OSPF runs inside one network or autonomous system and computes shortest paths from link costs using a link-state algorithm. It is not used to route between separate organisations.

Why is BGP used between networks instead of OSPF?

Because inter-network routing is about policy, trust, and economics, not just shortest path. BGP lets each AS control which routes it accepts and advertises, scales to the whole internet, and needs no shared internal detail. OSPF assumes one trusted administration and would not scale or respect those boundaries.

What are examples of interior gateway protocols?

OSPF and IS-IS (link-state), the older distance-vector RIP, and the hybrid EIGRP. All route within a single administrative domain.

Can a network run both an IGP and an EGP?

Yes — large networks routinely do. An ISP runs an IGP internally to move traffic efficiently between its own routers and runs BGP at its borders to exchange routes with other networks.

Related Guides

More From This Section