Hello! In our last lesson, you learned how to manually create static routes to teach routers about remote networks. This is a powerful skill, but as you might imagine, manually configuring routes for every possible destination on a large network—let alone the entire internet—is impossible. This is where networks learn to manage themselves.
This lesson introduces the solution: dynamic routing protocols. You will learn to explain the purpose of dynamic routing protocols (OSPF vs. BGP) and their primary use cases (internal vs. external). Understanding this distinction is fundamental for anyone working in network operations or data centers, and it's a concept you will almost certainly need to explain in a job interview.
Instead of being told where to send traffic, routers running a dynamic routing protocol talk to each other, automatically sharing information about the networks they can reach. We'll focus on the two most important protocols in modern networking: OSPF and BGP.
1. The Big Picture: Autonomous Systems (AS)
The first and most important concept to grasp is the Autonomous System (AS). An AS is simply a collection of routers and networks under a single administrative authority. Think of it as one "domain" of control.
- A company's internal network is an AS.
- A university campus network is an AS.
- An Internet Service Provider's (ISP) network is an AS.
This concept divides the entire internet into distinct, manageable blocks.

To understand this better, let's watch a short, clear explanation.
EGP / IGP :: Distance Vector / Link State :: Dynamic Routing Protocols :: OSPF EIGRP BGP RIP IS-IS
This video from Practical Networking introduces the concept of an Autonomous System and how it forms the basis for categorizing routing protocols.
Watch from 01:30 to 03:54. Focus on the definition of an Autonomous System and how it leads to two distinct types of routing needs: inside the AS and between ASs.
2. Interior vs. Exterior Protocols: The Great Divide
Now that you understand the concept of an AS, the primary use cases for OSPF and BGP become clear. Routing protocols are split into two main families based on where they operate.
Interior Gateway Protocols (IGPs)
- Purpose: To exchange routing information within a single Autonomous System.
- Primary Example: OSPF (Open Shortest Path First)
- Design Goal: Speed and responsiveness. Within your own network, you want routers to find the fastest path and react quickly to any failures (like a cut cable). They tend to be "chatty" to ensure everyone has up-to-date information.
Exterior Gateway Protocols (EGPs)
- Purpose: To exchange routing information between different Autonomous Systems.
- Primary Example: BGP (Border Gateway Protocol) - This is the only EGP used on the modern internet.
- Design Goal: Stability, scalability, and policy control. BGP is designed to handle the massive scale of the internet. It's less concerned with raw speed and more with providing fine-grained control over how traffic enters and leaves your network. This is crucial for security and managing business relationships between ISPs.
This next video segment explains these differing design goals perfectly.
EGP / IGP :: Distance Vector / Link State :: Dynamic Routing Protocols :: OSPF EIGRP BGP RIP IS-IS
Let's continue with the Practical Networking video to understand why IGPs and EGPs are designed so differently.
Watch from 03:54 to 06:42. Pay close attention to the comparison: IGPs are tuned for speed, while EGPs (BGP) are tuned for stability, security, and control. This is the key takeaway for an interview question.
3. A Closer Look at OSPF and BGP
While their primary use cases are clear, OSPF and BGP also work in fundamentally different ways. Understanding this helps explain why they are suited for their respective roles.
BGP vs OSPF: Differences & Tutorials
This article from Catchpoint, 'BGP vs OSPF', provides an excellent, detailed comparison. We'll start with the summary table and the explanation of the key differences.
Read the section 'Summary of differences between OSPF and BGP' and the following section 'Differences between OSPF and BGP'. Focus on the table and the paragraphs that elaborate on each point (Routing domain, Size, Convergence, etc.).
Let's summarize the key technical differences from that reading.
| Feature | OSPF (An IGP) | BGP (An EGP) |
|---|---|---|
| Type | Link-State. Each router builds a complete map of the entire network topology. | Path-Vector. Routers exchange full path information (a list of AS numbers) to reach a destination. |
| Goal | Find the fastest path within a single network. | Find the best path based on policy, not just speed. Scalability is paramount. |
| Metric | Cost, typically based on interface bandwidth. A faster link has a lower cost. | Path Attributes. A complex set of rules to influence path selection (e.g., business relationships, security). |
| Convergence | Fast. When a link fails, new routes are calculated and propagated quickly. | Slow. Designed for stability on the massive internet; rapid changes are intentionally dampened. |
| Use Case | Routing within your company or data center network. | Routing between your company and your ISP, or between ISPs. The backbone protocol of the internet. |
To see how these protocols operate under the hood, let's watch one more short clip.
EGP / IGP :: Distance Vector / Link State :: Dynamic Routing Protocols :: OSPF EIGRP BGP RIP IS-IS
This final clip explains the difference between the algorithms used by OSPF (Link-State) and other protocols (Distance-Vector), which BGP evolves from (Path-Vector).
Watch from 06:42 to 10:20. Don't worry about the specific names 'RIP' or 'EIGRP'. Focus on the conceptual difference: a Link-State protocol (like OSPF) knows the entire map, while a Distance-Vector protocol knows only what its immediate neighbors tell it ('routing by rumor'). BGP's Path-Vector approach builds on this by having neighbors share the entire AS path.
4. Practical Application: Choosing the Right Tool
Imagine you are a network engineer at a growing tech company. Your network consists of a main office, a new data center, and a connection to the internet via an ISP.
Here's a diagram of the setup:
- Main Office Network: Contains user computers and office servers.
- Data Center Network: Contains production servers and storage.
- A dedicated link connects the Main Office and the Data Center.
- Both the Main Office and the Data Center have their own connection to the same ISP.
- Your company's entire network is designated as AS 65001.
- The ISP's network is AS 7500.
Your Task: For each of the following scenarios, which protocol would you choose, OSPF or BGP? And why?
- Routing between the routers inside your Main Office network.
- Routing between the Main Office and the Data Center.
- Routing between your company's network (AS 65001) and the ISP (AS 7500).
Think through your answers based on what you've learned about internal vs. external routing.
Solution
-
Inside the Main Office: You would use OSPF. This is routing within your single Autonomous System (AS). You want fast convergence and don't need the complex policy controls of BGP for your internal traffic.
-
Between Office and Data Center: You would still use OSPF. Even though they are in different physical locations, they are both part of the same administrative domain—your company (AS 65001). This is still considered internal (intra-AS) routing.
-
Between your Company and the ISP: You must use BGP. This is the classic use case for an Exterior Gateway Protocol. You are connecting two different Autonomous Systems (AS 65001 and AS 7500). BGP will allow your company to advertise its public IP addresses to the internet and control how traffic flows to and from the ISP.
Conclusion
You've just covered a crucial topic that separates simple networks from large, scalable infrastructures. While static routing gives you manual control, dynamic routing protocols allow networks to operate and adapt on their own.
Key Takeaways:
- Autonomous System (AS): A network under a single administration, forming the basic building block of the internet.
- Interior Gateway Protocols (IGPs): Used for routing within an AS. OSPF is the most common example. They are designed for speed and fast recovery from failures.
- Exterior Gateway Protocols (EGPs): Used for routing between ASs. BGP is the protocol that runs the internet. It is designed for massive scale, stability, and policy-based control.
- OSPF uses a Link-State algorithm to build a full map of the internal network, finding the fastest path based on link cost.
- BGP uses a Path-Vector algorithm, making decisions based on a list of attributes and the AS path to enforce routing policies.
In our next lesson, we'll address another critical piece of connecting a private network to the public internet: Network Address Translation (NAT). You'll learn how a whole office of computers using private IP addresses can access the internet using just one (or a few) public IP addresses, a process made possible by the BGP connection you just learned about.