Connected Routes and Local Routes Explained

This tutorial explains how routers automatically manage routing information for active interfaces. Learn the meaning of code C and code L in the routing table.

Routers automatically add and maintain the routing information for active interfaces. A router uses the IP configuration of active interfaces to create the routing information. The following steps describe this process step-by-step via an example.

  • The administrator assigns an IP address to the interface.
  • The administrator enables the interface.
  • The router checks the line status and protocol status of the interface. The line status represents the layer-2 connectivity, and the protocol status represents the layer-3 configuration. If the line status is UP, the interface is connected to the remote device. If the protocol status is UP, the interface is enabled and has a valid IP configuration.
  • An interface can forward packets only if both statuses are UP. If one of two statuses is down, the interface cannot forward packets.
  • Routers use the routing table to forward packets. A router does not add routing information for the interface that can't forward packets.
  • If both statuses are up, the router takes the following steps.
    • Take the IP address of the interface.
    • Find the network address of the IP address.
    • Create a routing table entry. This entry includes the network address and the name of the interface.
    • Add the routing table entry to the routing table.

  • If the administrator changes the IP address of the interface, the router automatically updates the routing table entry to reflect the change.
  • The router can't forward packets from the disabled interface. Because of this, if the administrator disables the interface, the router automatically removes the corresponding routing table entry.

Let's take another example to understand how this process works.

Automatic route configuration (Packet Tracer Example)

Open Packet Tracer and drag a router and a PC to the workspace.

packet tracer example

Access the CLI prompt of the router

access cli prompt

Currently, this router has no routing information. To verify this, print all routes. Now, assign the IP address 10.0.0.1/8 to the GigabitEthernet0/0 interface and enable it.

When you enable the interface, the router checks the IP configuration of the interface and creates the routing information from the IP configuration, but it does not add the routing information to the routing table. To verify this, you can print all routes again.

The following image shows how to perform the above steps on the router.

no route in routing table

The following table describes the meaning of each command used in the above process.

Command Description
enable Enter privileged-exec mode
show ip route Print all routes
configure terminal Enter global configuration mode
interface GigabitEthernet0/0 Enter interface configuration mode
no shutdown Enable interface
exit Exit current mode

As you can see in the image above, the router did not add routing information for the GigabitEthernet0/0 interface.

Can you guess why the router did not add the routing information to the routing table?

Because the interface is not connected to any remote device. To verify this, you can use the 'show interfaces interface_name' command. The first line of the output displays the line status and protocol status of the interface.

The following image shows the output of this command.

show interface command

If an interface is not connected to any remote device, it can't forward packets. If an interface can't forward packets, the router does not add the route available on the interface.

As you can see in the above output, the interface is up (GigabitEthernet0/0 is up), but it is not connected to any device (line protocol is down).

Connect PC0 to GigabitEthernet0/0.

connect pc to interface

Now, print all IP routes again.

show ip route

As you can see in the above output, as soon as both the line status and protocol status of the interface turns up, the router automatically adds the routing information for the interface.

The router adds two routes for the interface. The router assigns the code letter C to the first route and the code letter L to the second route. The router uses the first route to forward packets from the interface and the second route to send packets to the interface.

Let's understand the meaning of both routes.

C – (Connected) route

A router uses interfaces to receive and forward packets. An interface and the remote device that is connected to the interface can exchange packets only if they belong to the same IP network. Because of this, when an administrator configures an IP address on the interface, the router automatically assumes that the remote device that is connected to the interface belongs to the same IP network.

In our example, we configured the IP address 10.0.0.1/8 on the GigabitEthernet0/0.

From this IP address, the router assumes that the remote device connected to the other side of GigabitEthernet0/0 belongs to network 10.0.0.0/8 and knows how to access network 10.0.0.0/8.

Based on this assumption, the router automatically adds a route for the network 10.0.0.0/8 and relates this route to the GigabitEthernet0/0 interface. The router uses the letter C (Connected) to represent this type of route.

When the router receives a packet for a remote destination, it checks all available routes. If a route is available for the remote destination, the router forwards the packet from the interface that is mentioned in the route.

In our example, if the router receives a packet which destination address belongs to the network 10.0.0.0/8, the router forwards the packet from the GigabitEthernet0/0 interface.

L – (Local) route

A router also receives packets for local usages. You can configure multiple IP addresses on the router. Each configured IP address represents a specific object on the router. The second route tells us where the particular IP address is available on the router. The second route is known as the host route. The router uses the letter L (Local) to represent this type of route.

In our example, the IP address 10.0.0.1/8 is configured on the GigabitEthernet0/0 interface. To forward packets to the GigabitEthernet0/0 interface, the router adds a local route for this IP address. Since a local route represents a specific local object, the router uses the IP address of the object. The router uses the prefix /32 in the local route. The prefix /32 represents a host address.

connected route

Similarities between a connected route and its related local route
  • Both routes belong to the same IP subnet.
  • The router calculates both routes from the same IP configuration.
  • Both routes lead packets to the same interface.
Differences between a connected route and its related local route
  • A connected route represents the network address. It uses the actual subnet prefix (mask). A local route represents the host address. It always uses the subnet prefix /32.
  • A router always uses a connected route to forward packets out of the router. A router never uses a local route to send packets out of the router.
  • Local routes display the internal layout of the router. Connected routes show how the router is connected to the network.

The following image explains the differences between a connected route and its related route through an example.

how router select a route

Managing connected routes and local routes

A router creates a connected route and the local route from the IP configuration of the interface. If the administrator changes the IP configuration of the interface, the router automatically updates its connected route and the local route.

The following image shows an example of this process.

change ip configuration

As mentioned earlier, a router adds a route for an interface only if both the line status and the protocol status of the interface are up. If the line status or the protocol status or both the line status and the protocol status change down, the router automatically removes the interface's route.

The following image shows how a router removes routes of an interface when the administrator shuts down the interface.

shutdown interface

If an interface loses its connectivity from the remote device, the router automatically removes its routes. The following image shows how a router removes the routes of an interface when the interface loses its connectivity.

lose connectivity

That’s all for this tutorial. In this tutorial, we discussed how a router automatically adds routes for the active interfaces. In the next tutorial, we will learn how to manage static routes.

ComputerNetworkingNotes CCNA Study Guide Connected Routes and Local Routes Explained