Home > Articles > Networking > Routing & Switching

This chapter is from the book

3.8 Classful Routing Operations

Before we proceed to the principles of classful IP routing, an important detail about routing table entries needs to be discussed. The routing table structure defined in the previous section specified that each route describes a set of destinations in the form of a network prefix with its value and length. However, all examples given before showed routes in the routing tables just as network addresses (10.0.0.0) instead of as network prefixes (10.0.0.0/8). Indeed, when they install routes in the routing table, Cisco routers provide the corresponding route mask as well. This discussion of the idea behind the route mask was intentionally delayed until the topic of routing table lookup functionality. For better understanding of why routing table entries need masks, let's consider several examples.

Suppose that a summary route to major network 10.0.0.0 with mask 255.0.0.0 and a route to subnet 10.0.0.0 255.255.0.0 (zero subnet) are installed in the routing table as shown in the following example. Note that if routes did not have associated masks, these two routes would be indistinguishable.

10.0.0.0/8      — via 10.2.0.1
10.0.0.0/16     — via 10.2.0.3

The number after / in the routes represents the number of significant bits in the prefix value; the number is equal to the number of bits in the route mask. So, /8 implies a mask of 255.0.0.0, and /16 means a mask of 255.255.0.0. The route mask specifies the portion of the route's network address that must be compared with the destination address in the packet. A route is declared matching a destination address if the bits in the address corresponding to the bits set to 1 in the route mask are equal to the bits in the same positions in the route's prefix value. In our example, both routes would match address 10.0.0.15 because the 10.0.0.0/8 route matches the first octet of the address, and the 10.0.0.0/16 route matches the first two octets of it. In this situation, 10.0.0.0/8 is said to be a less specific route, and 10.0.0.0/16 is said to be a more specific one. When multiple matching routes are available to the same destination, routers choose the longest matching route to forward the packets. So, for a packet to IP address 10.0.0.15, the 10.0.0.0/16 route would be used. The other route, 10.0.0.0/8, would be used to forward packets to all other, unknown subnets of major network 10.0.0.0. This is an example of a so-called network default route.

Now let's move on to the classful routing topic. The principles of classful addressing discussed in Chapter 2 state that the whole major network must use a single subnet mask. Moreover, the routing protocols designed for classful environments do not send the route masks in their updates. The route mask is determined on the basis of the address masks configured on the interfaces on which the updates are received. Indeed, routers do not have any other source of information about the subnet mask used on remote subnets. Let's see how dynamic routing protocols work in a classful environment.

An update message of a classful protocol can carry routes of the following types.

  • Host routes
  • Subnet routes
  • Network routes
  • Default routes

Consider two routers connected to subnets of the same major network—R1 to 10.1.0.0, 10.2.0.0 and 10.3.0.0 and R2 to 10.3.0.0, 10.4.0.0, and 10.5.0.0 (see Figure 3-10). The subnet mask used on the interfaces of the routers is 255.255.0.0. When it receives the update from router R2 about subnets 10.4.0.0 and 10.5.0.0, router R1 installs the routes to these subnets in the routing table with the subnet mask taken from its own interface connected to subnet 10.3.0.0, that is, mask 255.255.0.0. Provided that all hosts and routers in major network 10.0.0.0 use this subnet mask—a basic rule of classful addressing—this approach works.

Figure 3-10. Example of classful routing

Now imagine that R2 is connected to another major network, say, 20.0.0.0, which uses a different subnet mask—255.255.255.0. One of R2's interfaces is attached to subnet 20.1.1.0. If R2 sent information about this subnet to R1, R1 would make a wrong decision about the route mask. It would use its own, 255.255.0.0, and it would see that the network address is 20.1.0.0 and that the host part of the route is 0.0.1.0. If it saw that the host part was not all zeros, R1 would assume that the route was a host route and would insert it with the route mask of 255.255.255.255, which is wrong.

To prevent this misunderstanding, routers connected to multiple major networks do not send subnet information about one major network into another. Instead, they send summary network routes. The receiving routers are supposed to install these routes in the routing tables with the default class address masks. A route from any major network with a nonzero host part of the address is considered a host route. (Some implementations ignore host routes coming from remote major networks.)

