静态与动态路由 CCNA:两条路径,一个目的地
静态与动态路由 CCNA 问题归结为恰好两个选项。
在网络路由时,您有两个主要选项:
- 静态路由: 由网络管理员手动配置
- 动态路由: 通过协议自动学习的路由
了解何时使用以及如何配置两者——是关键技能 CCNA 考试 以及实际网络环境中。
本博客将带您了解差异、命令、优缺点以及示例实验。
🧭 什么是静态路由?
静态路由意味着您 手动定义路由 数据包应走的路径。
ip route 192.168.2.0 255.255.255.0 192.168.1.2
这告诉路由器:
“要到达 192.168.2.0, 将流量转发至 192.168.1.2。”
静态路由的优势
- 适用于小型网络,配置简单
- 无 CPU/内存开销
- 更安全(无路由通告)
- 对路径拥有完全控制
静态路由的劣势
- 无法适应网络变化
- 在大型网络中变得复杂
- 拓扑变化时需要手动更新
什么是动态路由?
动态路由使用 路由协议 自动学习并更新路由。
常用协议:
- RIP (较旧,距离向量)
- OSPF (现代,链路状态)
- EIGRP (Cisco proprietary, hybrid)
router ospf 1
network 192.168.1.0 0.0.0.255 area 0
Advantages of Dynamic Routing
- Automatically adapts to changes
- Scalable to large, complex networks
- Reduces admin overhead
❌ Disadvantages of Dynamic Routing
- More CPU/RAM usage
- Needs protocol knowledge
- Slightly more complex configuration
Administrative Distance: How a Router Picks Between Routes
A router often learns more than one path to the same destination – a static route AND an OSPF-learned route to the same network, for example. Administrative Distance (AD) is the number Cisco routers use to decide which source to trust when that happens – lower always wins:
| Route source | Default AD |
|---|---|
| Connected interface | 0 |
| Static route | 1 |
| EIGRP | 90 |
| OSPF | 110 |
| RIP | 120 |
A static route’s AD of 1 is why a static route always overrides a dynamically learned one to the same destination by default – it is treated as more trustworthy than any protocol’s guess. This matters directly for the next topic below.
Floating Static Routes: Static Routing’s Dynamic Trick
A floating static route is a static route configured with a higher AD than the dynamic protocol already running, so it sits unused as a backup and only activates if the dynamic route disappears:
ip route 192.168.2.0 255.255.255.0 10.0.0.2 200
The trailing 200 sets this static route’s AD to 200 – higher than OSPF’s 110, so OSPF wins while it is up. If OSPF loses the route (a link fails, a neighbor drops), this static route – now the best remaining option – takes over automatically. This is the real-world middle ground between pure static and pure dynamic: a guaranteed backup path that does not require protocol overhead until it is actually needed.
🆚 Static vs Dynamic Routing – Side-by-Side Comparison
| 特性 | 静态路由 | 动态路由 |
|---|---|---|
| Configuration | Manual | Automatic via protocol |
| Adaptability | 否 | Yes |
| Resources Used | Low | Medium-High |
| Best for | Small/secure networks | Large/changing networks |
| Example Protocols | N/A | RIP, OSPF, EIGRP |
🧪 Packet Tracer Lab Example
Lab Topology:
- Router1 (192.168.1.1) → Router2 (192.168.2.1)
Static Routing Example:
On Router1:
ip route 192.168.2.0 255.255.255.0 10.0.0.2
On Router2:
ip route 192.168.1.0 255.255.255.0 10.0.0.1
OSPF Routing Example:
On both routers:
router ospf 1
network 192.168.0.0 0.0.255.255 area 0
Verifying and Troubleshooting Routes
Configuring a route and confirming it is actually being used are different steps, and skipping the second one is a common exam and real-world mistake:
Router# show ip route
Router# show ip protocols
Router# traceroute 192.168.2.1
show ip route shows every route the router currently has installed and which source (S for static, O for OSPF, and so on) won it – this is where administrative distance decisions become visible directly. show ip protocols confirms a dynamic routing protocol is actually running and which networks it is advertising – a surprisingly common exam trap is a router ospf block with the wrong wildcard mask, which looks configured but advertises nothing. traceroute from an end device shows the actual hop-by-hop path traffic takes, which is the fastest way to confirm a route is not just installed but genuinely being used end to end.
💬 When to Use Static or Dynamic?
Use Static Routing When:
- Your network is small or rarely changes
- You want full control
- Security is a concern
Use Dynamic Routing When:
- You manage large or frequently changing networks
- You want automatic failover
- You need protocol flexibility (OSPF, EIGRP)
learn More
- ✅ What Is Routing in Networking?
- ✅ CCNA Lab Exercises
- 🌐 Cisco Static Routing Overview
- 🌐 Understanding OSPF – NetworkLessons
🙋♂️FAQ
What is the main difference between static and dynamic routing?
Static routing is manually configured. Dynamic routing uses protocols to learn and adjust paths automatically.
Is static routing better than dynamic?
Static routing is better for small, stable networks. Dynamic routing is better for large, scalable environments.
Which protocol is used in dynamic routing?
Popular ones are RIP, OSPF, and EIGRP (Cisco). OSPF is often preferred in enterprise setups.
Does CCNA require knowing both?
Yes, you must know how to configure and troubleshoot both static and dynamic routing methods for the CCNA exam.
如果你更愿意有人一步步带你完成此过程,或者需要特定的 Packet Tracer 实验完成并解释,而不是自己摸索,请查看 CCNA 与 Packet Tracer 辅导 页面了解其工作原理。
Routing decisions and VLAN design go hand in hand on the real exam – see VLANs and Inter-VLAN Routing Explained for CCNA for the segmentation side of this topic.


2 Comments
Thanks a lot for the feedback! The RSS feed should be working, but I’ll check it from my end. Please let me know which RSS reader you’re using so I can help further.
Danke für die Mühe, die man dem Text anmerkt. Ich möchte das demnächst weiterempfehlen.