Kahibaro
Discord Login Register

9.7 Default Routes

Understanding Default Routes

Default routes are a special kind of route that routers use as a fallback path when they do not have a more specific route for a destination. They are sometimes called the "gateway of last resort."

The Role of a Default Route

In a routing table, each entry tells the router where to send packets for certain destination networks. However, it is not practical for many routers, especially at the edge of a small network, to know every possible network on the internet.

A default route solves this problem. It tells the router: "If you do not find any other matching entry in your routing table, send the packet here."

You can think of it as the "else" option in an if-else chain in programming. The router checks all known routes. If nothing matches, it uses the default route.

Default Route Notation

In IPv4, a default route is written using CIDR notation as:

$$0.0.0.0/0$$

This means "any IPv4 address," because the prefix length is 0 bits, so no bits of the destination address must match.

In routing tables you may also see:

In IPv6, the default route is written as:

$$::/0$$

This plays the same role for IPv6 as 0.0.0.0/0 does for IPv4.

A default route is represented as:
IPv4: $0.0.0.0/0$
IPv6: $::/0$
It matches any destination address when no more specific route exists.

How Routers Choose the Default Route

Routers always try to find the "best" matching route for a packet's destination, which means the route with the longest prefix length. Default routes have prefix length 0, so they are the least specific possible.

This implies two key behaviors.

First, if there is any more specific route that matches, the router will choose that one instead of the default route. For example, a route for 10.0.0.0/8 will always be chosen over 0.0.0.0/0 when sending traffic to 10.1.2.3.

Second, the default route is used only when no other entry matches. That is why it acts as a "last resort."

Default Routes in a Simple Network

In many small office or home networks, the edge router has just a few routes:

A very simplified IPv4 routing table for such a router might look like this:

DestinationMaskNext HopInterface
192.168.1.0255.255.255.00.0.0.0LAN
0.0.0.00.0.0.0203.0.113.1WAN

The first entry says: "For any 192.168.1.x address, keep it on the LAN."
The second entry says: "For everything else, send it to 203.0.113.1," which is the ISP's router. This second entry is the default route.

On hosts like laptops or desktops, the concept is similar but usually called the "default gateway." It is the IP address of the local router that the host uses when sending traffic to networks outside its local subnet.

Static Default Routes vs Dynamic Default Routes

Default routes can be installed in the routing table in different ways.

A static default route is configured manually by an administrator. For example, on a Cisco style router, a static IPv4 default route might look conceptually like:

$$\text{ip route } 0.0.0.0\ 0.0.0.0\ 203.0.113.1$$

This tells the router to send unknown destinations to the next hop 203.0.113.1.

Dynamic routing protocols can also provide a default route. For instance, one router might learn all external networks and then advertise a default route, rather than advertising every specific network. Other routers simply install the default route into their tables through the routing protocol.

Static default routes are simple and predictable but require manual changes if the topology or next hop changes. Dynamically learned default routes can adapt automatically when links or paths change, depending on the routing protocol behavior.

Multiple Default Routes

A router can have more than one default route. This happens when there are multiple possible "last resort" paths. For example, a router might have two connections to different ISPs.

When several default routes exist, the router uses its normal decision process: it compares administrative distance first, then metrics, then other tie breakers. Those concepts belong to other parts of routing, but the important point is that not all default routes are equal.

You can see cases like these:

In that situation, the router will use the dynamic default route most of the time, and use the static one only if the dynamic one disappears.

Some routers also support equal cost multiple default routes. When two default routes have the same preference and metric, the router may load balance traffic across both paths.

Default Routes and Route Summarization

Default routes are a very extreme form of summarization. Instead of summarizing a group of specific networks into one shorter prefix, the default route summarizes "everything." It tells neighbors that the router is a way out to "all networks," even if the router does not know them individually.

This is useful in large networks to reduce the amount of routing information that needs to be stored and exchanged. For example, an edge router in a branch office does not need to know every remote network behind a core. It can simply use a default route that points toward the core, which then knows how to reach the rest of the network or the internet.

When Not to Use a Default Route

Default routes are very helpful, but they are not suitable for every router in every position.

Routers at the core of an internet service provider or a large enterprise backbone usually carry full or near full routing tables. These devices must know specific routes for all destinations they serve. Using a default route in the wrong place can cause unwanted traffic to be sent into a path that has no way to deliver it, which may create routing loops or black holes.

Default routes are most appropriate:

In complex core networks and at major internet exchange points, default routes are used more carefully and sometimes not at all.

Default Gateway vs Default Route

It is useful to keep the terms separate.

On a host, such as a workstation or server, the "default gateway" is the IP address of the local router interface inside the host's subnet. The host sends unknown network traffic to that IP address.

On a router, the "default route" is a routing table entry that identifies a next hop or interface to send unknown destinations toward.

Conceptually they do the same job, but the default gateway is configured on an end device, and the default route is configured on a router or learned via routing.

Summary of Key Ideas

A default route acts as a safety net in routing decisions. It matches any destination when the router does not have a more specific route, and it forwards that traffic to a chosen next hop. It is represented as 0.0.0.0/0 for IPv4 and ::/0 for IPv6. Static and dynamic methods can install default routes, and routers can even have multiple default routes with different preferences. Used correctly, default routes simplify routing tables and make edge devices easier to manage.

Views: 46

Comments

Please login to add a comment.

Don't have an account? Register now!