How routing works
The router learns the next hop for packets using one of two methods:
- Static routing: With static routing, the network engineer manually enters the routes and tells the router, for each IP network, what next hop that traffic should be delivered to.
- Dynamic routing: With dynamic routing, the network engineer configures a routing protocol on the network interfaces. The routing protocol learns about other routers automatically. The router and the other routers exchange routes, and each learns about the networks that the other is connected to. When new networks are added or removed, the routers update each other.
Static routing issues
With static routing, the engineer tells the router to send traffic with a destination IP address to a router with an IP address of x.x.x.x. This is handy for a small network with very few routes or for someone who wants to have absolute control, but it can become very cumbersome as the network grows. To keep a large network fully connected via static routes, you need to create a route on every router for every other router. This is unworkable for very large networks.
Benefits of dynamic routing
A dynamic routing protocol can resolve these
- More automation: Routing updates are automatically sent to all other routers.
- Change notification: The dynamic routing protocol may be able to reroute traffic around a link that is down or congested.
- Greater uptime for users: Because the routing protocol has intelligence and can react faster, users may see more uptime.
- Greater network throughput: Because the routing protocol may be able to calculate the most responsive network link to use, users may see less latency and more performance out of the network.
Gotchas of dynamic routing
Don't think that dynamic routing protocols are perfect, however. Here are some possible gotchas of using dynamic routing protocols:
- Routers may need more CPU and RAM to hold routing tables and calculate dynamic routes.
- Dynamic routing protocols aren't perfect and can experience routing loops in some cases.
- Dynamic routing protocols have a high level of complexity and require staff that understand how to configure and troubleshoot them.
Dynamic routing protocols
You may be wishing you had some examples of dynamic routing protocols. I'm not going to cover or compare all possible routing protocols, but let's talk about the basic dynamic routing protocols all network engineers need to know.
First off, there are the interior gateway routing protocols (IGPs). They are the protocols that are supported by just about every router and server operating system (such as Windows 2003 Server and Linux):
- OSPF (Open Shortest Path First) -- RFC2328 -- is the most popular dynamic routing protocol in use today. It is an open protocol, so that any router or server operating system can run OSPF. OSPF selects the best route using "cost" as its metric. OSPF is a full-featured routing protocol and can be complex, but it can also scale to any size of network.
- EIGRP – (Enhanced Interior Gateway Routing Protocol) is a Cisco proprietary protocol. Only Cisco devices run EIGRP. EIGRP is a full-featured routing protocol, similar to OSPF. EIGRP has some great features, but unless you can guarantee that you will always have an all-Cisco network, I would recommend an open protocol like OSPF, instead. EIGRP replaced IGRP, its predecessor. With EIGRP, the metric used to select the best route is calculated using a formula that takes into account the bandwidth, reliability, load and delay of the link.
- RIP (Routing Information Protocol) Version 2 -- RFC2453 -- is also an open source protocol. Version 2 of RIP is what you should use today as it provides support for VLSM (Variable Length Subnet Mask). RIP is the simplest and easiest routing protocol to configure, but it also has fewer features than OSPF and is limited to routing for a network with fewer than 15 hops. RIP works very well for a small network that doesn't plan on growing large, however. Another great thing about RIP is that it is commonly supported by even small routers and firewalls.
And, in a class by itself, there is Border Gateway Protocol (BGP):
- BGP (Border Gateway Protocol) is the routing protocol of the Internet. BGP is an Exterior Gateway Protocol (EGP). What that means is that BGP is used by routers that make routing decisions on the Internet. BGP is a path-vector protocol, and it selects the best route, unlike other routing protocols. BGP uses the "AS-PATH" as its routing metric and would select the route that has the shortest path through the Internet.
Configuring dynamic routing
So all this theoretical stuff is great, right? It gives you a good foundation, but you probably want to see how to configure a dynamic routing protocol.
Let's say that we have the basic network, shown below:
In our basic example, it is our job to configure RIP between these two locations so that each network knows about the other router's networks. Assuming that all normal router IP addressing is configured and interfaces have been enabled, we need issue only a few simple commands on each router to accomplish this. Here is the configuration:
What this does is:
Once completed, here is the routing table and ping output for Location A:
Location-A# show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is not set 10.0.0.0/24 is subnetted, 2 subnets R 10.2.2.0 [120/1] via 188.8.131.52, 00:00:16, Serial0 C 10.1.1.0 is directly connected, Ethernet0 184.108.40.206/30 is subnetted, 1 subnets C 220.127.116.11 is directly connected, Serial0 Location-A# ping 10.2.2.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.2.2.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 32/35/36 ms Location-A# And here is Location B's routing table: Location-B# show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default U - per-user static route Gateway of last resort is not set 10.0.0.0/8 is subnetted, 2 subnets R 10.1.1.0 [120/1] via 18.104.22.168, 00:00:00, Serial0 C 10.2.2.0 is directly connected, Ethernet0 22.214.171.124/8 is subnetted, 1 subnets C 126.96.36.199 is directly connected, Serial0 Location-B# ping 10.1.1.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echoes to 10.1.1.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 32/35/36 ms Location-B#
As you can see, each router knows about the other router's LAN networks through RIP (the "R" in the routing table source shows that these routes were learned through RIP). Also, each router can ping other routers' Ethernet interfaces.
We could have accomplished the same connectivity with only one static route on each router. However, as this network grows from two routers to 20 or 200, the time needed to administer static routing would be a horrible administrative burden.
About the author:
David Davis (CCIE #9369, CWNA, MCSE, CISSP, Linux+, CEH) has been configuring routers for 15 years. Currently, he manages a group of systems/network administrators for a privately owned retail company and authors IT-related material in his spare time. He has written more than 50 articles, eight practice tests and three video courses and has co-authored one book. His Web site is HappyRouter.com.
This was first published in July 2007