Home > Articles > Networking > Routing & Switching

This chapter is from the book

3.7 Basic Forwarding Algorithm

This section provides an overview of the forwarding algorithm performed by the router when it is clear that the packet is not destined for the router itself and should be delivered to a remote network. The algorithm uses the following data structures:

  • Packet: the IP packet being forwarded. Each packet has fields described in Chapter 2. In particular, the forwarding algorithm uses such fields as Destination Address and Time-To-Live (TTL).

  • Interface: the network attachment description. Various characteristics are associated with each interface, including the following, which are considered interesting from the forwarding perspective:

    • Type—Can be point-to-point, point-to-multipoint, or broadcast, depending on the type of encapsulation. For example, PPP and High-Level Data Link Control (HDLC) interfaces are point-to-point; Frame Relay and X.25 interfaces are point-to-multipoint; Ethernet and Token Ring interfaces are broadcast.

    • State—Operational status—up or down—of the interface. The state of the interface is determined by the status of the physical and the data link layer protocols.

    • IP status—Flag specifying whether IP processing is enabled on the interface.

    • IP unnumbered—Flag indicating that the interface—point-to-point—is configured as unnumbered.

    • Reference interface—Interface whose IP address should be used when the packets are generated for the unnumbered interface.

    • IP address—Address assigned to the interface.

    • Address mask—Mask configured together with the IP address to specify the border between the network and hosts parts of the address.

  • Routing table—Collection of routing entries (routes). The following parameters are associated with each entry:

    • Network prefix—IP prefix—in the form of the prefix value and its length, or a network address and a route mask—that describes a collection of destinations. For example, 192.0.0.0/8, or 192.0.0.0 255.0.0.0, describes all IP hosts that are assigned IP addresses starting with 192, such as 192.1.1.1 or 192.200.150.129.

    • Default candidate—Flag indicating that the route should be considered a candidate for becoming the default route

    • Paths—Collection of next-hop structures, each corresponding to a distinct path to the destination through the network. The following parameters are associated with each path, and at least one of the two must be present.

      • Outbound interface—The interface that should be used to forward packets to the collection of destinations described by the route. If the path does not specify the interface, the route is considered recursive.

      • Intermediate address—If the path specifies the interface, this is the next-hop address that should be used to find out the data link layer details. If the path does not specify the interface, this is the address that should be used for the next iteration of the recursive routing table lookup operation.

The following algorithm is an outline of functionality performed by the routers. The packet is assumed to have passed initial checks: the sanity check (basic IP header validity verification), the inbound packet filtering policy, the TTL field check, and so on. These checks and the forwarding algorithm are discussed in more detail in Chapter 5.

  1. Set the next-hop address to the destination address in the packet.

  2. Perform recursive routing table lookup operation as follows.

    1. Find the route for the current next-hop address in the routing table.

    2. If a route is found and it specifies the intermediate address, set the next-hop address to the address in the route.

    3. If the route is found and it does not specify the interface, loop back to step 2.a.

  3. If the recursive route lookup did not succeed—no matching route was found or a route could not be resolved—send an ICMP "Destination Unreachable, Host Unreachable" message to the packet originator, using the source IP address in the packet as the destination IP address in the ICMP message, and drop the packet.

  4. Otherwise, if the current value of the next-hop address equals the prefix value of the found route, set the next-hop address back to the destination IP address in the packet.

  5. Pass the packet to the packet-delivery function. Provide the interface in the route and the current next-hop address as the arguments.

The algorithm is pretty simple. First, the routing table is searched for a route that can be used to route to the destination IP address in the packet. (The routing table lookup algorithm is discussed later.) If a route is found and it specifies only an interface—describes a directly connected network—the packet is sent out of the specified interface, using the destination IP address in the packet as the next-hop address. If the route specifies both the address and the interface—this is how IGP routes are installed—the packet is sent out of the interface to the next-hop router corresponding to the address in the route. If the route is recursive—only the intermediate address is specified—the intermediate address becomes the current next-hop route, and a routing table lookup operation is performed again.

The check in step 4 needs more explanation. That check is required when the routing table contains information similar to that shown in the following example:

10.0.0.0 is accessible via 20.1.1.0 
20.1.1.0 is directly connected to the interface Ethernet 1

The recursive route to network 10.0.0.0 specifies a subnet address (20.1.1.0) as the intermediate address. Without the check, the subnet address would be used as the next-hop address. The check makes sure that the destination address in the packet is used as the next-hop address in this situation.

The packet-delivery procedure is initiated by the forwarding algorithm and receives the packet, the outbound interface, and the next-hop IP address as the arguments from it. Following is the outline of the steps taken by the packet-delivery process.

  1. If the interface state is down or IP processing is not enabled on the interface, send an ICMP "Destination Unreachable, Host Unreachable" message to the source host, and stop processing the packet.

    NOTE

    A route in the routing table can reference an interface in down state while the routing table is converging—it takes time to remove invalid routes—or because a static route through an interface was configured to be never removed from the routing table (see Chapter 6).

  2. If the interface type is point-to-point, pass the packet directly to the packet encapsulation procedure specific to the interface. There is no need to look up data link layer details for point-to-point interfaces. They are either not necessary (such as HDLC or PPP encapsulation) or statically configured for the interface, such as, a point-to-point Frame Relay interface.

  3. Otherwise, if the interface type is point-to-multipoint, perform the following steps.

    1. Search the map table associated with the interface, using the next-hop address as the search parameter.

    2. If no map for the next-hop address is found, log an encapsulation failure, send an ICMP "Destination Unreachable, Host Unreachable" message to the source host, and stop processing the packet,

    3. Otherwise, pass the packet to the packet encapsulation procedure specific to the interface, and pass the located map table entry as a parameter; it will be used to construct the data link layer frame for the packet.

  4. Otherwise, if the interface type is broadcast, perform the following steps.

    1. Search the ARP cache for the MAC address corresponding to the next-hop address and outbound interface.

    2. If no ARP entry is found, log an encapsulation failure, send an ARP request message for the next-hop address, send an ICMP "Destination Unreachable, Host Unreachable" message to the source host, and drop the packet.

      NOTE

      Note that the router does not wait for the ARP reply message to come in and does not queue the packet.

    3. Otherwise, pass the packet to the packet encapsulation procedure specific to the interface, providing the found ARP entry as a parameter; it will be used to construct the data link layer frame for the packet.

As you can see, the data link parameters vary by type of interface. Point-to-point interfaces require very little additional work. Point-to-multipoint links, such as Frame Relay or X.25, require the DLCI or X.121, which should be used to reach a specific next-hop router. The mapping between the next-hop addresses and the data link layer details is usually configured manually by the administrator (see Chapter 5 for details). Broadcast interfaces require knowledge of the next-hop router's MAC address that is discovered using ARP. Also note that the interface MTU check and the IP packet fragmentation functionality are performed by the packet encapsulation function.

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