BGP
1. Big picture
This lecture is about BGP, the Border Gateway Protocol.
BGP is the routing protocol used between Autonomous Systems (ASes) on the Internet. An AS is a network under one administrative control, usually with one consistent routing policy. Examples include ISPs, large companies, universities, cloud providers, and content providers.
In previous lectures, protocols such as OSPF, RIP, and IS-IS were mainly about intra-AS routing: they find paths inside one administrative domain.
BGP is about inter-AS routing: it decides how different ASes tell each other which IP prefixes they can reach, and which paths should be used.
The key difference is:
- Intra-AS routing mainly optimizes technical metrics, such as shortest path, delay, or link cost.
- Inter-AS routing is dominated by policy, business relationships, and scalability.
Therefore, BGP is not simply “find the shortest path”. A longer AS path may be preferred if it matches the network operator’s business policy.
2. Why BGP exists
BGP gives each AS a way to do three things:
- Learn reachability information from neighboring ASes.
- Propagate that reachability information inside its own AS.
- Choose “good” routes based on both reachability and policy.
A subnet can advertise its existence to the rest of the Internet through BGP. Conceptually, this is like saying:
I am prefix 192.0.2.0/24, and I can be reached through this AS path.
BGP is the de facto exterior gateway protocol of the global Internet.
BGP-4 is especially important because it supports CIDR, so routes can be advertised as prefixes such as:
192.0.2.0/24 2001:db8:1::/48
BGP is often described as a path-vector protocol. It is similar to a distance-vector protocol, but it carries the actual AS path as an attribute.
3. Intra-AS vs inter-AS routing
3.1. Intra-AS routing
Inside one AS, routing is controlled by one organization. The administrator can normally choose one routing objective, for example:
- shortest path,
- lowest link cost,
- load distribution,
- fast convergence.
Examples of intra-AS routing protocols:
- OSPF,
- IS-IS,
- EIGRP,
- RIP.
Inside an AS, routers usually trust each other more and can expose detailed topology information.
3.2. Inter-AS routing
Between ASes, the situation is different.
Each AS is owned by a different organization. These organizations may be customers, providers, peers, or competitors.
So inter-AS routing must answer questions like:
- Which routes do I accept from another AS?
- Which routes do I prefer?
- Which routes do I advertise to another AS?
- Do I want to carry transit traffic for this neighbor?
- Am I being paid to carry this traffic?
- Should customer routes be preferred over peer or provider routes?
This is why policy often matters more than shortest distance in BGP.
4. Basic BGP terminology
4.1. Prefix
A prefix is an IP address block, for example:
192.0.2.0/24 160.10.0.0/16 2001:db8:1::/48
BGP routes are routes to prefixes, not routes to individual hosts.
4.2. AS
An Autonomous System is a network under one administrative domain.
Each AS has an AS number, for example:
AS64496 AS64497 AS64498
4.3. BGP speaker
A BGP speaker is a router running BGP.
4.4. BGP peer / neighbor
Two BGP routers that exchange BGP messages are called peers or neighbors.
Important detail:
BGP peering does not necessarily correspond to a direct physical link. A BGP session is a logical TCP connection.
4.5. BGP session
A BGP session is a semi-permanent TCP connection between two BGP peers.
BGP uses TCP port 179.
Because BGP runs over TCP, BGP itself does not need to implement its own reliable transport mechanism.
5. eBGP and iBGP
BGP has two important use cases.
5.1. eBGP
eBGP means external BGP.
It is used between routers in different ASes.
Example:
AS64496 router 1c <--- eBGP ---> AS64497 router 2a
eBGP is used to exchange reachability information between ASes.
5.2. iBGP
iBGP means internal BGP.
It is used between routers inside the same AS.
Example:
AS64497 router 2a <--- iBGP ---> AS64497 router 2c
iBGP is used to distribute externally learned BGP routes inside one AS.
A gateway router often runs both eBGP and iBGP:
- eBGP to talk to external ASes,
- iBGP to share learned routes with routers inside its own AS.
5.3. Example: route propagation across ASes
Suppose destination prefix X is inside AS64498.
- AS64498 advertises X to AS64497 over eBGP.
- A gateway router in AS64497 receives the route.
- AS64497 uses iBGP to distribute this route inside AS64497.
- Another gateway router in AS64497 may advertise the route further to AS64496 over eBGP.
- Routers that learn the route can install forwarding entries for prefix X.
So BGP reachability information travels between ASes through eBGP, and inside an AS through iBGP.
6. BGP route advertisements
A BGP route is not just a destination prefix.
A BGP route is:
network prefix + attributes
For example:
Prefix: 192.0.2.0/24 AS-PATH: AS64497 AS64498 NEXT-HOP: router 2a LOCAL_PREF: 800 MED: 1000
The attributes are crucial because they allow policy-based routing.
6.1. Path-vector idea
When an AS advertises a route, it prepends itself to the AS path.
Example:
AS64498 originates prefix X. AS64498 advertises: AS-PATH: AS64498 AS64497 receives it and advertises to AS64496: AS-PATH: AS64497 AS64498
The AS path tells other ASes which ASes would be traversed to reach the prefix.
6.2. What does an advertisement mean?
If AS64498 advertises a path to X to AS64497, it is essentially promising:
If you send traffic for X to me, I know how to forward it toward X.
BGP advertisements therefore describe reachability, but they also imply willingness to carry traffic.
7. BGP protocol messages
BGP peers exchange messages over TCP.
The main message types are:
7.1. OPEN
The OPEN message starts a BGP session.
It opens the BGP connection and includes information used to establish the session.
It can also be used for authentication-related negotiation.
7.2. UPDATE
UPDATE messages are the most important BGP messages.
They are used to:
- advertise new routes,
- update route attributes,
- withdraw old routes.
BGP does not periodically send the whole table forever. After the initial exchange, BGP mostly sends incremental updates.
7.3. KEEPALIVE
KEEPALIVE messages keep the connection alive when there are no UPDATE messages.
They also acknowledge an OPEN message.
7.4. NOTIFICATION
A NOTIFICATION message reports an error and closes the connection.
For example, if a peer sends a malformed BGP message, the other side may respond with NOTIFICATION and terminate the session.
8. BGP operation: simplified process
A simplified BGP session works like this:
- Establish TCP connection on port 179.
- Exchange OPEN messages.
- Initially exchange all relevant routes using UPDATE messages.
- While the connection is alive, exchange incremental UPDATE messages.
- Send KEEPALIVE messages when there are no updates.
- If an error happens, send NOTIFICATION and close the connection.
Important point:
BGP is incremental. It does not behave like a simple periodic full-table broadcast protocol.
9. Important BGP attributes
10. AS-PATH
AS-PATH is a well-known mandatory attribute.
It lists the ASes on the path to the destination prefix.
Example:
Prefix: 135.104.0.0/16 AS-PATH: 702 701 144
This means that, from the current AS, the route goes through:
AS702 -> AS701 -> AS144
AS-PATH has two main uses:
- Loop prevention.
- Route selection.
10.1. Loop prevention
If a router sees its own AS number in the AS-PATH, it rejects the route.
Example:
AS64497 receives: AS-PATH: AS64496 AS64497 AS64498
AS64497 sees itself in the AS-PATH, so accepting this route would create a loop. Therefore, it rejects the route.
10.2. Route selection
A shorter AS-PATH is often preferred, but only after higher-priority policy rules such as local preference.
So shortest AS-PATH does not always win.
11. NEXT-HOP
NEXT-HOP is a well-known mandatory attribute.
It tells the router where to send packets next in order to use this BGP route.
In eBGP, the next hop is often the external neighbor that advertised the route.
In iBGP, NEXT-HOP can refer to a border router inside the AS.
Example:
Router 1d learns through iBGP: "To reach prefix X, use router 1c as NEXT-HOP."
Router 1d then needs its intra-AS routing protocol, such as OSPF, to know how to reach router 1c.
So BGP and OSPF work together:
- BGP decides the external path to the prefix.
- OSPF decides how to reach the chosen internal next-hop router.
12. ORIGIN
ORIGIN is a well-known mandatory attribute.
It describes how the route was originally introduced into BGP.
For this lecture, the important thing is simply that ORIGIN is part of the standard BGP route attributes.
13. LOCAL_PREF
LOCAL_PREF means local preference.
It is used inside an AS to express which route is preferred.
The route with the highest LOCAL_PREF wins.
Example:
Route A to 192.0.2.0/24: LOCAL_PREF = 500 Route B to 192.0.2.0/24: LOCAL_PREF = 800
The router chooses Route B because 800 is higher than 500.
LOCAL_PREF is very important for policy.
Common use:
customer route > peer route > provider route
This means:
- Prefer routes learned from customers, because customers pay us.
- Then prefer peer routes, because peering is usually settlement-free.
- Prefer provider routes last, because sending traffic through a provider may cost money.
LOCAL_PREF is normally distributed inside an AS via iBGP.
14. MED
MED means Multi-Exit Discriminator.
It is used to express a preference among multiple entry points into the same neighboring AS.
Lower MED is usually better.
Example:
AS64498 advertises prefix 192.0.2.0/24 to AS64497 via two links. Link A: MED = 2000 Link B: MED = 1000
AS64497 should prefer Link B, because 1000 is lower.
Important details:
- MED is non-transitive.
- MED is usually compared only between routes learned from the same neighboring AS.
- MED can carry information related to the IGP metric inside the advertising AS.
Intuition:
MED lets one AS say to a neighbor:
If you want to enter my network for this prefix, I prefer that you enter here.
15. Communities
BGP communities are tags attached to routes.
They are used to group prefixes and influence routing decisions.
A route can have multiple communities.
Communities can be used to implement policies such as:
- accept this route,
- prefer this route,
- do not export this route to a certain AS,
- blackhole traffic for DDoS mitigation,
- prepend AS-PATH when advertising to certain peers.
Traditional BGP communities are 32-bit values.
Because modern AS numbers can be four-octet ASNs, traditional communities are sometimes too small. Large Communities were introduced to provide a larger encoding.
Large Communities are 12 octets.
16. Route processing inside a BGP router
A BGP router processes routes roughly as follows:
- Receive BGP updates.
- Apply import policies.
- Store routes in the BGP route table.
- Select the best route.
- Install best routes into the IP forwarding table.
- Apply export policies.
- Send BGP updates to neighbors.
16.1. Import policy
Import policy is applied when a route is received.
It can:
- reject a route,
- accept a route,
- change attributes,
- set
LOCAL_PREF, - attach communities,
- modify MED or other attributes.
16.2. Best route selection
After import policy, the router may have multiple routes to the same prefix.
It then chooses one best route according to BGP route selection rules.
16.3. Export policy
Export policy is applied before advertising routes to neighbors.
It can decide:
- which routes to advertise,
- which routes not to advertise,
- which attributes to modify before advertisement.
This is how BGP enforces business policy.
17. BGP route selection
A router may learn multiple routes to the same prefix.
BGP must select one best route.
A simplified elimination order from the lecture is:
- Most specific prefix wins.
- Highest
LOCAL_PREFwins. - Best MED wins.
- Shortest AS-PATH wins.
- Closest NEXT-HOP wins, i.e. hot potato routing.
- Additional tie-breakers, such as peer IP address.
Different vendors may use slightly different detailed orders, but the lecture focuses on these main ideas.
17.1. Most specific prefix wins
Longest-prefix matching is fundamental.
Example:
192.0.2.0/24 192.0.2.128/25
For destination:
192.0.2.150
Both prefixes match, but /25 is more specific than /24, so /25 wins.
This rule is not only a BGP rule. It is also the basic IP forwarding rule.
17.2. Highest LOCAL_PREF wins
LOCAL_PREF is usually the most important policy knob inside an AS.
Example:
Route through provider: LOCAL_PREF = 100 Route through peer: LOCAL_PREF = 200 Route through customer: LOCAL_PREF = 300
The customer route wins.
This reflects the common business policy:
customer > peer > provider
17.3. Best MED wins
MED is used when one neighboring AS advertises multiple possible entry points.
Lower MED is usually better.
MED is weaker than LOCAL_PREF.
So if one route has a higher LOCAL_PREF, it may win even if its MED is worse.
17.4. Shortest AS-PATH wins
If policy attributes do not decide the route, BGP may prefer the shorter AS path.
Example:
Route A: AS-PATH: 64497 64498 Route B: AS-PATH: 64499 64500 64498
Route A is shorter, so it may be preferred.
But this rule is not absolute. Policy can override it.
17.5. Closest NEXT-HOP wins: hot potato routing
Hot potato routing means:
Send traffic out of my own AS as quickly as possible.
If an AS has multiple exit points for a destination, it may choose the exit point with the lowest internal IGP cost.
Example:
A router inside AS64497 learns two routes to X:
Route 1 exits via router 2a. Route 2 exits via router 2c.
If router 2d is internally closer to 2a than to 2c, it chooses 2a.
This may happen even if the external AS path after 2a is longer.
Hot potato routing optimizes internal cost, not global path quality.
18. Why policy wins over distance
The lecture gives examples where the shortest AS path should not be used.
Suppose traffic could go through a path that is technically shorter, but that path would require an ISP to carry traffic between two networks that are not its customers.
The ISP may refuse to advertise such a route, because it gets no revenue from carrying that traffic.
So the selected path may be longer, but it matches the business policy.
Important idea:
BGP does not just compute paths. It also controls who is allowed to use which paths.
19. Business relationships and BGP policy
Common AS relationships:
19.1. Provider
A provider sells connectivity to customers.
A provider may offer transit to the rest of the Internet.
19.2. Customer
A customer buys connectivity from a provider.
Customer routes are usually attractive to providers because customers pay.
19.3. Peer
Peers exchange traffic between their own customers, usually without payment.
A peer normally does not want to provide free transit between another peer and an upstream provider.
19.4. Sibling
Sibling ASes are related organizations with a special relationship. The lecture lists siblings as another category.
20. Export policy table
A typical export policy is:
| Route type | Export to provider | Export to customer | Export to peer |
|---|---|---|---|
| Own routes | yes | yes | yes |
| Customer routes | yes | yes | yes |
| Sibling routes | yes | yes | yes |
| Provider routes | no | yes | no |
| Peer routes | no | yes | no |
The intuition:
- You advertise your own and customer routes widely.
- You advertise provider and peer routes only to customers.
- You do not usually advertise provider routes to peers or other providers, because that would provide unpaid transit.
- You do not usually advertise peer routes to other peers or providers.
21. Transit vs non-transit AS
21.1. Transit AS
A transit AS allows traffic to pass through even if neither the source nor the destination is inside the AS.
Example:
Source: AS701 Destination: AS144 Traffic crosses AS1
If AS1 allows this, AS1 is acting as a transit AS.
Large ISPs are often transit ASes.
21.2. Non-transit AS
A non-transit AS only allows:
- traffic originating inside the AS,
- traffic destined to the AS.
It does not want to carry traffic between two external ASes.
Many enterprise networks are non-transit ASes.
22. Stub and multihomed networks
22.1. Stub AS
A stub AS has only one connection to the Internet.
It does not need to carry transit traffic.
A simple stub AS may not need full BGP.
It can use:
- a default route toward the upstream provider,
- a static route from the provider toward the customer’s prefix.
Example:
Customer prefix: 192.0.2.0/24 Customer sends unknown destinations to provider using default route: 0.0.0.0/0 -> upstream provider Provider routes customer prefix statically: 192.0.2.0/24 -> customer
22.2. Multihomed AS
A multihomed AS has connections to multiple providers.
This improves reliability and possibly performance.
But routing becomes harder.
The AS may need BGP because:
- it has multiple possible exits,
- providers need to know how to reach the customer’s prefix,
- the customer may want traffic engineering,
- static routes are not flexible enough.
23. Multihoming issues
Multihoming means a network has several Internet connections.
Benefits:
- better reliability,
- possible performance improvement,
- failure tolerance,
- more total bandwidth.
Challenges:
- route policy,
- MED configuration,
- addressing,
- aggregation,
- global routing table growth.
23.1. Address space from one ISP
Suppose the customer receives address space from ISP1.
Example:
ISP1 aggregate: 2001:db8::/32 Customer prefix: 2001:db8:1::/48
ISP1 may advertise the aggregate /32.
The customer may advertise the more specific /48 through ISP2.
Because longest-prefix matching prefers /48 over /32, traffic from some parts of the Internet may go through ISP2.
This can create traffic imbalance.
23.2. Aggregation pitfall
Suppose ISP1 internally aggregates routes to reduce table size.
ISP1 may still announce the /32 aggregate externally.
But if ISP1 learns the customer’s /48 from ISP2, longest-prefix matching may cause ISP1 to send traffic to the customer through ISP2, even though the customer is directly connected to ISP1.
Workaround:
ISP1 must inject the customer’s more specific /48 into iBGP internally.
23.3. Address space from both ISPs
The customer may get one prefix from ISP1 and another prefix from ISP2.
This can help split traffic, but it has a reliability problem.
If the link to ISP1 fails, the prefix from ISP1 may become unreachable unless it is also advertised through ISP2.
So address space from both providers does not automatically solve failover.
23.4. Independent address space
The customer can obtain provider-independent address space.
This gives the most control, but it reduces aggregation and increases global routing table entries.
In practice, the global routing table usually filters very small prefixes.
Common rough limits:
- IPv4: usually /24 or shorter is globally routable.
- IPv6: usually /48 or shorter is globally routable.
Here “shorter” means a less specific prefix, for example /23 is shorter than /24.
24. BGP and load balancing
BGP normally chooses and installs one best route.
It is not primarily a load-balancing protocol.
This makes traffic engineering difficult.
If a network has multiple external gateways, it may want to split traffic across them. But BGP’s route selection tends to pick one best path per prefix.
Possible techniques include:
- advertising more specific prefixes,
- AS-PATH prepending,
- setting MED,
- setting
LOCAL_PREFinternally, - using BGP multipath features where supported.
But these techniques are policy-heavy and can be fragile.
25. Policy through advertisements
BGP policy is often enforced by controlling what gets advertised.
25.1. Example 1: avoiding free transit
Suppose AS B learns a route to customer W through AS A.
B could advertise this route to AS C, allowing C to reach W through B.
But B may choose not to advertise this route to C.
Why?
Because B would be carrying traffic from C to W, but neither C nor W is B’s customer. So B gets no revenue.
Therefore, B does not advertise the route to C.
As a result, C must choose another route, for example through A.
25.2. Example 2: dual-homed customer refusing transit
Suppose customer X is connected to both B and C.
X does not want to carry traffic from B to C.
Therefore, X does not advertise routes learned from C to B.
This prevents B from using X as a transit path to C.
26. iBGP in more detail
iBGP is the same BGP protocol, but used inside one AS.
It is needed because AS-PATH information must remain intact between multiple eBGP-speaking routers.
Suppose an AS has two border routers:
Router A learns a route from Provider 1. Router B learns a route from Provider 2.
Routers inside the AS need to know both possible exits. iBGP distributes this information.
26.1. Important iBGP rule
An iBGP peer does not advertise a route learned from one iBGP peer to another iBGP peer.
This is the iBGP readvertisement restriction.
Reason:
It prevents routing loops inside the AS.
Consequence:
All iBGP peers must be logically fully meshed, unless route reflectors or confederations are used.
26.2. Full mesh problem
If an AS has N iBGP routers, a full mesh requires:
\[ \frac{N(N-1)}{2} \]
iBGP sessions.
This does not scale for large networks.
Example:
N = 100 routers Number of iBGP sessions: 100 * 99 / 2 = 4950
That is too many sessions to manage manually.
27. Scaling iBGP
The lecture mentions three solutions:
- Break the AS into smaller ASes.
- Use route reflectors.
- Use confederations.
27.1. Route reflectors
A route reflector is an iBGP router that is allowed to pass routes between its clients.
Clients peer with the route reflector instead of forming a full mesh with every other router.
The route reflector passes updates to its client routers.
However, route reflectors themselves often need to be carefully connected, and multiple route reflectors may need to be fully meshed.
Intuition:
Route reflectors reduce the number of iBGP sessions by replacing full mesh with a hub-and-spoke-like structure.
27.2. Confederations
A BGP confederation splits one large AS into multiple smaller internal ASes.
To the global Internet, the whole confederation still looks like one AS.
Example:
Global view: AS64496 Internal confederation: AS65536 AS65537 AS65538
Inside, the AS is divided for scaling. Outside, other ASes see only AS64496.
28. Link failures in BGP
The lecture distinguishes two cases:
- Failure of an eBGP link.
- Failure of an iBGP link.
They behave differently.
28.1. Failure of an eBGP link
Suppose two routers in different ASes are connected directly:
AS64496 R1 --- R2 AS64497
There is an eBGP session over that physical link.
If the physical link fails:
- the TCP connection breaks,
- the BGP session goes down,
- routes learned through that session are removed.
This is desired behavior.
If the external link is down, routes through that external neighbor should no longer be used.
28.2. Failure of an iBGP link
Inside one AS, the physical link between two iBGP peers may fail, but they may still be reachable through another internal path.
Example:
R1 --- R2 \ / R3
If the direct link R1-R2 fails, R1 and R2 may still communicate through R3.
For iBGP, this is acceptable.
iBGP sessions can run over multiple internal hops.
So:
- eBGP is usually tied more closely to the external link.
- iBGP is often multi-hop and can survive internal link failures if the IGP still provides connectivity.
29. BGP convergence problems
BGP is not guaranteed to converge to a stable routing state.
Policy inconsistencies can lead to oscillations.
This means that routes keep changing and the system never reaches a stable solution.
This is not mainly a shortest-path problem. It is a policy interaction problem.
30. Multiple stable solutions
Some BGP policy systems can have multiple stable solutions.
Which solution is reached may depend on timing, failures, or the order of route updates.
This can create route triggering:
- A primary link fails.
- The network moves to a backup routing solution.
- The primary link is restored.
- The system may not return to the original solution.
- Instead, it may stay in another stable solution.
So even if BGP converges, the final stable state may depend on history.
31. Bad Gadget: no stable solution
The lecture shows the classic “Bad Gadget” example.
In this example, several ASes have ranking policies that create a cycle of preferences.
Each AS prefers an indirect route through another AS over its direct route.
Conceptually:
AS1 prefers path 1-3-0 over 1-0. AS2 prefers path 2-1-0 over 2-0. AS3 prefers path 3-2-0 over 3-0.
This creates a circular dependency:
AS1's preferred route depends on AS3. AS3's preferred route depends on AS2. AS2's preferred route depends on AS1.
The result is persistent oscillation.
The system has no stable solution.
This illustrates an important point:
BGP policies can interact in ways that cause global instability.
32. Why not perform a global policy check?
A simple idea would be:
Require every AS to publish its policies, then check globally whether the Internet routing system will converge.
This does not work well.
Problems:
- ASes do not want to reveal their policies.
- Checking convergence is computationally hard.
- Failures can still create oscillations.
- The Internet is decentralized, so global coordination is unrealistic.
33. Gao-Rexford scheme
The Gao-Rexford scheme gives local policy restrictions that guarantee stable routing under certain assumptions.
It is based on common business relationships:
- customer-provider,
- peering.
The key idea is to constrain:
- route ranking,
- route export/filtering.
The surprising result is that these restrictions match common Internet business practices.
33.1. Ranking rule
Prefer routes in this order:
customer routes > peer routes > provider routes
Why?
- Customer routes generate revenue.
- Peer routes are usually settlement-free.
- Provider routes cost money.
33.2. Export rule
Export routes according to valley-free routing:
- Routes learned from customers can be exported to everyone.
- Routes learned from providers or peers should only be exported to customers.
This prevents an AS from providing unpaid transit between providers and peers.
33.3. Valley-free principle
A valley-free AS path has this rough shape:
uphill customer-to-provider links then maybe one peer-to-peer link then downhill provider-to-customer links
It should not go:
provider -> customer -> provider
in a way that gives unpaid transit.
The valley-free principle is one of the most important policy ideas in Internet routing.
34. Why BGP and OSPF both matter
BGP and intra-AS routing protocols work together.
Example:
A router learns via BGP:
To reach prefix X, use border router 1c as NEXT-HOP.
But the router still needs to know how to reach 1c internally.
That internal path is computed by OSPF, IS-IS, or another IGP.
So:
- BGP chooses the external route and next-hop.
- OSPF/IS-IS chooses the internal path to the next-hop.
This is why a forwarding table entry for a distant prefix depends on both BGP and the IGP.
35. Summary: BGP routing tasks
BGP can be summarized by the same categories used for other routing protocols.
35.1. Neighbors
Discovery is mostly configured manually.
BGP does not automatically discover neighbors like some IGPs.
Neighbor maintenance is done with TCP and BGP KEEPALIVE messages.
35.2. Database
The database granularity is prefixes.
BGP stores routes to network prefixes, together with attributes.
Updates are incremental and filtered by policy.
35.3. Synchronization
At session startup, peers exchange their relevant routes.
After that, they exchange incremental updates.
35.4. Routing table
The “metric” is not a simple numeric distance.
The route choice is based on policy and attributes.
The route calculation is BGP best-route selection.
36. Final comparison: intra-AS vs inter-AS routing
36.1. Policy
Inter-AS routing needs policy because each AS has its own administrative and business goals.
Intra-AS routing usually has one administrator, so policy conflicts are less central.
36.2. Scale
The Internet is too large for everyone to know every internal topology.
Hierarchical routing with ASes reduces routing table size and update traffic.
36.3. Performance
Intra-AS routing can focus more directly on performance.
Inter-AS routing is often dominated by policy.
A path that is technically shorter may be rejected because it violates business policy.
37. Key takeaways
- BGP is the inter-domain routing protocol of the Internet.
- BGP advertises reachability to prefixes, together with route attributes.
- BGP is a path-vector protocol: it carries AS-PATH information to support policy and loop prevention.
- BGP route selection is policy-driven. Shortest AS-PATH does not always win.
- LOCALPREF is used inside an AS to express local policy. Higher LOCALPREF wins.
- MED lets one AS express preferred entry points to a neighboring AS. Lower MED is usually better.
- Communities are policy tags that help automate routing decisions.
- eBGP exchanges routes between ASes. iBGP distributes BGP routes inside one AS.
- iBGP has a full-mesh scalability problem because iBGP peers do not re-advertise iBGP-learned routes to other iBGP peers.
- Route reflectors and confederations are used to scale iBGP.
- BGP may fail to converge if policies conflict.
- Gao-Rexford-style customer-provider-peer policies help guarantee stable, valley-free routing.
- BGP is powerful but dangerous: a bad BGP configuration can affect not only one network, but also other networks on the Internet.