Home > Articles > Cisco > CCNA Routing and Switching

To Route or Not to Route: A Day in the Life of a Router

How many decisions must a router make each day? The answer: millions! A lot goes into the decision process regarding routing, and it happens long before a packet, being sent by a customer, arrives at the router for its turn to be forwarded. Join me as we take a close look at a day in the life of the router.
Like this article? We recommend

Like this article? We recommend

“To route or not to route, that is the question.”

Signed, The Router

How many decisions must a router make each day? The answer: millions! A lot goes into the decision process regarding routing, and it happens long before a packet, being sent by a customer, arrives at the router for its turn to be forwarded. Join me as we take a close look at a day in the life of the router.

Planning Ahead

A common theme in success strategies is to plan ahead and be prepared, so that when a circumstance presents itself, we already know what we should do. The same is true for an IP router. Consider the router below, with 4 interfaces.

When a packet arrives at Ethernet interface 1/0, the router has a decision to make. Options for the router seem fairly simple; discard the packet or route it out of one of its interfaces. Long before a packet shows up to be routed, the router should be trained on what to do and which interfaces to use. This training process is called the “control plane” of the router, and is how the router learns where networks are (similar to us knowing where various cities are), and the best path to reach those networks (similar to us knowing which onramps or surface streets to use to reach those cities).

The Learning Process

The control plane for the router only has four ways of learning about networks, that’s it! They are:

  1. Directly connected networks
  2. Statically learned networks
  3. Dynamically learned networks
  4. Default routes

Let’s look at each of these options, and learn what impact they have on the router’s decision process.

Directly Connected Networks

On a brand new router right out of the shipping box and plugged in, it doesn’t know about any IP networks, because it has no IP addresses configured. The first time we add an IP address with an associated mask to an interface, and bring that interface out of shutdown state, “POOF!” the router now knows about its first network, which is the directly connected network we just configured. Even if this interface is connected to a switch with no other devices on it, the router still believes it can reach this local network, due to the IP address configured on the local interface.

In the example below, the new router has no IP addresses configured, and therefore nothing in his routing table.

After configuring an IP address on an interface and bring up the interface, the single directly connected network is now in the routing table. The new network in the routing table below is 10.0.0.0/24.

Statically Configured Networks

As long as the router is directly connected to at least one IP network, we can train the router about using that connection to reach other networks as well (via other routers who are also on that same connected network). Manually telling the router about a non-local network is what the static route is all about. It is also an issue of faith for the router. For example, if we tell the router that to reach the network of 23.1.2.0/24, it should send those packets to R2 at 10.0.0.2, and our router would now believe it knows how to forward packets to the 23.1.2.0/24 network. In reality, the router would hope (if routers had feelings) that the device at 10.0.0.2 knows how to reach the remote network of 23.1.2.0/24. R1 would not really know, for sure, if R2 could reach it or not. In the example below, a static route has been added to R1 informing R1 that to reach 23.1.2.0/24 it should pass the packets to the router at the IP address of 10.0.0.2

Dynamically Learned Networks

Manually configuring individual static routes can be tedious, especially in larger organizations with many routers and many networks. A solution to avoid having to use static routes everywhere is dynamic routing. It really should be called dynamic learning, because that is what is going on. Using a set of rules called a Routing Protocol, each of the routers dynamically shares the routes is knows or has learned with other routers. This way, when a new network is added directly to R2, or when R2 learns about a new network, this information can be shared with R1 so that R1 will have dynamically learned the route. The routing protocols inside of an organization fall into a category called Interior Gateway Protocols (IGPs); examples include RIP, EIGRP, OSPF, and IS-IS. In the example below, R1 and R2 are running the OSPF routing protocol, and exchanging routing information.

R1 has learned routing information from R2, and the network 23.0.0.0/24 shows up in R1’s routing table. In the example below, we are confirming that R1 knows about R2 via the OSPF routing protocol, and verifying that R1 has learned a route, via OSPF, for the network 23.0.0.0/24

The Default Route

The last method is also a sort of last resort when it comes to routing: the default route. It is what the router should do when it needs to forward a packet and doesn’t have an entry in its routing table for any part of the destination address in the IP header of the packet. For example, we could have a route that says forward packets (when you don’t know what else to do with them) to the router at 10.0.0.2; this would be an example of a default route. Routers may learn a default route from a neighbor using a routing protocol, or a default route may be statically configured. In the example below, R1 is using a manually configured static route that instructs it to use R2’s (the IP address of R2 is 10.0.0.2) as the next hop (router) for any packets that don’t match a more specific route in R1’s routing table.

Putting Useful Knowledge to Work

As the router is being trained about reaching networks, which is the control plane we talked about earlier, it places the information about how to reach those networks (such as the next router’s IP address, and which exit interface to use) in the routing table. There are a few extra processes going on in the background, but by and large, the routing table is the winning route’s #1 podium position at the Olympics. Only the best routes (best path, in the router’s mind, regarding how to reach the remote networks) go into the routing table. If there are two equal cost (in the router’s mind) paths to the same remote network, then the router can place both of those routes in the routing table and use them both to forward packets to the remote network. It is the metric (sometimes referred to as cost) that the router considers to determine which of several routes it knows about (for the same remote network) would be the “best” route to use. Using the metric, lower is considered better.

