1. Gyanastra
  2. Computer Networks
  3. Routing Basics
  4. Default Router and Default Entry (0.0.0.0)
Free lesson, no account needed 5 min read 26 practice questions after it
Asked in past papers4 times
  • GATE CSE20082004
  • UGC NET20172009

Computer Networks · Routing Basics

Default Router and Default Entry (0.0.0.0)

Overview

A router's routing table holds only the networks it is directly connected to, so it needs a fallback for packets whose destination matches no entry.
That fallback is the default entry (0.0.0.0), which forwards such packets to a default router. This mechanism keeps routing tables small while still allowing every packet to leave the router.

Key concepts

  • Routing table: Every router maintains a routing table with three columns per row: Network ID, Subnet Mask, and Interface.
  • Default router: If a router receives a packet whose destination network does not match any entry in its routing table (i.e., the router is not directly connected to that network), the packet is forwarded to another router called the default router.
  • Default entry: The routing-table entry that points to the default router. It is written as Network ID = 0.0.0.0, Subnet Mask = 0.0.0.0, Interface = some interface (e.g., A).
  • Match rule: A packet matches an entry when (Destination IP) AND (Subnet Mask) equals the entry's Network ID; the packet is then sent out through that entry's interface.
  • One default router per router: Every router has exactly one specific router configured as its default router — "if we don't know where to send, send it through this."

How it works

  1. When a router receives a packet, it ANDs the destination address with the subnet mask of each entry. If the result matches the Network ID of that entry, the packet is sent out through that entry's interface.
  2. A router only maintains entries for the networks it is connected to (e.g., a router connected to three networks has entries only for those three). It does not maintain an entry for every network in the world.
  3. If a packet arrives whose destination is not present in any of the connected networks, the router uses the default entry and forwards the packet to another router (the default router).
  4. The default entry contains 0.0.0.0 as Network ID, 0.0.0.0 as Subnet Mask, and an interface (say A).
  5. Matching procedure: AND the packet's destination with each entry's mask — no match; try the next — no match; finally AND with the default entry's mask (0.0.0.0).
    Any number ANDed with zeros gives all zeros, which always matches the Network ID 0.0.0.0. Therefore, if no other route matches, the packet is by default sent to the default router.

Formulas

  • (Destination IP) AND (Subnet Mask) == Network ID → send out that entry's interface
  • (Destination IP) AND 0.0.0.0 = 0.0.0.0 → always matches the default entry (Network ID 0.0.0.0)

Worked examples

  • Guaranteed match: Suppose the routing table has several entries and none of them match the packet's destination.
    ANDing the destination with 0.0.0.0 yields 0.0.0.0, which equals the default entry's Network ID 0.0.0.0 — a guaranteed match. Hence the packet is forwarded out of interface A (the default router's interface).
  • Default router chain: Router 1's default router is Router 2; Router 2's default router is Router 3; Router 3's default router is Router 1.
    A packet arriving at Router 1 with no matching route is sent to Router 2; if Router 2 also has no matching route, it sends the packet to Router 3; if Router 3 also has no matching route, it sends the packet back to Router 1 — leading to an infinite loop.

Revision summary

  • Routing table columns: Network ID, Subnet Mask, Interface.
  • Match rule: (Destination IP) AND (Subnet Mask) == Network ID → send via that interface.
  • Default entry = 0.0.0.0 / 0.0.0.0 / interface; it always matches because any number AND 0 = 0.
  • Default router = the next-hop router used when no specific route matches.
  • A router keeps entries only for its connected networks, not for every network in the world.
  • Each router has one default router; chained default routers can cause an infinite loop (this motivates the need for a mechanism like TTL).

Previous-year exam insights

  • Longest-prefix match: when several entries match a destination, the router forwards via the entry with the longest (most specific) subnet mask; the default route /0 is the shortest prefix and is used only if nothing else matches.
    Asked inGATE 2004
  • To choose a host's default gateway, the gateway must be a router interface on the same subnet as the host (same network after ANDing with the netmask); a router interface on a different subnet cannot serve as the gateway.
    Asked inGATE 2008
  • A host sends a packet to its default gateway whenever the destination IP is outside its own subnet (destination AND netmask differs from its own network address); within the subnet it uses ARP and sends directly.
    Asked inUGC NET 2017
  • A /32 (255.255.255.255) entry is a host-specific route and matches exactly one destination address; it beats any network-prefix route for that address.
    Asked inGATE 2004
  • The default route is written as 0.0.0.0/0 (network 0.0.0.0, mask 0.0.0.0); it matches every destination because ANDing with an all-zero mask always yields 0.0.0.0.
  • Routing is hop-by-hop: each router independently applies its own table and match rule; the destination IP never changes, only the next-hop link-layer address does.
Pages 1–2 of 2