What Is a Routing Table? How Routers Make Decisions

What Is a Routing Table? How Routers Make Decisions
Networking ATN Campus September 24, 2026 49 views

What Is a Routing Table? How Routers Make Decisions

Every router needs to know where to send packets. The main source of this information is the router's routing table.

A routing table contains information about reachable networks, prefixes, next-hop addresses, outgoing interfaces, route sources, administrative distance, and metrics.

In this guide, we will learn what a routing table is, how routers choose routes, what longest prefix match means, how administrative distance and metrics work, and how to read a Cisco routing table.

```

What Is a Routing Table?

```

A routing table is a data structure maintained by a router that contains information used to determine how packets should be forwarded toward destination networks.

         Router
           |
           v
    +----------------+
    | Routing Table  |
    +----------------+
      |     |      |
      v     v      v
    LAN 1  LAN 2  WAN

When a router receives an IP packet, it examines the destination IP address and uses the routing table to determine the appropriate forwarding path.

```

What Information Does a Routing Table Contain?

```
Information Purpose
Destination Prefix Identifies the destination network.
Next Hop Identifies the next router toward the destination.
Outgoing Interface Identifies where the packet should be forwarded.
Route Source Shows how the route was learned.
Administrative Distance Helps compare routes from different routing sources.
Metric Helps a routing protocol compare paths within its own routing domain.
```

Example Routing Table

```
```

Destination        Next Hop          Interface

192.168.10.0/24    Connected         G0/0
192.168.20.0/24    10.0.12.2         G0/1
10.0.12.0/30       Connected         G0/1
0.0.0.0/0          10.0.12.2         G0/1 
```

The router uses these entries to determine where packets should go.

```

How Does a Router Make a Forwarding Decision?

```

A simplified forwarding process looks like this:

    Packet Arrives
         |
         v
    Read Destination IP
         |
         v
    Search Routing Table
         |
         v
    Longest Prefix Match
         |
         v
    Select Route
         |
         v
    Determine Next Hop / Interface
         |
         v
    Forward Packet
```

What Is a Network Prefix?

```

A routing table represents destinations using network prefixes.

    192.168.10.0/24

    Network Address: 192.168.10.0
    Prefix Length:   /24
    Subnet Mask:     255.255.255.0

A prefix tells the router which destination addresses belong to a particular network.

```

What Is the Next Hop?

```

The next hop is the next router or forwarding destination toward the final network.

    PC
    |
    v
   R1
    |
    | Next Hop: 10.0.12.2
    v
   R2
    |
    v
Destination Network
192.168.30.0/24

R1 does not necessarily know every router that the packet will cross. It only needs enough forwarding information to send the packet toward the next appropriate destination.

```

What Is an Outgoing Interface?

```

A routing entry may identify the interface through which a packet should be forwarded.

    Destination: 192.168.20.0/24
    Next Hop:    10.0.12.2
    Interface:   GigabitEthernet0/1

The router uses the outgoing interface to send the packet toward the next hop.

```

What Is Longest Prefix Match?

```

One of the most important concepts in routing is Longest Prefix Match.

When multiple routing entries match the destination IP address, the router generally selects the matching route with the most specific prefix.

    Routing Table:

    10.0.0.0/8
    10.10.0.0/16
    10.10.10.0/24

    Destination:

    10.10.10.50

    Matching routes:

    10.0.0.0/8
    10.10.0.0/16
    10.10.10.0/24

    Selected:

    10.10.10.0/24

The /24 entry is more specific than /16 and /8, so it is the longest matching prefix.

```

Why Is Longest Prefix Match Important?

```

Longest prefix matching allows routers to have broad routes while also creating more specific routes for particular destinations.

    Broad Route

    10.0.0.0/8
          |
          +---- General destinations

    More Specific Route

    10.10.10.0/24
          |
          +---- Specific destination

This mechanism is fundamental to IP routing.

```

Where Do Routing Table Entries Come From?

```

Routers can learn routes from several sources.