What about conflicting information?

In a situation where the same network is being learned via two different methods, for example a static route for the 3.3.3.0/24 network and a dynamically learned route for the 3.3.3.0/24 network (learned from a neighbor), the router will consider a special value called AD (Administrative Distance) that is associated with each method of learning it does, and if there are two exact routes from different sources, the router will choose a single winner (for that route) based on the method that has the lowest AD (lower is better). AD has defaults on a Cisco Router, which can be changed. Some of the defaults are listed in Table 1.

Table 1

How the Route was Learned

AD (default Administrative Distance)

Directly Connected Interface

0

Static Route

1

Internal EIGRP (Dynamic IGP)

70

OSPF (Dynamic IGP)

110

ISIS (Dynamic IGP)

115

RIP (Dynamic IGP)

120

Here we can see the route for network 3.3.3.0/24 in the routing table of R1. The numbers in brackets show the [AD/METRIC]. In this example, the route was learned via OSPF, which has an AD of 110, and the OSPF metric for that route is 145.

So if the router learned about the network 3.3.3.0/24 via OSPF and had that route in the routing table, and later we added a static route for the same network, the new static route with an AD of 1, would be better (in the mind of the router) than the route from OSPF with a metric of 110, and the static route would replace the OSPF learned route on the winners podium in the routing table. We can see this with the debug running for IP routing. In the example below, we add the static route, which due to a better AD than OSPF is now placed in the routing table.

Forwarding Customer Packets

The learning of routes is called the control plane, and is the process where the router learns and decides the best routes to use. This control plane is like going to class, where the router does the learning of routes and how to forward packets. The application of this learning, where the router actually forwards real packets (using the information it previously learned about routes) is called the Data Plane, and often referred to as the transit path or packet switching.

When a router receives a frame of data from a switch, the router looks at the Layer 2 destination address (in the frame of data) and asks itself, “Do I care about this frame of data? Is it relevant to me? What is my motivation to continue working with this frame?” Regarding IP version 4, if the L2 destination MAC address is the MAC address on the router, or the L2 address is a broadcast address, or the L2 address is the address of a multicast group that this router has joined, then YES, this frame of data is interesting or possibly relevant to the router. As a result, the router will look further into the packet to see what else is inside. In an Ethernet L2 header, it specifies what the payload is (the protocol being carried), which could be dot1q, MPLS or even IP. For this example of IP routers, let’s say the L3 information was IP version 4. In the packet analysis below, it shows a L2 frame with a destination MAC address of R2, and a destination L3 address of 3.3.3.3 which is not local to R1 or R2.

When receiving this frame and because the L2 destination address was relevant to R2 (00:64:40:22:22:22 is R2’s MAC address), R2 continues to dive into the packet and then looks at the L3 destination address, and asks, “Do I care about this packet (at L3) of data? Is it relevant to me?” If the destination IP address in the L3 header matches an IP address of the router, the router would realize this packet was specifically for him, and would continue to look deeper into the packet to see what the packet was all about. An example of traffic destined to R2 could be a packet carrying part of a TCP based SSH session between the router R2 and the administrator.

What if the L3 Destination Address doesn’t belong to the Router?

If the L3 destination IP address is NOT one of the router’s IP addresses, the router realizes the packet is not for the router personally, but the router is willing to forward (or route) this IP packet (it is a router, after all). The router consults the routing table to determine if any of its routes/networks in the routing table match the destination IP address in the packet. If a packet has the destination IP address of 3.3.3.3, the router would look for the longest match (if there were multiple different length entries in the routing table), and use that route to forward the packet. In the output below, the routing table lists that it knows one subnet from the Class A network of 3.0.0.0, that it is subnetted down to a /24, and that 24 bit network is 3.3.3.0.

Because the first 24 bits of this route/network in our routing are an exact match of the first 24 bits of the packet we need to forward, this is our longest match. R2 will forward the packet on the L2 address of 23.0.0.3 (based on the routing table above) and will use Ethernet 1/0 to forward the packet. The device at 23.0.0.3 will then go through the similar process of opening up the packet, and making a routing decision about that packet. This is a story that happens millions of times per day, in networks all around the world.

If a router doesn’t have an exact match based on its routing table, it will then use its default route for forwarding, and if there isn’t a default route either learned or configured on the router (with no other more specific routes in the routing table), the router will drop the packet, and send a message to the source IP from the packet, letting that device know that the packet was dropped. (This isn’t really an apology for dropping the packet, but more for just notification that it happened).

There is an entire fascinating world happening within our networks, and I hope you have enjoyed looking into the concept of routing from the router’s perspective.

Pearson IT Certification Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from Pearson IT Certification 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 Pearson IT Certification 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 Adobe Press. 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.pearsonitcertification.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