The behavior when subnet routing information is not propagated from one major network to another is called automatic route summarization. It has its own pros and cons. On the one hand, autosummarization decreases the size of the routing tables. On the other hand, it can cause routing problems when discontiguous networks are used. For example, consider a situation in which major network 10.0.0.0 is geographically divided by major network 20.0.0.0 (Figure 3-11). The border router R1 sends only a summary route, 10.0.0.0, to routers in major network 20.0.0.0. Border router R2 does the same. So, the router in major network 20.0.0.0 has no information about subnets of network 10.0.0.0 and hence cannot properly route packets going there. In the worst case, routers inside major network 20.0.0.0 choose only the best route to network 10.0.0.0 and install it. This leads to a situation in which a router can see only one partition of the network and cannot send packets to the other. In the best case, when the routers have routes with equal metrics, the routers use both and load-balance the traffic between them. This is still not good, as packets can be sent in a wrong direction. In both cases, the routing is not functional.

Figure 3-11. Classful routing when one major network is split by another

Another interesting subject is how the routing table lookup operation is performed when routers are working in a classful environment. The algorithm follows.

  1. If the routing table contains a route to a destination in the major network that the destination address belongs to, including a route to the major network itself, perform the following steps.

    1. Look up the longest matching route limiting the set of routes to those describing the destinations in that major network.

    2. If no route is found, do not consider the supernet routes or the default route; indicate a route lookup failure, and stop the algorithm.

  2. Otherwise, look up the best matching route among the supernet routes. If a route is found and it is not a route to pseudonetwork 0.0.0.0, use the route for packet forwarding.

  3. Otherwise, if the default route is available, use it to forward the packet.

  4. Otherwise (no matching route and no default route is available), indicate a route lookup failure.

The behavior of the lookup algorithm depends on the result of the first step. If the router has any route for a network in the destination major network—that is, the router is assumed to have attachments to the major network, the only routes considered are those describing address ranges in the same major network: subnet and network default routes. If no route belongs to the destination major net, a simple best-matching route is chosen. Note that the default route is used only if the router is not attached to the destination major network. (We discuss the reason for this later in this section.)

The following example illustrates how the routing table lookup algorithm works. Suppose that a router needs to forward a packet with the destination address 20.1.2.3. The routing table contains the following routes:

1: Network 10.0.0.0/8 is directly connected to the interface Ethernet 0
2: Network 20.0.0.0/8 is accessible via 10.1.1.1
3: Subnet  20.1.1.0/24 is directly connected to the interface Ethernet 1
4: Subnet  20.1.2.0/24 is accessible via 10.1.1.2

Following is the log of the steps taken by the algorithm.

  1. The destination address is 20.1.2.3, and the destination major network is 20.0.0.0.

  2. The router has routes in the destination major network—routes 2, 3, and 4—so the algorithm branches to step 1.a.

  3. All routes in major network 20.0.0.0 are processed as follows.

    1. Route 2—20.0.0.0/8. The route's mask is applied to the destination address, which gives 20.0.0.0. This value is the same as the network address part of the route, so the route matches. So far, this route is the best, but the router proceeds to the next route, as there may be better ones.

    2. Route 3—20.1.1.0/24. The binary AND between the route mask and the destination address results in 20.1.2.0, which is different from this route's network address (20.1.1.0). This route does not match, so it is skipped.

    3. Route 4—20.1.2.0/24. The result of 20.1.2.3 AND 255.255.255.0 is 20.1.2.0, which is equal to the network address portion of the route. The current best route is route 2 (20.0.0.0/8). The route mask of route 4 (255.255.255.0) is longer than that of route 2 (255.0.0.0), so 20.1.2.0/24 is better and is selected as the current best route.

    4. Because no other routes are in the routing table belonging to the destination major network, the algorithm stops, and the 20.1.2.0/24 route is considered the best.

Consider a situation in which a router has somewhat different routing information, the presence of the default route:

1: Network 10.0.0.0/8 is directly connected to the interface Ethernet 0
2: Subnet  20.1.1.0/24 is directly connected to the interface Ethernet 1
3: Subnet  20.1.3.0/24 is accessible via 10.1.1.2
4: Network 0.0.0.0/0 is accessible via 10.1.1.3 (Default route)

