What distinguishes an interior gateway protocol from an exterior gateway protocol, and why is BGP used between autonomous systems instead of an IGP?
answer
- inside versus between
- one routing policy per AS
- shortest path versus policy
- the AS list as loop guard
basics
~20 sAn interior gateway protocol finds best paths inside one autonomous system; an exterior gateway protocol exchanges reachability between autonomous systems. BGP-4 fills that role because it carries AS paths and applies each operator's policy, which a shared shortest-path metric cannot express.
solid answer
~50 sAn **autonomous system** is a connected group of prefixes run under a single, clearly defined routing policy (RFC 1930). Inside it, an **IGP** such as OSPF, IS-IS or RIP trusts every router, computes shortest paths on a shared metric and converges quickly when links fail. Between autonomous systems the goal changes: operators share no metric, do not trust each other, and choose routes by policy, such as which neighbour to prefer and what to announce to whom. **BGP-4** (RFC 4271), the exterior protocol in use today, carries for each prefix the `AS_PATH` of autonomous systems crossed, discards routes that already contain its own AS, and lets each operator filter and prefer routes. Inside a large network the two run together: the IGP carries internal reachability, including the addresses BGP uses as next hops, and BGP carries the external routes.
go deeper
Know that IGPs route inside one organisation's network and BGP routes between autonomous systems, and be able to name an IGP or two.
Explain RFC 1930's definition of an autonomous system, why the two roles optimise for different things, and how BGP's AS_PATH detects loops.
Describe how an IGP and BGP divide the work inside one network, internal reachability and next hops versus external routes, and the risks of redistributing between them.
Judge when a network needs its own autonomous system and BGP at all versus a default route from a provider, weighing multihoming, policy control and operational burden.
## What an autonomous system is Routing on the Internet is split into two layers, and the split is drawn around the **autonomous system (AS)**. RFC 1930 defines it as 'a connected group of one or more IP prefixes run by one or more network operators which has a SINGLE and CLEARLY DEFINED routing policy'. RFC 4271 gives the older, classic definition (routers under one technical administration, using an interior protocol and common metrics inside and an inter-AS protocol outside) and then notes that one AS now often runs several interior protocols and several sets of metrics. What makes it one AS is that, to everyone else, it presents one coherent routing plan. That boundary separates two jobs: - **inside** an AS: find the best path between routers that all belong to one operator; - **between** ASes: exchange which prefixes are reachable through whom, under each operator's own rules. ## Interior gateway protocols: one owner, one metric RFC 4271 defines an **IGP** as 'a routing protocol used to exchange routing information among routers within a single Autonomous System'. RFC 1812 lists what an IGP should do: respond quickly to internal topology changes, damp flapping links, converge quickly to loop-free routing, use little bandwidth, provide equal-cost routes for load-splitting, and authenticate updates. OSPF, IS-IS and RIP are IGPs. They can assume: - every router is administered by the same operator and can be trusted; - one metric, such as link cost or hop count, means the same thing everywhere; - the best route is the shortest one by that metric. ## Exterior gateway protocols: many owners, many policies RFC 1812 describes **exterior gateway protocols** as those used for inter-AS routing, exchanging reachability for an AS's networks with a neighbouring AS. The name is also that of a specific early protocol, the Exterior Gateway Protocol, which RFC 1812 already called historical; **BGP-4** (RFC 4271) replaced it and is the exterior protocol in use today. Between ASes, the IGP's assumptions fail: 1. **No shared metric.** One operator's link cost means nothing to another, so 'shortest path' is undefined across the boundary. 2. **No mutual trust.** A neighbour's announcements must be filtered, not believed; RFC 1812 says a BGP implementation SHOULD let an AS control which learned routes it announces to adjacent ASes. 3. **Policy over distance.** Operators choose routes by business relationships: prefer the customer link, avoid transit through a particular network, announce some prefixes to some neighbours only. 4. **Scale and stability.** A neighbour's internal link flaps must not trigger recomputation in everyone else's network. ## How BGP avoids loops without a shared metric For each prefix, BGP carries the `AS_PATH` attribute: the sequence of autonomous systems the route has passed through. RFC 4271 says a route whose `AS_PATH` contains the local AS number contains a loop and should be excluded from route selection. RFC 1812 notes the same list lets each AS enforce policy at the AS level. Because the path is carried rather than a bare distance, BGP is commonly called a **path-vector** protocol. ## Side by side | | Interior gateway protocol | Exterior gateway protocol (BGP-4) | |---|---|---| | Scope | Within one AS | Between ASes | | Chooses by | Shortest path on a shared metric | Operator policy and path attributes | | Trust | All routers trusted | Neighbours filtered | | Loop control | Protocol algorithm (SPF, split horizon) | Own AS found in `AS_PATH` | | Examples | OSPF, IS-IS, RIP | BGP-4 | ## Running both in one network A network that connects to several neighbours runs both protocols. BGP sessions with routers in other ASes bring external routes in; RFC 4271 calls those external peers, and peers inside the same AS internal peers, over which the external routes are spread to the AS's own routers. The IGP carries reachability to the AS's own links and router addresses, including the next-hop addresses BGP routes point at, and reconverges quickly when an internal link fails. Moving routes between the two is **redistribution**, and it needs restraint. RFC 4632 says the default route should be advertised into another routing domain only when a router is explicitly configured to do so. Common practice keeps the full external table inside BGP and gives interior-only routers a default route, because an IGP floods and recomputes everything it carries. ## Where answers go wrong - Defining an AS as 'the routers that run one IGP'. - Saying BGP picks the path with the lowest total link cost. - Treating the IGP as unnecessary once BGP runs. - Confusing EGP the protocol class with the historical protocol of that name.
- Why should a network not redistribute its full BGP table into its IGP?An IGP stores, floods and recomputes every route it carries on every router, and was built for the network's own prefixes, not the whole Internet's. Pouring an Internet-scale table into it multiplies memory, flooding and recomputation, and lets external churn disturb internal routing. The usual practice keeps external routes in BGP and gives interior-only routers a default route.
- Two organisations both run OSPF and want to exchange routes; why not merge them into one OSPF domain?One link-state domain would make each side flood its full topology to the other and trust every router across the boundary, so a misconfiguration or flapping link on one side would trigger recomputation on the other. Neither side could express policy beyond a shared cost. Peering with BGP exchanges only reachability, with filtering and preference under each operator's control.
saying these in an interview costs you the question
- An autonomous system is defined as all the routers running the same IGP.
- BGP chooses paths between autonomous systems by the lowest total link cost.
- A network that runs BGP has no need for an IGP internally.
- EGP and BGP are simply two names for the same protocol.
- BGP prevents inter-AS loops with split horizon, the way RIP does.