How does a router learn about paths (routes) to destinations? There are several routing mechanisms that may be used as input sources to assist a router in building its route table. Typically, routers use a combination of the following routing methods to build a router's route table:
Directly connected interface
Although there are specific advantages and disadvantages for implementing them, they are not mutually exclusive.
Directly Connected Interface
Directly connected interfaces are routes that are local to the router. That is, the router has an interface directly connected to one or more networks or subnets. These networks are inherently known through the routers configured interface attached to that network. These networks are immediately recognizable and traffic directed to these networks can be forwarded without any help from routing protocols (see Figure 3.9).
In Figure 3.9 each of the routers shown is directly connected to three links. For instance, Router A connects to networks 22.214.171.124, 126.96.36.199, and 188.8.131.52. Because Router A has a direct connection to these networks and the interfaces attached are appropriately configured, they are immediately learned and placed within the router's local route table. Datagrams received by Router A destined for any of these attached networks will be forwarded without assistance.
However, datagrams destined for networks not directly connected to Router A, such as 184.108.40.206, 220.127.116.11, and 18.104.22.168 will not be forwarded as Router A has not learned about those networks (there is no route in the route table) and does not have a directly connected interface (see Figure 3.10). In this case the datagram will be discarded and an ICMP message will be sent back to the source indicating that the destination network or host is unreachable.
Figure 3.9 This network has three Routers (A, B, and C). Each router has three directly connected networks. For example, Router A is directly connected to networks 22.214.171.124, 126.96.36.199, and 188.8.131.52 through local interfaces.
Figure 3.10 Route table showing only networks directly connected (Indicated by A C in the leftmost column) to Router A. Routes to remote networks are not known.
Directly connected routes are always the best method of routing because the router knows the network this datagram is destined for firsthand and does not rely on some other means to learn this route, such as static or dynamic routing protocols. However, when traffic is destined to networks beyond a routers locally attached links help is needed.
Static routes are routes to destination hosts or networks that an administrator has manually entered into the router's route table. Static routes define the IP address of the next hop router and local interface to use when forwarding traffic to a particular destination.
Because this type of route has a static nature, it does not have the capability of adjusting to changes in the network. If the router or interface defined fails or becomes unavailable, the route to the destination fails.
This type of routing method has the advantage of eliminating all traffic related to routing updates. Static routing tends to be ideal where the link is temporary or bandwidth is an issue, so you want to use this method for dial-up networks or point-to-point WAN links. You can implement static routes in conjunction with other routing methods to provide routes to destinations across dial backup links when primary links implementing dynamic routing protocols have failed.
You would not want to design an entire network with only this method because you would have to enter a static route on every router for each network they are not directly attached to, thus highly impractical. In addition, if a link or a router within the internetwork fails or is added, you would have to reconfigure each router, removing the failed route or adding a new route. Meanwhile, routers obviously cannot forward traffic to that destination because the original path has become invalid. Static routing can have an extreme amount of overhead in the form of intense administrative hours spent getting the network up and keeping it going.
You want to implement static routes in very small to small networks, with perhaps as little as 10 to 15 links total. Even then, dynamic routes offer so much more versatility.
Static routes conserve bandwidth because they do not cause routers to generate route update traffic; however, they tend to be time consuming because a system administrator has to manually update routes when changes occur in the network.
Static routes are also ideal for a stub network providing a single dedicated point-to-point WAN connection outside the network to an upstream ISP (Internet Service Provider) providing Internet access. Generally there is no reason to advertise your company's internal subnetworks out to the world through this connection, as most companies are concerned about having their network hacked into by intruders. The connection should only provide internal users access to Internet resources and traveling users with the capability to access network resources and e-mail via the Internet. Probably the only outsider entry you want is someone accessing the corporate Web site. This situation provides a perfect example of where static routing is needed. You can configure a "default route" directed at the upstream router, which keeps your company's internal subnetworks from being advertised while still providing inside users with a way out. Default routes are discussed later in this chapter.
Configuring Static Routing
The network diagram shown in Figure 3.11 shows the IP addresses of router interfaces connecting Routers B and C to A. It also shows Router A's interface types, such as S0 and S1 (Serial 0 and Serial 1), which indicates the specific interfaces on Router A connected to these links. Although the specific configuration of a router's interfaces is beyond the scope of this book, it's important to know which interface a Router must use to reach the next hop.
Configuration examples in this book relate specifically to routing, not to interfaces or other router configurations.
Figure 3.11 Router A is connected to two routers through serial connections, one to Router B (Serial 0) and the other to Router C (Serial 1).
In Figure 3.11, Router A has three directly connected networks. Because they are directly connected to this router, they are immediately known to Router A. The other three networks in this diagram (184.108.40.206, 220.127.116.11, and 18.104.22.168) are remote and therefore unknown to Router A. For Router A to forward datagrams to these remote networks, it must be configured with routes to these networks. Three static route entries must be added to Router A's route tablefor example, one route entry pointing to Router B as the next hop router en route to networks 22.214.171.124 and 126.96.36.199 and one route entry pointing to Router C as the next hop to 188.8.131.52. The purpose of these entries is to inform Router A of each remote network (see Figure 3.12).
Figure 3.12 Three static routes have been added to Router A.
The output in Figure 3.12 is a view of the configuration of Router A (a Cisco router). As you can see Router A has been configured with three static routes using the ip route command. The first two statements indicate that to get to network 184.108.40.206 and 220.127.116.11 with the mask 255.255.255.0, use 18.104.22.168 as the next hop router. The last statement says that to get to network 22.214.171.124, mask 255.255.255.0 use 126.96.36.199 as the next hop router. After configuration, Router A now has a path to each of these networks. To verify the routes were entered properly we will view the route table (see Figure 3.13).
Keep in mind that communication is two way. That is, for two devices to have a conversation there must be a path in both directions (forward and reverse). Therefore to complete the configuration each of the other routers (B and C) in the diagram would need to also be configured with static routes to all networks they are not directly connected to. For example, Router B would need three static routesone each to network 188.8.131.52, 184.108.40.206, and 220.127.116.11and Router C would need routes to 18.104.22.168, 22.214.171.124, and 126.96.36.199. After all routers are configured with specific paths to all remote networks they would be able to forward traffic to and between them. In addition, as new routes become available or routes fail adjustments to each router would need to be made adding or removing routes to reflect these changes.
Figure 3.13 Three static routes have been added to the router's route table (indicated by an S in the leftmost column).
Every IP host needs to have a default route either manually configured or dynamically learned. Default routes provide end hosts a way out of their local subnet and routers with a router of last resort if no other route (specifically relating to the destination) exists in the routers route table.
End hosts, although capable, do not usually maintain their own local route tables, they rely on local routers to forward traffic to remote hosts. For an end host to communicate with hosts beyond their local segment, an administrator at a minimum must configure it with an IP address of a router (known as the Default Router). You can, depending on the vendor implementation, configure end hosts to send datagrams to an alternate router if the first one on the list becomes unavailable. If an end host does not have a default router configured, it limits this host to communicating to hosts on its local segment only.
Routers use default routing as a last resort when all other methods (directly connected, static, or dynamic) have been exhausted. Routers inspect received datagrams to identify the logical Network layer address of the ultimate destination. If a directly connected static or dynamic route exists within the router's route table, it forwards the datagram.
If the destination remains unknown, that is, no method of routing has resulted in a learned route, it forces the router to use a default route. Typically, administrators implement default routes on point-to-point (a link with only two routers) or dial-up connections, linking a company's network to the outside work.
You may implement dynamic or static routes within the company's network to facilitate the learning of route information of local links. You could then use a default route to direct all traffic outside your network regardless of destination. This provides a good method because somewhere near 80,000 plus routes exist on the Internet and it would overwhelm routers if they had to learn and maintain each one of these routes. By implementing a default route the router simply directs all traffic to unknown destinations through the default path, typically serviced by an ISP.
Default routes are static routes that are used to define a route to an unknown destination. Typically you won't need to configure a default route on a router because the router should already know how to route a frame to a destination by consulting their route table for a known path. However, if the router has no learned path, it uses the default route statement (also known as the router of last resort).
Figure 3.14 shows the configuration of a default route on a Cisco router.
Figure 3.14 The values for the destination network and subnet mask fields are all zeros. The zeros represent any unknown destination.
In Figure 3.14 a default route statement has been added to a router. The default route specifies that to get to any unknown network, with any mask, the router should use 188.8.131.52 as its Default Router. Figure 3.15 shows a router's route table with a default route.
Figure 3.15 An output screen of a router's route table with a default route configured.
Router output screens vary from vendor to vendor, figure 3.15 shows a sample route table taken from a Cisco router. In this example, the S (in the leftmost column) indicates the route has been statically entered. The * signifies that this route is a candidate for default routing. Also note that the Gateway of last resort is now set, indicating this route will be used when no other route exists in the table.
Interior Versus Exterior Routing Protocols
Routing protocols fall into two categories, Interior and Exterior. Interior protocols called IGPs (Interior Gateway Protocols), refer to any routing protocol used exclusively within an Autonomous System, providing Intra-AS routing. Each IGP represents a single routing domain within the AS. Multiple IGPS may exist within an AS. Exterior protocols called EGPs (Exterior Gateway Protocols) are routing protocols that facilitate routing between and across different AS'. EGPs provide Inter-AS routing. IGP and EGP are discussed later in this chapter.