Let’s explain the types of routes that can be found in a router’s routing table.
Subnets directly connected to a router’s 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, Fa0/0 and Fa0/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.
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.0.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. However. you can configure that route manually on router A.
First, consider the router A’s routing table before we add the static route:
Now, we’ll use the static route command to configure router A to reach the subnet 10.0.0.0/24. The router now has the route to reach the subnet.
The character S in the routing table indicates that a route is a statically configured route.
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 we 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. In our case, the command would be ip route 10.0.0.0 255.255.255.0 Fa0/0.
A 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 the 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.
The disadvantage 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 advantages that dynamic routing procotols bring, consider the following example:
Both routers are running a routing protocol, namely EIGRP. There is no static routes on Router A, so R1 doesn’t know how to reach the subnet 10.0.0.0/24 that is directly connected to Router B. Router B then advertises the subnet to Router A using EIGRP. Now Router A has the route to reach the subnet. This can be verified by typing the show ip route command:
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.
Download our Free CCNA Study Guide PDF for complete notes on all the CCNA 200-301 exam topics in one book.
We recommend the Cisco CCNA Gold Bootcamp as your main CCNA training course. It’s the highest rated Cisco course online with an average rating of 4.8 from over 30,000 public reviews and is the gold standard in CCNA training: