Lesson

Routers, Default Gateways and Network Boundaries

Learning objective

Decide whether a destination is local or remote and identify the first next hop.

A host does not send every packet in the same way. Before any frame leaves its interface, the host must decide whether the destination is reachable on the local link or whether a router must carry the packet across a network boundary.

Why network boundaries matter

A subnet boundary separates one IP network from another. Hosts within the same local network can exchange frames directly. A destination outside that network needs a router. This choice affects the route, outgoing interface, next IP hop, and MAC address used in the first frame.

Think of an apartment building: a message for another apartment stays inside the building, while a parcel for another street first goes to the building's exit. The exit matters, but it is not the parcel's final destination.

What a router does

A router connects IP networks. It receives an eligible packet, consults its routing information, decreases the packet's TTL, and sends a newly framed copy through another interface. It does not simply repeat the incoming Ethernet frame.

Ordinary Layer 2 broadcasts stop at the router boundary. Specially configured relay functions are different from forwarding every local broadcast by default.

Local or remote?

The host compares the destination with its own address using the prefix configured on its interface. The host applies its configured prefix; matching the first three octets is not a general subnet rule. For example, a /20 can include addresses whose third octets differ.

  1. Read the source IP address and its configured prefix.
  2. Apply that prefix to the destination address.
  3. If the network portions match, use direct delivery.
  4. Otherwise, find the most specific matching route, often the default route.
  5. Select that route's outgoing interface and local next hop.

ARP answers only the local IPv4 next-hop question. It does not discover a remote host through a router and it does not replace a missing route.

The default gateway

The default gateway is normally a router interface that the host can reach on its local link. A default route is used only when no more-specific route matches. The gateway becomes the first IP next hop for remote traffic—not the packet's final destination.

If the configured gateway is outside every usable on-link network, the host cannot normally reach it. A gateway setting alone does not make that address local.

Direct delivery and routed delivery

How a host prepares its first transmission
QuestionDirect deliveryRouted deliveryNo route
Where is the destination?On the local networkBeyond the local networkBeyond every known route
First IP next hopThe destination itselfThe selected gatewayNone
First frame targetsDestination interface MACGateway interface MACNo frame can be prepared
Packet destination IPDestination hostRemote destination hostKnown, but unreachable

For a remote destination, the packet keeps the remote destination IP address while the first Ethernet frame targets the gateway's MAC address. This example does not use NAT.

What changes at each hop

At a router, the incoming Layer 2 frame ends. The router processes the IP packet, decreases TTL, selects an outgoing route, and creates a new Layer 2 frame for the next link. MAC addresses change hop by hop. Without NAT, the source and destination IP addresses identify the same endpoints.

The gateway's MAC address can therefore be the first frame's destination even though the gateway's IP address is not the packet's final destination.

Interactive route-decision player

Choose a scenario and predict whether the host sends directly, uses its gateway, has no route, or stops a local broadcast at the router boundary.

Make the host's route decision

Change the destination and watch the route, next hop, first frame, and boundary action update together.

Choose a route decision scenario

Ethernet frame

Source MAC
02:00:00:00:02:10
Destination MAC
02:00:00:00:02:44

IP packet

Source IP
192.0.2.10
Destination IP
192.0.2.44
TTL
64

Application data

Message
Hello server

Stage 1 of 3

Build the packet at the source

The application data is wrapped in an IP packet and then an Ethernet frame.

Decision

On-link

Outgoing interface

Ethernet 0

Next hop

192.0.2.44

First frame

Destination host

Boundary action

Direct delivery

Explanation depth

The destination is on the same local network, so the host sends directly to it.

Free account

Continue this lesson for free

Unlock the remaining explanation, Wireshark checks, quizzes, interview answers, and saved progress. No payment required.

Continue with Google or email
Routers and Default Gateways Basics