# Routing 101: Routing Algorithms

1. Routing Algorithms Within Routing Protocols
2. Summary
3. Q&amp;A
Improve the performance of your network by implementing the best routing protocols. Learn how routing algorithms work for a better understanding of routing protocols and the concepts behind why some protocols work better in certain situations.
This chapter is from the book

## Introduction

Hour 3 will focus primarily on routing algorithms. The routing algorithm is a formula that is stored in the router's memory. The routing algorithm your protocol uses is a major factor in the performance of your routing environment. The purpose of the routing algorithm is to make decisions for the router concerning the best paths for data.

Think of the routing algorithm as the traffic officer of the router. In the same way that traffic officers guide and shape the way cars drive through busy intersections, routing algorithms make decisions concerning the path data will take from one network to another.

The router uses the routing algorithm to compute the path that would best serve to transport the data from the source to the destination. However, you cannot directly choose the algorithm that your router uses. Rather, the routing protocol you choose for your network determines which algorithm you will use. For example, whereas the routing protocol RIP may use one type of routing algorithm to help the router move data, the routing protocol OSPF uses another.

You are learning about routing algorithms in this lesson as a prerequisite to future lessons on routing protocols. Knowing how routing algorithms work will give you a better understanding of routing protocols and the concepts behind why some protocols work better in certain situations. Many of the differences between particular routing protocols are directly related to differences in their routing algorithms.

The routing algorithm a protocol uses cannot be changed or altered. If the algorithm a particular protocol uses does not favor your networking environment, the only way to change it is to change routing protocols.

Because the routing algorithm has so much impact on the overall performance of your network, you should research the algorithms each protocol uses before deciding which to implement on your network.

There are two major categories of routing algorithms that can be used by routing protocols—distance vector or link-state. When we begin to discuss routing protocols, you will find that the protocols are either distance vector or link-state. This convention is a direct result of the type of routing algorithm used by the protocol. Therefore, every routing protocol labeled "distance vector" uses the distance vector algorithm; conversely, every link-state protocol uses the link-state algorithm.

Note

The particulars of your network, such as the number of computers, the number of routers, and the existence (or lack) of a WAN will determine which type of algorithm you choose for your environment.

The next section will briefly discuss the relationship formed between routing protocols and their algorithms. Routing protocols provide information to routing algorithms in the form of variables or metrics. Routing algorithms, on the other hand, provide routing protocols with the best path for the router to send data.

## Routing Algorithms Within Routing Protocols

Many properties separate routing protocols from each other. Characteristics such as the speed with which they operate, the way they conduct updates, and the information they gather to perform their job make routing protocols unique. However, one feature that routing protocols share with one another is their routing algorithm. While many different routing protocols are available for you to use on your network, they all utilize one of only two different algorithms.

The major job of the routing protocol is to provide the information needed by the routing algorithm to compute its decisions. This is where many protocols differ. The information provided to the algorithm (thereby affecting the calculation) can be different from protocol to protocol. A good way to illustrate this is to think of the routing algorithm as an Internet search engine, and you as the routing protocol. Let's say that you want the best place to get information about Cisco routers. You type the word "routers" into the search engine. The search engine processes your input and returns a myriad of results. Eventually you will reach the Cisco home page.

Using the same search engine, you could have entered the keywords "Cisco routers." This search would have produced a more direct result. Although the search engine (routing algorithm) did not change, the product of the formula was directly affected by the information that was given to it. Whereas some routing protocols will supply general information to an algorithm, others will be more specific. Knowing how the algorithm will react in these situations will help you choose the algorithm (and consequently, the protocol) that is best for you.

The routing protocol gathers certain information about networks and routers from the surrounding environment. This information is stored within a routing table in the router's memory. The routing algorithm is run against the information within this table to calculate the "best" path from one network to another.

The information contained within the table is plugged into the routing algorithm. Calculating the new values within the formula then generates a sum. The result of this calculation is used to determine where to send information in a particular scenario. For example, Table 3.1 illustrates a sample routing table for a fictitious routing environment.

Note

The information being passed to the routing algorithm within the routing table is gathered by the routing protocol through a process known as a routing update. A network or routing engineer will assign this information to each router. Then, through a series of updates, each router will tell the other what information it has. Eventually, an entire routing table will be built. You will learn more about how routing updates work as we examine each routing protocol.

#### Table 3.1 A Fictitious Routing Table

 Router Link Metric Router A to Router B 2 Router B to Router C 3 Router A to Router C 6 Router C to Router D 5

Note

This scenario has been simplified to make a discussion of routing algorithms possible without focusing on one particular protocol.

Our sample routing algorithm states that the best path to any destination is the one that has the lowest metric value. When Router A is presented with a packet bound from Router C, the routing table immediately shows two possible paths to choose from. The first choice is to send the packet from Router A directly over the link to Router C. The second option is to send the packet from Router A to Router B and then on to Router C. The routing algorithm is used to determine which option is best. Figure 3.1 illustrates the network that Router A and Router C belong to. (Notice how the routers and metrics in the figure correspond to the routing table information in Table 3.1.)

Figure 3.1 A sample network.

Whereas some routing protocols might only provide one metric to the routing algorithm, others might provide up to ten. As we cover each routing protocol, we will discuss what metrics they gather for the routing algorithm to use. On the other hand, whereas two protocols might both send only one metric to the algorithm, the origin of that metric might differ from protocol to protocol. One routing protocol might give an algorithm the single metric of cost, but that cost could represent something different than another protocol using the same metric.

