Networking - Static Routing and Dynamic Routing
1. What is Routing?
Routing is the process of forwarding data packets from a source device to a destination device across networks.
This is done by routers using a routing table.
There are two main types of routing:
-
Static Routing → Manually configured routes
-
Dynamic Routing → Automatically configured routes using routing protocols
2. Static Routing
Definition
Static routing means the network administrator manually configures the routes in the router.
The router always uses the manually configured path to reach a destination.
Characteristics
-
Routes are fixed unless changed manually.
-
No automatic updates when the network changes.
-
Best for small, simple, and stable networks.
Example Scenario
Network Topology:
[PC1] 192.168.1.10
|
Router A (192.168.1.1) ------- Router B (192.168.2.1)
|
[PC2] 192.168.2.10
If PC1 wants to send data to PC2, we configure a static route on Router A:
Command (Cisco):
RouterA(config)# ip route 192.168.2.0 255.255.255.0 192.168.1.2
Meaning:
-
To reach
192.168.2.0
network, send packets to next-hop192.168.1.2
(Router B).
Advantages of Static Routing
-
Simple to configure.
-
No extra bandwidth usage.
-
Very secure (no automatic updates).
Disadvantages of Static Routing
-
Not scalable for large networks.
-
If a route fails, it must be updated manually.
-
High administrative overhead.
3. Dynamic Routing
Definition
Dynamic routing uses routing protocols that allow routers to automatically exchange information and update routes.
Routers learn routes automatically and adjust when the network changes.
Characteristics
-
Uses routing protocols like RIP, OSPF, EIGRP, BGP.
-
Updates routing tables automatically.
-
Best for medium to large and frequently changing networks.
Example Scenario
Using the same topology as above, if we enable OSPF on both routers:
Command (Cisco):
RouterA(config)# router ospf 1
RouterA(config-router)# network 192.168.1.0 0.0.0.255 area 0
RouterB(config)# router ospf 1
RouterB(config-router)# network 192.168.2.0 0.0.0.255 area 0
-
Routers automatically exchange routes.
-
If Router B’s link fails, OSPF finds an alternative path automatically.
Advantages of Dynamic Routing
-
Automatically updates routing tables.
-
Scalable for large, complex networks.
-
Adapts quickly to topology changes.
Disadvantages of Dynamic Routing
-
Consumes more CPU, memory, and bandwidth.
-
More complex to configure.
-
Less secure if not properly configured.
4. Static vs Dynamic Routing
Feature | Static Routing | Dynamic Routing |
---|---|---|
Configuration | Manual | Automatic |
Routing Protocols | Not used | Uses RIP, OSPF, BGP, etc. |
Scalability | Low | High |
Best for | Small, simple networks | Medium to large networks |
Updates | Manual | Automatic |
Failure Handling | Administrator must fix | Router updates routes automatically |
Speed | Faster for small networks | Better for large networks |
Security | More secure | Less secure if misconfigured |
5. Diagram
┌─────────────┐
│ Router A │
│192.168.1.1 │
└─────┬───────┘
│
Static Route │ Dynamic Route via OSPF/RIP
│
┌─────┴───────┐
│ Router B │
│192.168.2.1 │
└─────┬───────┘
│
[PC2]
192.168.2.10
-
Static Routing → You manually configure the route from Router A to Router B.
-
Dynamic Routing → Routers learn automatically using protocols like OSPF or RIP.
6. When to Use Which
Network Size | Recommended Routing Type |
---|---|
Small LAN / Office | Static Routing |
Medium Enterprise | Dynamic Routing (OSPF / EIGRP) |
Large ISP / Internet Backbone | Dynamic Routing (BGP) |