Route Type Example
Connected Directly connected network
Static Manually configured route
OSPF Dynamic routing protocol
RIP Distance-vector routing protocol
EIGRP Dynamic routing protocol
BGP Inter-domain routing protocol
```

What Is Administrative Distance?

```

Administrative Distance (AD) is used by many routing platforms to compare the trustworthiness of routes learned from different routing sources.

When multiple routing protocols provide routes to the same destination, the route with the more preferred administrative distance can be selected, subject to platform rules.

Route Source Typical Cisco AD
Connected 0
Static 1
EIGRP 90
OSPF 110
RIP 120
External BGP 20
Internal BGP 200

These are common Cisco defaults; actual values can be changed through configuration.

```

Administrative Distance vs Metric

```

These two concepts are often confused.

Concept Main Purpose
Administrative Distance Compares routes from different sources.
Metric Helps a routing protocol compare paths within that protocol.

For example, OSPF uses cost to compare OSPF paths. If another routing protocol also advertises the same destination, administrative distance can be involved in choosing between the different route sources.

```

What Is a Routing Metric?

```

A metric is a value used by a routing protocol to compare available paths.

Protocol Common Metric Concept
RIP Hop count
OSPF Cost
EIGRP Composite metric
BGP Multiple path attributes and policy
```

What Is a Default Route?

```

A default route is a route used when no more specific route matches the destination.

    0.0.0.0/0

    Means:

    "Use this route if there is no
     more specific matching route."

Default routes are commonly used by organizations to forward Internet traffic toward an ISP or upstream router.

          LAN
           |
           v
          R1
           |
           | Default Route
           v
          ISP
           |
           v
       Internet
```

Connected Routes

```

When an interface is configured with an IP address and is operational, the router can install a connected route for the directly connected network.

    R1

    G0/0
    192.168.10.1/24

    Routing Table:

    C 192.168.10.0/24
      is directly connected
      G0/0
```

Static Routes

```

A static route is manually configured by an administrator.

```

Router(config)# ip route 192.168.30.0 255.255.255.0 10.0.12.2 
```

This tells the router how to reach 192.168.30.0/24 through next hop 10.0.12.2.

```

OSPF Routes

```

OSPF can dynamically learn routes from neighboring routers.

    R1 -------- R2 -------- R3

    R1 learns:

    O 192.168.30.0/24
    via 10.0.12.2

The O indicates that the route was learned through OSPF on Cisco IOS.

```

Reading a Cisco Routing Table

```
```

Router# show ip route

C    192.168.10.0/24 is directly connected, GigabitEthernet0/0

O    192.168.30.0/24 [110/20]
via 10.0.12.2, GigabitEthernet0/1

S*   0.0.0.0/0 [1/0]
via 10.0.12.2 
```

In the example:

  • C = Connected route.
  • O = OSPF route.
  • S = Static route.
  • * commonly identifies a candidate default route in Cisco output.
  • 110 = typical OSPF administrative distance.
  • 20 = OSPF path cost.
```

How a Router Chooses Between Routes

```

A simplified decision process can be understood in stages.

  1. Look for routes matching the destination.
  2. Use the longest matching prefix.
  3. If multiple routes for the same prefix come from different sources, administrative distance can be used.
  4. Within a routing protocol, its metric and path-selection rules determine the preferred path.
  5. Forward the packet using the selected route.
    Destination IP
          |
          v
    Matching Prefixes
          |
          v
    Longest Prefix Match
          |
          v
    Route Source / AD
          |
          v
    Metric / Protocol Rules
          |
          v
    Next Hop + Interface
          |
          v
    Packet Forwarded
```

Example: How Does the Router Decide?

```

Imagine a router has these entries:

    10.0.0.0/8
    10.10.0.0/16
    10.10.10.0/24

A packet arrives with destination:

    10.10.10.50

All three prefixes match the destination, but 10.10.10.0/24 is the most specific match.

Therefore, the router selects the /24 route.

```

Routing Table vs Forwarding Table

```

In modern routers, the control plane maintains routing information while forwarding hardware/software uses the resulting forwarding information to move packets efficiently.

    Routing Protocols
    Static Routes
    Connected Routes
          |
          v
    Routing Information
          |
          v
    Best Routes
          |
          v
    Forwarding Information
          |
          v
    Packet Forwarding
