Connected, static & dynamic routes
Connected routesSubnets directly connected to a router interface are added to the router’s routing table. Interface has to have an IP address configured and both interface status codes must be in the “up and up” state. A router will be able to route all packets destined for all hosts in subnets directly connected to its active interfaces.
Consider the following example. The router has two active interfaces, Fe0/0 and Fe0/1. Each interface has been configured with an IP address and is currently in the up-up state, so the router adds these subnets to its routing table.
As you can see from the output above, the router has two directly connected routes to the subnets 10.0.0.0/8 and 192.168.0.0/24. The character „C“ in the routing table indicates that a route is a directly connected route.
TIP – you can see only connected routes in a router’s routing table by typing the show ip route connected command.
By adding static routes, a router can learn a route to a remote network that is not directly connected to one of its interfaces. Static routes are configured manually by typing the global configuration mode command ip route DESTINATION_NETWORK SUBNET_MASK NEXT_HOP_IP_ADDRESS. This type of configuration is usually used in smaller networks because of scalability reasons (you have to configure each route on each router).
A simple example will help you understand the concept of static routes.
Router A is directly connected to router B. Router B is directly connected to the subnet 10.0.1.0/24. Since that subnet is not directly connected to Router A, the router doesn’t know how to route packets destined for that subnet. You have to configure that route manually.
First, consider the router A’s routing table before adding the static route:
TIP – another version of the ip route command exists. You don’t have to specify the next-hop IP address. You can rather specify the exit interface of the local router. In the example above you could have typed the ip route DEST_NETWORK NEXT_HOP_INTERFACE command to instruct router A to send all traffic destined for the subnet out the right interface.
Dynamic routesA router can learn dynamic routes if a routing protocol is enabled. A routing protocol is used by routers to exchange routing information with each other. Every router in a network can then use information to build its routing table. A routing protocol can dynamicaly choose a different route if a link goes down, so this type of routing is fault-tolerant. Also, unlike with static routing, there is no need to manually configure every route on every router, which greatly reduces the administrative overhead. You only need to define which routes will be advertised on a router that connect directly to the corresponding subnets, routing protocols take care of the rest.
One of the disadvantages of dynamic routing is that it increases memory and CPU usage on a router, because every router has to process received routing information and calculate its routing table.
To better understand the advantage that dynamic routing procotols bring, consider the following example.
You can see that Router A has learned the subnet from EIGRP. The letter „D“ in front of the route indicates that the route has been learned through EIGRP.
If the subnet 10.0.0.0/24 fails, Router B can immediately inform Router A that the subnet is no longer reachable.