Skip to main content
Routing defines how packets travel from one network to another. This guide compares static and dynamic routing — when to use each, configuration examples, and how they apply in both on-prem and cloud (AWS VPC) environments.

Overview

TypeDescriptionUse Case
Static RoutingAdministrator manually defines routesSmall networks, lab setups, or edge routing with predictable paths
Dynamic RoutingRouters exchange routes automatically using protocols (e.g. OSPF, BGP)Large, scalable, or frequently changing environments

Static Routing

Static routes are manually configured and do not change unless the admin modifies them. They’re predictable and simple but don’t adapt to network failures automatically.

Advantages

Full Control

No route advertisement leaks

Low Overhead

Minimal CPU/RAM, no protocol chatter

Easy Auditing

You know every path explicitly

Disadvantages

No Failover

No automatic failover

High Admin Overhead

High admin overhead at scale

Error Prone

Prone to human error (typos, forgotten updates)

Configuration Examples

# Add a static route (temporary)
ip route add 10.20.0.0/16 via 192.168.1.1

# Make persistent (RHEL/AlmaLinux)
echo "10.20.0.0/16 via 192.168.1.1 dev eth0" >> /etc/sysconfig/network-scripts/route-eth0

Dynamic Routing

Dynamic routing protocols learn and share routes automatically. They detect network changes and reroute traffic when links fail — ideal for large, redundant topologies.

Common Protocols

ProtocolTypeNotes
RIPDistance-vectorObsolete; max 15 hops; good for labs
OSPFLink-stateHierarchical; ideal for enterprise LANs
EIGRPHybridCisco-proprietary (now partially open)
BGPPath-vectorUsed for ISPs, multi-site, and AWS Transit Gateway

Advantages

Auto-learns Topology

Automatically learns network topology

Failover Support

Supports failover and load balancing

Lower Admin Work

Reduces admin workload

Disadvantages

Complexity

More complex to configure and troubleshoot

Resource Usage

Consumes CPU/RAM for routing table updates

Misconfig Risk

Protocol misconfigurations can propagate quickly

Configuration Examples

Router(config)# router ospf 1
Router(config-router)# network 10.0.0.0 0.0.0.255 area 0
Router(config-router)# network 192.168.1.0 0.0.0.255 area 0
Router(config)# do show ip ospf neighbor

AWS VPC Routing

TypeDescriptionExample
Static RouteAdded manually to route table10.0.2.0/24 → nat-0abc12345
Dynamic RoutePropagated from VPN / Direct Connect / TGWAutomatically updates with BGP peers
AWS route propagation uses BGP under the hood when connected via VPN or Direct Connect gateways.

When to Use Which

ScenarioRecommended
Small lab / testbedStatic
Branch offices with few routesStatic or OSPF stub
Multi-site enterpriseOSPF / EIGRP
Internet peering, cloud hybridBGP
AWS VPCs with VPN or TGWDynamic (BGP propagation)

Security Considerations

Disable Unused Protocols

Disable unused routing protocols (no router rip if not in use)

Authenticate Neighbors

Authenticate OSPF or BGP neighbours (MD5 / keychain)

Filter Advertisements

Filter route advertisements (prefix-lists, route-maps)

Prevent Route Leaks

Avoid default route leaks in hybrid environments

Lab Exercise

1

Build Topology

Build a 3-router topology (3750X or GNS3/Packet Tracer)
2

Configure Static Routes

Configure static routes between all subnets
3

Replace with OSPF

Replace static routes with OSPF (single area)
4

Simulate Failure

Simulate a link failure — note how OSPF self-heals, but static does not
5

Cloud Comparison

For cloud comparison, replicate the same in AWS using two VPCs with BGP-enabled site-to-site VPNs

Further Reading

Build docs developers (and LLMs) love