```

Useful Cisco Routing Commands

```

Display the Routing Table

```

Router# show ip route 
```

Display OSPF Routes

```

Router# show ip route ospf 
```

Display Connected Routes

```

Router# show ip route connected 
```

Display Static Routes

```

Router# show ip route static 
```

Test a Specific Destination

```

Router# show ip route 192.168.30.0 
```

Check the Path

```

Router# traceroute 192.168.30.10 

Common Routing Table Problems

```

1. Destination Network Is Missing

Check:

  • Whether the network is directly connected.
  • Whether a static route exists.
  • Whether the routing protocol is running.
  • Whether the route is being filtered.
  • Whether a neighbor relationship exists.

2. Wrong Route Is Selected

Check:

  • Longest prefix match.
  • Administrative distance.
  • Routing protocol metrics.
  • Route policies.
  • Next-hop reachability.

3. Default Route Is Not Working

  • Check whether 0.0.0.0/0 exists.
  • Check the next-hop address.
  • Check the outgoing interface.
  • Verify upstream connectivity.
```

Practical Routing Table Lab

```
    LAN 1
    192.168.10.0/24
         |
         R1
         |
    10.0.12.0/30
         |
         R2
         |
    10.0.23.0/30
         |
         R3
         |
    LAN 3
    192.168.30.0/24

Lab Objectives

  1. Configure IP addresses.
  2. Configure connected networks.
  3. Add a static route.
  4. Configure OSPF.
  5. Inspect the routing table.
  6. Identify next-hop addresses.
  7. Compare administrative distance and metrics.
  8. Test longest prefix matching.
  9. Add a default route.
  10. Test end-to-end connectivity.
```

Quick Routing Table Quiz

```

1. What is a routing table?

Show Answer

A data structure maintained by a router containing information used to determine how packets should be forwarded.

2. What is the next hop?

Show Answer

The next router or forwarding destination toward a network.

3. What is Longest Prefix Match?

Show Answer

The process of selecting the most specific matching destination prefix for a packet.

4. What does administrative distance compare?

Show Answer

It helps compare routes learned from different routing sources.

5. What does 0.0.0.0/0 represent?

Show Answer

A default route that can match destinations when no more specific route is available.

```

Key Takeaways

```
  • A routing table tells a router how to reach destination networks.
  • Routing entries can contain prefixes, next hops and interfaces.
  • Routers use Longest Prefix Match when selecting among matching prefixes.
  • Administrative distance helps compare different route sources.
  • Metrics help routing protocols compare paths.
  • Connected, static and dynamic routes can appear in a routing table.
  • 0.0.0.0/0 is commonly used as a default route.
  • Understanding routing tables is essential for troubleshooting.
```
```

Want to Master Routing and Networking? Visit ATN Campus

Want to learn routing tables, OSPF, BGP, switching, subnetting, VLANs, network security, and network troubleshooting through practical training?

Visit ATN Campus and learn networking through a combination of clear theory, practical hands-on labs, Cisco configurations, and real-world networking scenarios.

Learn More Than Just Routing Tables

  • CCNA – Cisco Certified Network Associate
  • CCNP – Cisco Certified Network Professional
  • Routing & Switching
  • OSPF & Dynamic Routing
  • BGP & Advanced Routing
  • Subnetting & IP Addressing
  • VLANs & Inter-VLAN Routing
  • Network Security
  • CEH – Certified Ethical Hacker
  • Cisco CyberOps
  • Cloud Networking
  • Python for Network Automation
  • Practical Cisco Networking Labs

Whether you are starting your networking journey, preparing for CCNA or CCNP, or developing professional troubleshooting skills, ATN Campus helps you turn networking concepts into practical knowledge.

???? Want to learn networking? Visit ATN Campus.

???? Learn Networking. ???? Master Routing & Switching. ???? Practice with Real Labs. ???? Prepare for Certifications. ???? Build Your IT Career with ATN Campus.
Document ATN CAMPUS