The router finds out that the destination (20.1.2.3) belongs to the same major network but cannot find a matching route. Now, because the destination address is in the same major network as the router, the algorithm does not try to find a default route and the route lookup fails, causing the packet to be dropped.

The idea behind treating the default route this way in classful routing is that if a router does not know about some subnet of a "known" major network—the administrator didn't configure a static route or a routing protocol didn't send any information about it—it considers this subnet either nonexistent or down. If the packet were destined for another major network that the router is not connected to, it would take the default route and send the packet to the corresponding router (10.1.1.3).

For better understanding, let's consider another example (Figure 3-12).

Figure 3-12. Use of default in classful routing

Routers R1 and R2 are boundary routers. Router R1 has announced the summary route to its major network (10.0.0.0) to R2, as has R2 (route 20.0.0.0 in R1's routing table). Now assume that the administrator of network 10.0.0.0 configured a default route pointing to R2. Consider a situation in which a station from network 20.0.0.0 sends an IP packet with the destination address 10.4.1.1. R2 routes the packet to R1. Looking through the routing table, R1 does not find a route to the destination subnet. Assume that R1 takes the default route, sending the packet back to R2, which in turn sends it to R1 again. The packet is looped until the TTL field in the header reaches 0 and the packet is dropped by one of the routers.

NOTE

In other words, because a default route is used to describe destinations in other networks, sending a packet along a default route is equivalent to sending a packet in the direction of the exit from the local major network and, finally, out of it. Because major networks must be contiguous in classful routing, forwarding a packet out of its destination major network doesn't make much sense and leads to routing loops because routers in other major networks believe that a given subnet can be found in the major network the subnet belongs to.

This concept also applies to the supernet routes: routes installed in the routing table with route masks shorter than the default class masks. The only difference is that a supernet route aggregates information about several major networks, whereas the default route aggregates information about the rest of the world.

A router's behavior in a classful environment can be summarized as follows:

  • Classful routing protocols do not include subnet masks in routing updates.

  • Classful routing protocols hide subnet information from other major networks by announcing only summary network routes into them.

  • Classful routing protocols can announce host routes, which are used when hosts do not reside on the same segment as the rest of the subnet.

  • Each classful router can have the following types of routing information in its table:

    • Host routes—Routes received with nonzero host address parts and implicitly assigned the network mask of 255.255.255.255 or static routes with explicitly configured masks.

    • Subnet routes—Routes to subnets within the major network to which a router has an attachment. These routes are inserted into the routing table with subnet masks on the interface the update is received from used as route masks, unless it is a static route and was configured with different subnet mask.

    • Network summary routes—Routes to other major networks. These routes are inserted into the routing table with the default classful address mask (without subnets) and represent other major networks if they are provided by routing protocols. This type of route can also be used to represent the rest of the local major network (the network default route). Such a route must be statically configured by the administrator.

    • Default routes—Either a 0.0.0.0/0 route, which is marked as default by the router automatically, or other routes to any networks explicitly marked as default by the administrator or a routing protocol (see Chapter 4 for a detailed explanation).

  • While routing packets, routers pay attention to whether the destination major network is local (some of its subnets are directly connected).

  • If the destination major network is local, the router needs to have either a host route with a /32 mask or an explicit route to the subnet or a summary network route describing the rest of the local major network. If this condition is not met, the packet is dropped, and the default and supernet routes are not considered.

  • If the destination major network is not local, the routing table lookup algorithm is changed. The router looks for the best-matching route, paying attention to the length of the route masks; supernet routes may be taken. If no match was found, the router checks the default route. If there's no default route, the packet is dropped.

Following are some problems that can be seen in classful environments.

  • Variable-length subnet masks cannot be used, as routing updates do not contain route masks.

  • Automatic summarization to classful networks prevents use of noncontiguous addressing plans, such as private IP addresses for WAN links.

  • Use of default routes is limited, which can be a problem in very large networks because the only type of summarized route that can be distributed within one major network by routing protocols is the default. This occurs because if the routing protocol sends a network summary route for a local major network, this route is considered an update for zero subnet, not a network summary. So, every router must have either a full routing table or a network summary route representing the rest of the local major network configured manually.

These problems are addressed by the classless routing approach, discussed in the next section.

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