Common Routing Configurations

Common Routing Configurations
GregDeamons Profile Pic
GregDeamons,New Zealand,Professional
Published Date:03-08-2017
Your Website URL(Optional)
Chapter 7 CHAPTER 7 In this chapter: • Common Routing Configurations • The Minimal Routing Table Configuring Routing • Building a Static Routing Table • Interior Routing Protocols • Exterior Routing Protocols • Gateway Routing Daemon • Configuring gated Routing is the glue that binds the Internet together. Without it, TCP/IP traffic is lim- ited to a single physical network. Routing allows traffic from your local network to reach its destination somewhere else in the world—perhaps after passing through many intermediate networks. The important role of routing and the complex interconnection of Internet networks make the design of routing protocols a major challenge to network software develop- ers. Consequently, most discussions of routing concern protocol design. Very little is written about the important task of properly configuring routing protocols. How- ever, more day-to-day problems are caused by improperly configured routers than by improperly designed routing algorithms. As system administrators, we need to ensure that the routing on our systems is properly configured. This is the task we tackle in this chapter. Common Routing Configurations First, we must make a distinction between routing and routing protocols. All systems route data, but not all systems run routing protocols. Routing is the act of forward- ing datagrams based on the information contained in the routing table. Routing pro- tocols are programs that exchange the information used to build routing tables. A network’s routing configuration does not always require a routing protocol. In sit- uations where the routing information does not change—for example, when there is only one possible route—the system administrator usually builds the routing table manually. Some networks have no access to any other TCP/IP networks and there- fore do not require that the system administrator build the routing table at all. The three most common routing configurations are the following. Chapter 4 presents guidelines for choosing the correct routing configuration for your network. 170 This is the Title of the Book, eMatter Edition Copyright © 2010 O’Reilly & Associates, Inc. All rights reserved.Minimal routing A network completely isolated from all other TCP/IP networks requires only minimal routing. A minimal routing table usually is built when the network interface is configured by adding a route for each interface. If your network doesn’t have direct access to other TCP/IP networks and you are not using sub- netting, this may be the only routing table you’ll require. Static routing A network with a limited number of gateways to other TCP/IP networks can be configured with static routing. When a network has only one gateway, a static route is the best choice. A static routing table is constructed manually by the sys- tem administrator using the route command. Static routing tables do not adjust to network changes, so they work best where routes do not change. Dynamic routing A network with more than one possible route to the same destination should use dynamic routing. A dynamic routing table is built from the information exchanged by routing protocols. The protocols are designed to distribute infor- mation that dynamically adjusts routes to reflect changing network conditions. Routing protocols handle complex routing situations more quickly and accu- rately than the system administrator can. Routing protocols are designed not only to switch to a backup route when the primary route becomes inoperable, but also to decide which is the “best” route to a destination. On any network where there are multiple paths to the same destination, a routing protocol should be used. Routes are built manually by the system administrator or dynamically by routing protocols. But no matter how routes are entered, they all end up in the routing table. The Minimal Routing Table Let’s look at the contents of the routing table constructed when ifconfig is used to configure the network interfaces on a Solaris 8 system: % netstat -rn Routing Table: IPv4 Destination Gateway Flags Ref Use Interface - - - U 1 8 dnet0 U 1 0 dnet0 UH 20 3577 lo0 The first entry is the route to network through interface dnet0. Address is not a remote gateway address; it is the address assigned to the dnet0 interface on this host. The other two entries do not define routes to real physical net- works; both are special software conventions. is the multicast address. This entry tells Solaris to send multicast addresses to interface for delivery. The last entry is the loopback route to localhost created when lo0 was configured. The Minimal Routing Table 171 This is the Title of the Book, eMatter Edition Copyright © 2010 O’Reilly & Associates, Inc. All rights reserved.Look at the Flags field for these entries. All entries have the U (up) flag set, indicat- ing that they are ready to be used, but no entry has the G (gateway) flag set. The G flag indicates that an external gateway is used. The G flag is not set because all of these routes are direct routes through local interfaces, not through external gateways. The loopback route also has the H (host) flag set. This indicates that only one host can be reached through this route. The meaning of this flag becomes clear when you look at the Destination field for the loopback entry. It shows that the destination is a host address, not a network address. The loopback network address is The destination address shown ( is the address of localhost, an individual host. Some systems use a route to the loopback network and others use a route to the localhost, but all systems have some route for the loopback interface in the rout- ing table. Although this routing table has a host-specific route, most routes lead to networks. One reason network routes are used is to reduce the size of the routing table. An organization may have only one network but hundreds of hosts. The Internet has thousands of networks but millions of hosts. A routing table with a route for every host would be unmanageable. Our sample table contains only one route to a physical network, There- fore, this system can communicate only with hosts located on that network. The lim- ited capability of this routing table is easily verified with the ping command. ping uses the ICMP Echo Message to force a remote host to echo a packet back to the local host. If packets can travel to and from a remote host, it indicates that the two hosts can successfully communicate. To check the routing table on this system, first ping another host on the local net- work: % ping -s crab PING 56 data bytes 64 bytes from ( icmp_seq=0. time=11. ms 64 bytes from ( icmp_seq=1. time=10. ms C PING Statistics 2 packets transmitted, 2 packets received, 0% packet loss round-trip (ms) min/avg/max = 10/10/11 ping displays a line of output for each ICMP ECHO_RESPONSE received. When ping is interrupted, it displays some summary statistics. All of this indicates successful communication with crab. But if we check a host that is not on network, say a host at O’Reilly, the results are different. % ping sendto: Network is unreachable Sun’s ping would display only the message “crab is alive” if the -s option was not used. Most ping imple- mentations do not require the -s option. 172 Chapter 7: Configuring Routing This is the Title of the Book, eMatter Edition Copyright © 2010 O’Reilly & Associates, Inc. All rights reserved.Here the message “sendto: Network is unreachable” indicates that this host does not know how to send data to the network that host is on. There are only three routes in this system’s routing table, and none is a route to Even other subnets on books-net cannot be reached using this routing table. To dem- onstrate this, ping a host on another subnet. For example: % ping sendto: Network is unreachable These ping tests show that the minimal routing table created when the network inter- faces were configured allows communication only with other hosts on the local net- work. If your network does not require access to any other TCP/IP networks, this may be all you need. However, if it does require access to other networks, you must add more routes to the routing table. Building a Static Routing Table As we have seen, the minimal routing table works to reach hosts only on the directly connected physical networks. To reach remote hosts, routes through external gate- ways must be added to the routing table. One way to do this is by constructing a static routing table with route commands. Use the Unix route command to add or delete entries manually in the routing table. For example, to add the route to a Solaris system’s routing table, enter: route add 1 add net gateway crab The first argument after the route command in this sample is the keyword add. The first keyword on a route command line is either add or delete, telling route either to add a new route or delete an existing one. There is no default; if neither keyword is used, route displays the routing table. The next value is the destination address, which is the address reached via this route. The destination address can be specified as an IP address, a network name from the /etc/networks file, a hostname from the /etc/hosts file, or the keyword default. Because most routes are added early in the startup process, numeric IP addresses are used more than names. This is done so that the routing configuration is not dependent on the state of the name server software. Always use the complete numeric address (all four bytes). route expands the address if it contains fewer than four bytes, and the expanded address may not be what you intended. If the keyword default is used for the destination address, route creates a default † route. The default route is used whenever there is no specific route to a destination, Some implementations of route expand “26” to, even though “26” could mean Milnet ( † The network address associated with the default route is Building a Static Routing Table 173 This is the Title of the Book, eMatter Edition Copyright © 2010 O’Reilly & Associates, Inc. All rights reserved.and it is often the only route you need. If your network has only one gateway, use a default route to direct all traffic bound for remote networks through that gateway. Next on the route command line is the gateway address. This is the IP address of the external gateway through which data is sent to the destination address. The address must be the address of a gateway on a directly connected network. TCP/IP routes specify the next hop in the path to a remote destination. That next hop must be directly accessible to the local host; therefore, it must be on a directly connected net- work. The last argument on the command line is the routing metric. The metric argument is not used when routes are deleted, but some older systems require it when a route is added; for Solaris 8, the metric is optional. Systems that require a metric value for the route command use it only to decide if this is a route through a directly attached interface or a route through an external gateway. If the metric is 0, the route is installed as a route through a local interface, and the G flag, which we saw in the netstat -i display, is not set. If the metric value is greater than 0, the route is installed with the G flag set, and the gateway address is assumed to be the address of an external gateway. Static routing makes no real use of the metric. Dynamic routing is required to make real use of varying metric values. Adding Static Routes As an example, let’s configure static routing on the imaginary workstation rodent. Figure 7-1 shows the subnet There are two gateways on this subnet, crab and horseshoe. crab is the gateway to thousands of networks on the Internet; horseshoe provides access to the other subnets on books-net. We’ll use crab as our default gateway because it is used by thousands of routes. The smaller number of routes through horseshoe can easily be entered individually. The number of routes through a gateway, not the amount of traffic it handles, decides which gateway to select as the default. Even if most of rodent’s network traffic goes through horseshoe to other hosts on books-net, the default gateway should be crab. To install the default route on rodent, we enter: route add default gw The destination is default, and the gateway address ( is crab’s address. Now crab is rodent’s default gateway. Notice that the command syntax is slightly dif- ferent from the Solaris route example shown earlier. rodent is a Linux system. Most values on the Linux route command line are preceded by keywords. In this case, the gateway address is preceded by the keyword gw. Linux precedes the values on the route command line with keywords; e.g., route add -net netmask gw Check your system’s documentation for the details. 174 Chapter 7: Configuring Routing This is the Title of the Book, eMatter Edition Copyright © 2010 O’Reilly & Associates, Inc. All rights reserved.gateway: horseshoe other local subnets Subnet host: rodent gateway: crab Internet Figure 7-1. Routing on a subnet After installing the default route, examine the routing table to make sure the route has been added: route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface U 0 0 0 eth0 U 0 0 0 lo UG 0 0 0 eth0 Try ping again to see whether rodent can now communicate with remote hosts. If † we’re lucky, the remote host responds and we see: % ping PING 56 data bytes 64 bytes from ( icmp_seq=0. time=110. ms 64 bytes from ( icmp_seq=1. time=100. ms C PING Statistics 2 packets transmitted, 2 packets received, 0% packet loss round-trip (ms) min/avg/max = 100/105/110 This display indicates successful communication with the remote host, which means that we now have a good route to hosts on the Internet. Solaris always uses netstat to examine the routing table. Linux can use either netstat or route, but route is more common. † It is possible that the remote host is down. If it is, ping receives no answer. Don’t give up; try another host. Building a Static Routing Table 175 This is the Title of the Book, eMatter Edition Copyright © 2010 O’Reilly & Associates, Inc. All rights reserved.However, we still haven’t installed routes to the rest of books-net.Ifwe ping a host on another subnet, something interesting happens: % ping PING 56 data bytes ICMP Host redirect from gateway ( to ( for ( 64 bytes from ( icmp_seq=1. time=30. ms C PING Statistics 1 packets transmitted, 1 packets received, 0% packet loss round-trip (ms) min/avg/ max = 30/30/30 rodent believes that all destinations are reachable through its default route. There- fore, even data destined for the other subnets is sent to crab.If rodent sends data to crab that should go through horseshoe, crab sends an ICMP Redirect to rodent tell- ing it to use horseshoe. (See Chapter 1 for a description of the ICMP Redirect Mes- sage.) ping shows the ICMP Redirect in action. The redirect has a direct effect on the routing table: route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface U 0 0 0 eth0 U 0 0 0 lo UG 0 0 0 eth0 UGHD 0 0 514 eth0 The route with the D flag set was installed by the ICMP Redirect. Some network managers take advantage of ICMP Redirects when designing a net- work. All hosts are configured with a default route, even those on networks with more than one gateway. The gateways exchange routing information through rout- ing protocols and redirect hosts to the best gateway for a specific route. This type of routing, which is dependent on ICMP Redirects, became popular because of per- sonal computers (PCs). Many PCs cannot run a routing protocol; some early models did not have a route command and were limited to a single default route. ICMP Redirects were one way to support these clients. Also, this type of routing is simple to configure and well suited for implementation through a configuration server, as the same default route is used on every host. For these reasons, some network man- agers encourage repeated ICMP Redirects. Other network administrators prefer to avoid ICMP Redirects and to maintain direct control over the contents of the routing table. To avoid redirects, specific routes can be installed for each subnet using individual route statements: route add –net netmask gw route add –net netmask gw route add –net netmask gw route add –net netmask gw 176 Chapter 7: Configuring Routing This is the Title of the Book, eMatter Edition Copyright © 2010 O’Reilly & Associates, Inc. All rights reserved. Download from Wow eBook www.wowebook.comrodent is directly connected only to, so all gateways in its routing table have addresses that begin with 172.16.12. The finished routing table is shown below: route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface UG 0 0 0 eth0 UG 0 0 0 eth0 U 0 0 0 eth0 UG 0 0 0 eth0 UG 0 0 0 eth0 U 0 0 0 lo UG 0 0 0 eth0 UGHD 0 0 514 eth0 The routing table we have constructed uses the default route (through crab) to reach external networks, and specific routes (through horseshoe) to reach other subnets within books-net. Rerunning the ping tests produces consistently successful results. However, if any subnets are added to the network, the routes to these new subnets must be manually added to the routing table. Additionally, if the system is rebooted, all static routing table entries are lost. Therefore, to use static routing, you must ensure that the routes are re-installed each time your system boots. Installing static routes at startup If you decide to use static routing, you need to make two modifications to your startup files: 1. Add the desired route statements to a startup file. 2. Remove any statements from the startup file that run a routing protocol. To add static routing to a startup script, you must first select an appropriate script. On BSD and Linux systems, the script rc.local is set aside for local modifications to the boot process. rc.local runs at the end of the boot process so it is a good place to put in changes that will modify the default boot process. On our sample Red Hat Linux system, the full path of the rc.local file is /etc/rc.d/rc.local. On a Solaris system, edit /etc/init.d/inetinit to add the route statements: route -n add default /dev/console route -n add /dev/console route -n add /dev/console route -n add /dev/console route -n add /dev/console The -n option tells route to display numeric addresses in its informational messages. When you add route commands to a Solaris startup file, use the -n option to prevent route from wasting time querying name server software that may not be running. The -n option is not required on a Linux system because Linux does not display informational messages when installing a route. Building a Static Routing Table 177 This is the Title of the Book, eMatter Edition Copyright © 2010 O’Reilly & Associates, Inc. All rights reserved.After adding the route commands, check whether the script starts a routing proto- col. If it does, comment out the lines that start it. You don’t want a routing protocol running when you are using static routing. On our Solaris sample system, the rout- ing software is started only if the system has more than one network interface (i.e., is a router) or the /etc/gateways file has been created. (More on this file later.) Neither of these things is true; therefore, the routing daemon won’t be run by the startup process and we don’t have to do anything except add the route statements. Before making changes to your real system, check your system’s documentation. You may need to modify a different boot script, and the execution path of the routing daemon may be different. Only the documentation can provide the exact details you need. Although the startup filename may be different on your system, the procedure should be basically the same. These simple steps are all you need to set up static routing. The problem with static routing is not setting it up, but maintaining it if you have a changeable networking environment. Routing protocols are flexible enough to han- dle simple and complex routing environments. That is why some startup procedures run routing protocols by default. However, most Unix systems need only a static default route. Routing protocols are usually needed only by routers. Interior Routing Protocols Routing protocols are divided into two general groups: interior and exterior proto- cols. An interior protocol is a routing protocol used inside—interior to—an indepen- dent network system. In TCP/IP terminology, these independent network systems are called autonomous systems. Within an autonomous system (AS), routing infor- mation is exchanged using an interior protocol chosen by the autonomous system’s administration. All interior routing protocols perform the same basic functions. They determine the “best” route to each destination and distribute routing information among the sys- tems on a network. How they perform these functions (in particular, how they decide which routes are best) is what makes routing protocols different from each other. There are several interior protocols: • The Routing Information Protocol (RIP) is the interior protocol most commonly used on Unix systems. RIP is included as part of the Unix software delivered with most systems. It is adequate for local area networks and is simple to configure. RIP selects the route with the lowest “hop count” (metric) as the best route. The RIP hop count represents the number of gateways through which data must pass to reach its destination. RIP assumes the best route is the one that uses the few- est gateways. This approach to route choice is called a distance-vector algorithm. Autonomous systems are described in Chapter 2. 178 Chapter 7: Configuring Routing This is the Title of the Book, eMatter Edition Copyright © 2010 O’Reilly & Associates, Inc. All rights reserved.• Hello is a protocol that uses delay as the deciding factor when choosing the best route. Delay is the length of time it takes a datagram to make the round trip between its source and destination. A Hello packet contains a timestamp indicat- ing when it was sent. When the packet arrives at its destination, the receiving system subtracts the timestamp from the current time to estimate how long it took the packet to arrive. Hello is not widely used. It was the interior protocol of the original 56 Kbps NSFNET backbone and has had very little use otherwise. • Intermediate System to Intermediate System (IS-IS) is an interior routing protocol from the OSI protocol suite. It is a Shortest Path First (SPF) link-state protocol. It was the interior routing protocol used on the T1 NSFNET backbone, and it is still used by some large service providers. • Open Shortest Path First (OSPF) is another link-state protocol developed for TCP/IP. It is suitable for very large networks and provides several advantages over RIP. Of these protocols, we will discuss RIP and OSPF in detail. OSPF is widely used on routers. RIP is widely used on Unix systems. We will start the discussion with RIP. Routing Information Protocol As delivered with many Unix systems, Routing Information Protocol (RIP) is run by the routing daemon routed (pronounced “route” “d”). When routed starts, it issues a request for routing updates and then listens for responses to its request. When a sys- tem configured to supply RIP information hears the request, it responds with an update packet based on the information in its routing table. The update packet con- tains the destination addresses from the routing table and the routing metric associ- ated with each destination. Update packets are issued in response to requests as well as periodically to keep routing information accurate. To build the routing table, routed uses the information in the update packets. If the routing update contains a route to a destination that does not exist in the local rout- ing table, the new route is added. If the update describes a route whose destination is already in the local table, the new route is used only if it is a better route. As noted previously, RIP considers a route with a lower “hop count” to be a better route. In RIP terminology, the hop count is called the cost of the route or the routing metric. We saw earlier that the routing metric in the local routing table can be manually con- trolled using the metric argument of the route command. To select the best route, RIP must first determine the cost of the route. The cost of a route is determined by adding the cost of reaching the gateway that sent the update to the metric contained in the RIP update packet. If the total cost is less than the cost of the current route, the new route is used. RIP also deletes routes from the routing table. It accomplishes this in two ways. First, if the gateway to a destination says the cost of the route is greater than 15, the route is deleted. Second, RIP assumes that a gateway that doesn’t send updates is dead. All Interior Routing Protocols 179 This is the Title of the Book, eMatter Edition Copyright © 2010 O’Reilly & Associates, Inc. All rights reserved.routes through a gateway are deleted if no updates are received from that gateway for a specified time period. In general, RIP issues routing updates every 30 seconds. In many implementations, if a gateway does not issue routing updates for 180 seconds, all routes through that gateway are deleted from the routing table. Running RIP with routed To run RIP using the routing daemon (routed), enter the following command: routed The routed statement is often used without any command-line arguments, but you may want to use the -q option. The -q option prevents routed from advertising routes. It just listens to the routes advertised by other systems. If your computer is not a gateway, you should probably use the -q option. In the section on static routing, we did not need to comment out the routed state- ment found in the inetinit startup file because Solaris runs routed only if the system has two network interfaces or if the /etc/gateways file is found. If your Unix system starts routed unconditionally, no action is required to run RIP; just boot your system and RIP will run. Otherwise, you need to make sure the routed command is in your startup and the conditions required by your system are met. The easiest way to get Solaris to run routed is to create a gateways file—even an empty one will do. routed reads /etc/gateways at startup and adds its information to the routing table. routed can build a functioning routing table simply by using the RIP updates received from the RIP suppliers. However, it is sometimes useful to supplement this information with, for example, an initial default route or information about a gate- way that does not announce its routes. The /etc/gateways file stores this additional routing information. The most common use of the /etc/gateways file is to define an active default route, so we’ll use that as an example. This one example is sufficient because all entries in the /etc/gateways file have the same basic format. The following entry specifies crab as the default gateway: net gateway metric 1 active The entry starts with the keyword net. All entries start with either the keyword net or the keyword host to indicate whether the address that follows is a network address or a host address. The destination address is the address used for the default route. In the route command we used the keyword default to indicate this route, but in /etc/gateways the default route is indicated by network address Next is the keyword gateway followed by the gateway’s IP address. In this case it is the address of crab ( On some systems the routing daemon is in.routed. 180 Chapter 7: Configuring Routing This is the Title of the Book, eMatter Edition Copyright © 2010 O’Reilly & Associates, Inc. All rights reserved.Then comes the keyword metric followed by a numeric metric value. The metric is the cost of the route. The metric was almost meaningless when used with static rout- ing, but now that we are running RIP, the metric is used to make routing decisions. The RIP metric represents the number of gateways through which data must pass to reach its final destination. But as we saw with ifconfig, the metric is really an arbi- trary value used by the administrator to prefer one route over another. (The system administrator is free to assign any metric value.) However, it is useful to vary the metric only if you have more than one route to the same destination. With only one gateway to the Internet, the correct metric to use for crab is 1. All /etc/gateways entries end with either the keyword passive or the keyword active. “Passive” means the gateway listed in the entry is not required to provide RIP updates. Use passive to prevent RIP from deleting the route if no updates are expected from the gateway. A passive route is placed in the routing table and kept there as long as the system is up. In effect, it becomes a permanent static route. The keyword active, on the other hand, creates a route that can be updated by RIP. An active gateway is expected to supply routing information and will be removed from the routing table if, over a period of time, it does not provide routing updates. Active routes are used to “prime the pump” during the RIP startup phase, with the expectation that the routes will be updated by RIP when the protocol is up and run- ning. Our sample entry ends with the keyword active, which means that this default route will be deleted if no routing updates are received from crab. Default routes are conve- nient; this is especially true when you use static routing. But when you use dynamic routing, default routes should be used with caution, especially if you have multiple gateways that can reach the same destination. A passive default route prevents the routing protocol from dynamically updating the route to reflect changing network conditions. Use an active default route that can be updated by the routing protocol. RIP is easy to implement and simple to configure. Perfect Well, not quite. RIP has three serious shortcomings: Limited network diameter The longest RIP route is 15 hops. A RIP router cannot maintain a complete rout- ing table for a network that has destinations more than 15 hops away. The hop count cannot be increased because of the second shortcoming. Slow convergence Deleting a bad route sometimes requires the exchange of multiple routing update packets until the route’s cost reaches 16. This is called “counting to infin- ity” because RIP keeps incrementing the route’s cost until it becomes greater than the largest valid RIP metric. (In this case, 16 is infinity.) Additionally, RIP may wait 180 seconds before deleting the invalid routes. In network-speak, we say that these conditions delay the “convergence of routing,” i.e., it takes a long time for the routing table to reflect the current state of the network. Interior Routing Protocols 181 This is the Title of the Book, eMatter Edition Copyright © 2010 O’Reilly & Associates, Inc. All rights reserved.Classful routing RIP interprets all addresses using the class rules described in Chapter 2. For RIP, all addresses are class A, B, or C, which makes RIP incompatible with the cur- rent practice of interpreting an address based on the address bit mask. Nothing can be done to change the limited network diameter. A small metric is essential to reduce the impact of counting to infinity. However, limited network size is the least important of RIP’s shortcomings. The real work of improving RIP concen- trates on the other two problems, slow convergence and classful routing. Features have been added to RIP to address slow convergence. Before discussing them we must understand how the “counting-to-infinity” problem occurs. Figure 7-2 illustrates a network where a counting-to-infinity problem might happen. Subnet 3 Subnet 25 Subnet 36 ora aulds smith Subnet PPP links 1 horseshoe crab Subnet 12 Figure 7-2. Sample network Figure 7-2 shows that crab reaches subnet 3 through horseshoe and then through ora. Subnet 3 is two hops away from crab and one hop away from horseshoe. Therefore horseshoe advertises a cost of 1 for subnet 3 and crab advertises a cost of 2, and traffic continues to be routed through horseshoe. That is, until something goes wrong. If ora crashes, horseshoe waits for an update from ora for 180 seconds. While waiting, horseshoe continues to send updates to crab that keep the route to subnet 3 in crab’s routing table. When horseshoe’s timer finally expires, it removes all routes through ora from its routing table, including the route to subnet 3. It then receives an update from crab advertising that crab is two hops away from subnet 3. horseshoe installs this route and announces that it is three hops away from subnet 3. crab receives this update, installs the route, and announces that it is four hops away from subnet 3. Things continue on in this manner until the cost of the route to subnet 3 reaches 16 in both routing tables. If the update interval is 30 seconds, this could take a long time 182 Chapter 7: Configuring Routing This is the Title of the Book, eMatter Edition Copyright © 2010 O’Reilly & Associates, Inc. All rights reserved.Split horizon and poison reverse are two features that attempt to avoid counting to infinity. Here’s how: Split horizon With this feature, a router does not advertise routes on the link from which those routes were obtained. This would solve the count-to-infinity problem described above. Using the split horizon rule, crab would not announce the route to subnet 3 on subnet 12 because it learned that route from the updates it received from horseshoe on subnet 12. While this feature works for the previous example described, it does not work for all count-to-infinity configurations. (More on this later.) Poison reverse This feature is an enhancement of split horizon. It uses the same idea: “Don’t advertise routes on the link from which those routes were obtained.” But it adds a positive action to that essentially negative rule. Poison reverse says that a router should advertise an infinite distance for routes on this link. With poison reverse, crab would advertise subnet 3 with a cost of 16 to all systems on subnet 12. The cost of 16 means that subnet 3 cannot be reached through crab. Split horizon and poison reverse solve the problem described above. But what hap- pens if crab crashes? Refer to Figure 7-2. With split horizon, aulds and smith do not advertise to crab the route to subnet 12 because they learned the route from crab. They do, however, advertise the route to subnet 12 to each other. When crab goes down, aulds and smith perform their own count to infinity before they remove the route to subnet 12. Triggered updates address this problem. Triggered updates are a big improvement. Instead of waiting the normal 30-second update interval, a triggered update is sent immediately. Therefore, when an upstream router crashes or a local link goes down, the router sends the changes to its neigh- bors immediately after it updates its local routing table. Without triggered updates, counting to infinity can take almost eight minutes With triggered updates, neigh- bors are informed in a few seconds. Triggered updates also use network bandwidth efficiently. They don’t include the full routing table; they include only the routes that have changed. Triggered updates take positive action to eliminate bad routes. Using triggered updates, a router advertises the routes deleted from its routing table with an infinite cost to force downstream routers to also remove them. Again, look at Figure 7-2. If crab crashes, smith and aulds wait 180 seconds and remove the routes to subnets 1, 3, and 12 from their routing tables. They then send each other triggered updates with a metric of 16 for subnets 1, 3, and 12. Thus they tell each other that they cannot reach these networks and no count to infinity occurs. Split horizon, poison reverse, and triggered updates go a long way toward eliminating counting to infinity. It is the final shortcoming—the fact that RIP is incompatible with CIDR supernets and variable-length subnets—that caused the RIP protocol to be moved to “historical” Interior Routing Protocols 183 This is the Title of the Book, eMatter Edition Copyright © 2010 O’Reilly & Associates, Inc. All rights reserved.status in 1996. RIP is not compatible with current and future plans for the TCP/IP protocol stack. A new version of RIP had to be created to address this final problem. RIP Version 2 RIP version 2 (RIP-2), defined in RFC 2453, is a new version of RIP. It is not a com- pletely new protocol; it simply defines extensions to the RIP packet format. RIP-2 adds a network mask and a next-hop address to the destination address and metric found in the original RIP packet. The network mask frees the RIP-2 router from the limitation of interpreting addresses based on outdated address class rules. The mask is applied to the destina- tion address to determine how the address should be interpreted. Using the mask, RIP-2 routers support variable-length subnets and CIDR supernets. The next-hop address is the IP address of the gateway that handles the route. If the address is, the source of the update packet is the gateway for the route. The next-hop route permits a RIP-2 supplier to provide routing information about gate- ways that do not speak RIP-2. Its function is similar to an ICMP Redirect, pointing to the best gateway for a route and eliminating extra routing hops. RIP-2 adds other new features to RIP. It transmits updates via the multicast address to reduce the load on systems that are not capable of processing a RIP-2 packet. RIP-2 also introduces a packet authentication scheme to reduce the possibil- ity of accepting erroneous updates from misconfigured systems. Despite these changes, RIP-2 is compatible with RIP. The original RIP specification allowed for future versions of RIP. RIP has a version number in the packet header, and several empty fields for extending the packet. The new values used by RIP-2 did not require any changes to the structure of the packet. The new values are simply placed in the empty fields that the original protocol reserved for future use. Properly implemented RIP routers can receive RIP-2 packets and extract the data that they need from the packet without becoming confused by the new data. Split horizon, poison reverse, triggered updates, and RIP-2 eliminate most of the problems with the original RIP protocol. But RIP-2 is still a distance-vector protocol. There are other, newer routing technologies that are considered superior for large networks. In particular, link-state routing protocols are favored because they provide rapid routing convergence and reduce the possibility of routing loops. Open Shortest Path First Open Shortest Path First (OSPF), defined by RFC 2328, is a link-state protocol. As such, it is very different from RIP. A router running RIP shares information about the entire network with its neighbors. Conversely, a router running OSPF shares infor- mation about its neighbors with the entire network. The “entire network” means, at 184 Chapter 7: Configuring Routing This is the Title of the Book, eMatter Edition Copyright © 2010 O’Reilly & Associates, Inc. All rights reserved.most, a single autonomous system. RIP doesn’t try to learn about the entire Internet, and OSPF doesn’t try to advertise to the entire Internet. That’s not their job. These are interior routing protocols, so their job is to construct the routing inside an auton- omous system. OSPF further refines this task by defining a hierarchy of routing areas within an autonomous system: Areas An area is an arbitrary collection of interconnected networks, hosts, and rout- ers. Areas exchange routing information with other areas within the autono- mous system through area border routers. Backbone A backbone is a special area that interconnects all of the other areas within an autonomous system. Every area must connect to the backbone because the back- bone is responsible for distributing routing information between the areas. Stub area A stubarea has only one area border router, which means that there is only one route out of the area. In this case, the area border router does not need to adver- tise external routes to the other routers within the stub area. It can simply adver- tise itself as the default route. Only a large autonomous system needs to be subdivided into areas. The sample net- work shown in Figure 7-2 is small and would not need to be divided. We can, how- ever, use it to illustrate the different areas. We could divide this autonomous system into any areas we wish. Assume we divide it into three areas: area 1 contains subnet 3; area 2 contains subnet 1 and subnet 12; and area 3 contains subnet 25, subnet 36, and the PPP links. Furthermore, we could define area 1 as a stub area because ora is that area’s only area border router. We also could define area 2 as the backbone area because it interconnects the other two areas and all routing information between areas 1 and 3 must be distributed by area 2. Area 2 contains two area border routers, crab and ora, and one interior router, horseshoe. Area 3 contains three routers: crab, smith, and aulds. Clearly OSPF provides lots of flexibility for subdividing an autonomous system. But why is it necessary? One problem for a link-state protocol is the large quantity of data that can be collected in the link-state database and the amount of time it can take to calculate the routes from that data. A look at the protocol shows why this is true. Every OSPF router builds a directed graph of the entire network using the Dijkstra Shortest Path First (SPF) algorithm. A directed graph is a map of the network from the perspective of the router; that is, the root of the graph is the router. The graph is built from the link-state database, which includes information about every router on the network and all the neighbors of every router. The link-state database for the autonomous system in Figure 7-2 contains 5 routers and 10 neighbors: ora has 1 neighbor, horseshoe; horseshoe has 2 neighbors, ora and crab; crab has 3 neighbors, Interior Routing Protocols 185 This is the Title of the Book, eMatter Edition Copyright © 2010 O’Reilly & Associates, Inc. All rights reserved.horseshoe, aulds, and smith; aulds has 2 neighbors, crab and smith; and smith has 2 neighbors, aulds and crab. Figure 7-3 shows the graph of this autonomous system from the perspective of ora. ora (0) 5 horseshoe (5) 10 crab (15) 20 20 smith aulds (35) (35) smith aulds (55) (55) Figure 7-3. A network graph The Dijkstra algorithm builds the map in this manner: 1. Install the local system as the root of the map with a cost of 0. 2. Locate the neighbors of the system just installed and add them to the map. The cost of reaching the neighbors is calculated as the sum of the cost of reaching the system just installed plus the cost it advertises for reaching each neighbor. For example, assume that crab advertises a cost of 20 for aulds and that the cost of reaching crab is 15. Then the cost for aulds in ora’s map is 35. 3. Walk through the map and select the lowest-cost path for each destination. For example, when aulds is added to the map, its neighbors include smith. The path to smith through aulds is temporarily added to the map. In this third phase of the algorithm, the cost of reaching smith through crab is compared to the cost of reaching it through aulds. The lowest-cost path is selected. Figure 7-3 shows the deleted paths in dotted lines. Steps 2 and 3 of the algorithm are repeated for every system in the link-state database. The information in the link-state database is gathered and distributed in a simple and efficient manner. An OSPF router discovers its neighbors through the use of Hello 186 Chapter 7: Configuring Routing This is the Title of the Book, eMatter Edition Copyright © 2010 O’Reilly & Associates, Inc. All rights reserved. packets. It sends Hello packets and listens for Hello packets from adjacent routers. The Hello packet identifies the local router and lists the adjacent routers from which it has received packets. When a router receives a Hello packet that lists it as an adja- cent router, it knows it has found a neighbor. It knows this because it can hear pack- ets from that neighbor and, because the neighbor lists it as an adjacent router, the neighbor must be able to hear packets from it. The newly discovered neighbor is added to the local system’s neighbor list. The OSPF router then advertises all of its neighbors. It does this by flooding a Link- State Advertisement (LSA) to the entire network. The LSA contains the address of every neighbor and the cost of reaching that neighbor from the local system. Flood- ing means that the router sends the LSA out of every interface and that every router that receives the LSA sends it out of every interface except the one from which it was received. To avoid flooding duplicate LSAs, the routers store a copy of the LSAs they receive and discard duplicates. Figure 7-2 provides an example. When OSPF starts on horseshoe it sends a Hello packet on subnet 1 and one on subnet 12. ora and crab hear the Hello and respond with Hello packets that list horseshoe as an adjacent router. horseshoe hears their Hello packets and adds them to its neighbor list. horseshoe then creates an LSA that lists ora and crab as neighbors with appropriate costs assigned to each. For instance, horseshoe might assign a cost of 5 to ora and a cost of 10 to crab. horseshoe then floods the LSA on subnet 1 and subnet 12. ora hears the LSA and floods it on subnet 3. crab receives the LSA and floods it on both of its PPP links. aulds floods the LSA on the link toward smith, and smith floods it on the same link to aulds. When aulds and smith received the second copy of the LSA, they discarded it because it dupli- cated one that they had already received from crab. In this manner, every router in the entire network receives every other router’s link-state advertisement. OSPF routers track the state of their neighbors by listening for Hello packets. Hello packets are issued by all routers on a periodic basis. When a router stops issuing packets, it or the link it is attached to is assumed to be down. Its neighbors update their LSA and flood them through the network. The new LSAs are included into the link-state database on every router on the network, and every router recalculates its network map based on this new information. Clearly, limiting the number of routers by limiting the size of the network reduces the burden of recalculating the map. For many networks, the entire autonomous system is small enough. For others, dividing the autonomous system into areas improves efficiency. Another feature of OSPF that improves efficiency is the designated router. The desig- nated router is one router on the network that treats all other routers on the network as its neighbors, while all other routers treat only the designated router as their neighbor. This helps reduce the size of the link-state database and thus improves the Don’t confuse Hello packets with the Hello protocol. These are OSPF Hello packets. Interior Routing Protocols 187 This is the Title of the Book, eMatter Edition Copyright © 2010 O’Reilly & Associates, Inc. All rights reserved.speed of the Shortest-Path-First calculation. Imagine a broadcast network with 5 routers. Five routers each with 4 neighbors produce a link-state database with 20 entries. But if one of those routers is the designated router, then that router has 4 neighbors and all other routers have only 1 neighbor, for a total of 10 link-state data- base entries. While there is no need for a designated router on such a small network, the larger the network, the more dramatic the gains. For example, a broadcast net- work with 25 routers has a link-state database of 50 entries when a designated router is used, versus a database of 600 entries without one. OSPF provides the router with an end-to-end view of the route between two systems instead of the limited next-hop view provided by RIP. Flooding quickly disseminates routing information throughout the network. Limiting the size of the link-state data- base through areas and designated routers speeds the SPF calculation. Taken alto- gether, OSPF is an efficient link-state routing protocol. OSPF also offers additional features that RIP doesn’t. It provides simple password authentication to ensure that the update comes from a valid router using an eight- character, clear-text password. It provides Message Digest 5 (MD5) crypto-check- sum for stronger authentication. OSPF also supports equal-cost multi-path routing. This mouthful means that OSPF routers can maintain more than one path to a single destination. Given the proper conditions, this feature can be used for load balancing across multiple network links. However, many systems are not designed to take advantage of this feature. Refer to your router’s documentation to see if it supports load balancing across equal-cost OSPF routes. With all of these features, OSPF is the preferred TCP/IP interior routing protocol for dedicated routers. Exterior Routing Protocols Exterior routing protocols are used to exchange routing information between auton- omous systems. The routing information passed between autonomous systems is called reachability information. Reachability information is simply information about which networks can be reached through a specific autonomous system. RFC 1771 defines Border Gateway Protocol (BGP), the leading exterior routing pro- tocol, and provides the following description of the routing function of an autono- mous system: The classic definition of an Autonomous System is a set of routers under a single tech- nical administration, using an interior gateway protocol and common metrics to route packets within the AS, and using an exterior gateway protocol to route packets to other ASs.... The administration of an AS appears to other ASs to have a single coher- ent interior routing plan and presents a consistent picture of what networks are reach- able through it. From the standpoint of exterior routing, an AScan be viewed as monolithic... 188 Chapter 7: Configuring Routing This is the Title of the Book, eMatter Edition Copyright © 2010 O’Reilly & Associates, Inc. All rights reserved.Moving routing information into and out of these monoliths is the function of exte- rior routing protocols. Exterior routing protocols are also called exterior gateway protocols. Don’t confuse an exterior gateway protocol with the Exterior Gateway Protocol (EGP). EGP is not a generic term; it is a particular exterior routing proto- col, and an old one at that. Exterior Gateway Protocol A gateway running EGP announces that it can reach networks that are part of its autonomous system. It does not announce that it can reach networks outside its autonomous system. For example, the exterior gateway for our imaginary autono- mous system book-as can reach the entire Internet through its external connection, but only one network is contained in its autonomous system. Therefore, it would announce only one network ( if it ran EGP. Before sending routing information, the systems exchange EGP Hello and I-Heard-You (I-H-U) messages. These messages establish a dialogue between two EGP gateways. Computers communicating via EGP are called EGP neighbors, and the exchange of Hello and I-H-U messages is called acquiring a neighbor. Once a neighbor is acquired, routing information is requested via a poll. The neigh- bor responds by sending a packet of reachability information called an update. The local system includes the routes from the update into its local routing table. If the neighbor fails to respond to three consecutive polls, the system assumes that the neighbor is down and removes the neighbor’s routes from its table. If the system receives a poll from its EGP neighbor, it responds with its own update packet. Unlike the interior protocols discussed above, EGP does not attempt to choose the “best” route. EGP updates contain distance-vector information, but EGP does not evaluate this information. The routing metrics from different autonomous systems are not directly comparable. Each ASmay use different criteria for developing these values. Therefore, EGP leaves the choice of a “best” route to someone else. When EGP was designed, the network relied upon a group of trusted core gateways to process and distribute the routes received from all of the autonomous systems. These core gateways were expected to have the information necessary to choose the best external routes. EGP reachability information was passed into the core gate- ways, where the information was combined and passed back out to the autonomous systems. A routing structure that depends on a centrally controlled group of gateways does not scale well and is therefore inadequate for the rapidly growing Internet. As the number of autonomous systems and networks connected to the Internet grew, it became diffi- cult for the core gateways to keep up with the expanding workload. This is one rea- son why the Internet moved to a more distributed architecture that places a share of the burden of processing routes on each autonomous system. Another reason is that Exterior Routing Protocols 189 This is the Title of the Book, eMatter Edition Copyright © 2010 O’Reilly & Associates, Inc. All rights reserved.

Advise: Why You Wasting Money in Costly SEO Tools, Use World's Best Free SEO Tool Ubersuggest.