The algorithm in our example states that the best path is the one with the lowest metric value. Therefore, by adding the metric numbers associated with each possible link, we see that the route from Router A to Router B to Router C has a metric value of 5, while the direct link to Router C has a value of 6. The algorithm selects the A-B-C path and sends the information along.

Note

A metric is a number used as a standard of measurement for the links of a network. Each link is assigned a metric to represent anything from monetary cost to use the line, to the amount of available bandwidth.

Although simplistic, this example demonstrates just how routing algorithms function as the true decision engine within the router. The specific information that is stored within the routing table, and how the algorithm uses it, depends on the protocol. Let's examine the differences between these two algorithmic types.

### Distance Vector Algorithms

Distance vector algorithms are similar to the simple algorithm used in Table 3.1. A distance vector algorithm uses metrics known as costs to help determine the best path to a destination. The path with the lowest total cost is chosen as the best path.

When a router utilizes a distance vector algorithm, different costs are gathered by each router. These costs can be completely arbitrary, administrator-assigned numbers, such as five. Although the number five might not be of any significance to an outside observer, the administrator might have assigned it to a particular link to represent the reliability of that link.

Costs can also be dynamically gathered values, such as the amount of delay experienced by routers when sending packets over one link as opposed to another. All the costs (assigned and otherwise) are compiled and placed within the router's routing table. All the costs gathered are then used by the algorithm to calculate a best path for any given network scenario.

Although there are many resources that will offer complex mathematical representations of what distance vector algorithms are and how they compute their decisions, the core concept remains the same—by adding the metrics for every optional path on a network, you will come up with at least one best path. The formula for this is as follows:

`M(i,k) = min [M(i,t) + M(t,k)]`

This formula states that the best path between two networks (M(i,k)) can be found by finding the lowest (min) value of paths between all network points. Let's look again at the routing information in Table 3.1. Plugging this information into the formula, we see that the route from A to B to C is still the best path:

`5(A,C) = min[2(A,B) + 3(B,C)]`

Whereas the formula for the direct route A to C looks like this:

`6(A,C) = min[6(A,C)]`

This example illustrates how distance vector algorithms use the information passed to them to make informed routing decisions. Do not spend too much time memorizing the algorithm, as you will rarely see it in the real world. The algorithms used by routers and routing protocols are not configurable, nor can they be modified.

Another major difference between distance vector algorithms and link state protocols (covered in the next section) is that when distance vector routing protocols update each other, all or part of the routing table (depending on the type of update) is sent from one router to another. By this process, each router is exposed to the information contained within the other router's tables, thus giving each router a more complete view of the networking environment and enabling them to make better routing decisions. The process of router updates is described in more detail in the next section.

Examples of distance vector algorithms include RIP and BGP, two of the more popular protocols in use today. Other popular protocols such as OSPF are examples of protocols which use the link state routing algorithm.

### Link-State Algorithms

Link-state algorithms work within the same basic framework that distance vector algorithms do in that they both favor the path with the lowest cost. However, link-state protocols work in a somewhat more localized manner. Whereas a router running a distance vector algorithm will compute the end-to-end path for any given packet, a link-state protocol will compute that path as it relates to the most immediate link. That is, where a distance vector algorithm will compute the lowest metric between Network A and Network C, a link-state protocol will compute it as two distinct paths, A to B and B to C.

This process is best for larger environments that might change fairly often. Link-state algorithms enable routers to focus on their own links and interfaces. Any one router on a network will only have direct knowledge of the routers and networks that are directly connected to it (or, the state of its own links). In larger environments, this means that the router will use less processing power to compute complicated paths.

The router simply needs to know which one of its direct interfaces will get the information where it needs to go the quickest. The next router in line will repeat the process until the information reaches its destination.

Another advantage to such localized routing processes is that protocols can maintain smaller routing tables. Because a link-state protocol only maintains routing information for its direct interfaces, the routing table contains much less information than that of a distance vector protocol that might have information for multiple routers.

Like distance vector protocols, link-state protocols require updates to share information with each other. These routing updates, known as Link State Advertisements (LSAs), occur when the state of a router's links changes.

When a particular link becomes unavailable (changes state), the router sends an update through the environment alerting all the routers with which it is directly linked.

Link-state and distance vector protocols handle certain routing situations quite differently. As we discuss each protocol in the remaining lessons of this book, we'll look at how these protocols handle particular routing situations.

### InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

## Overview

Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

## Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

### Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

### Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

### Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

### Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

### Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

### Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

### Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

## Other Collection and Use of Information

### Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

### Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

### Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

### Do Not Track

This site currently does not respond to Do Not Track signals.

## Security

Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

## Children

This site is not directed to children under the age of 13.

## Marketing

Pearson may send or direct marketing communications to users, provided that

• Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
• Such marketing is consistent with applicable law and Pearson's legal obligations.
• Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
• Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

## Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

## Choice/Opt-out

Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

## Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

## Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

## Sharing and Disclosure

Pearson may disclose personal information, as follows:

• As required by law.
• With the consent of the individual (or their parent, if the individual is a minor)
• In response to a subpoena, court order or legal process, to the extent permitted or required by law
• To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
• In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
• To investigate or address actual or suspected fraud or other illegal activities
• To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
• To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
• To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

## Links

This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

## Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

## Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020