Week 6 · Lesson 8

Network Layer & IPv4 — Gateways and Delivery

How does a host know where to send a packet? It performs one simple test — a bitwise AND — and that single decision separates local delivery from remote delivery. This lesson shows the test, the ARP that follows, and the full hop-by-hop timeline.

CCNA 200-301 IPv4 Addressing & Routing Verified 2026-10-11
Part 1

The default gateway

A host on a network can reach devices on its own subnet easily: it just sends a frame directly on the local link. But what about a server on a different network, or on the Internet? The host cannot put that traffic directly on the wire, because the destination is not reachable locally.

The answer is the default gateway: the router interface that connects the host’s local network to all other networks. A host is configured with three things:

Two rules are essential and tested:

  1. The default gateway must be a router interface on the same subnet as the host. If it is not reachable on the local link, the host cannot use it.
  2. Every host that needs to reach other networks needs a gateway. Without one, the host can talk only to its own subnet.
Definition — default gateway. The router (on the host’s own subnet) to which a host sends any packet whose destination is not on the local network. The host must be able to reach it on the local link.

On a typical home network the gateway is the router’s LAN address, such as 192.168.1.1, and hosts are 192.168.1.10, .11, and so on. The router then forwards traffic toward the Internet.

Part 2

Local or remote? The AND test

How does a host decide whether a destination is local or remote? It compares the network portion of the destination with its own, using the subnet mask. The method is a bitwise AND. A host does two ANDs:

The AND test. 1. Own network = (my IP) AND (my mask).
2. Destination network = (destination IP) AND (my mask).
If the two results are equal → the destination is LOCAL.
If the two results differ → the destination is REMOTE.

When two IPs, ANDed with the same mask, yield the same network number, they are on the same subnet. When the network numbers differ, the destination is on a different subnet and must be reached through the gateway.

Worked example. Host: 192.168.1.10, mask 255.255.255.0 (/24). The host’s own network is 192.168.1.0.

This test is the host’s entire routing decision. If the destination is local, send directly. If it is remote, hand the packet to the default gateway and let the router deal with it.

Exam tip. The host uses its own mask for both ANDs. If the two network numbers match, the destination is on-link. A wrong or missing mask makes a host think a local device is remote (or vice versa) — a very common connectivity fault.
Run the AND test · type a host, mask and destination

Part 3

What the host ARPs for

Once the host decides local or remote, it must build a Layer 2 frame, which needs a destination MAC address. It learns that MAC with ARP (Address Resolution Protocol, RFC 826). The crucial detail is what it ARPs for:

CaseWhat the host ARPs forFrame sent to
LOCAL destinationThe MAC of the destination host itselfThe destination host, directly on the local link
REMOTE destinationThe MAC of the default gatewayThe gateway router (the destination IP is still the remote host)

The counter-intuitive part: when the destination is remote, the host never ARPs for the remote host. It cannot — ARP only works on the local link, and the remote host is not there. So the host ARPs for its gateway’s MAC and builds a frame addressed, at Layer 2, to the router. The packet’s destination IP remains the remote host; only the frame’s destination MAC is the gateway.

Exam tip. For an off-net destination, the frame’s destination MAC is the default gateway, not the final server. A question that shows a host framing traffic for a distant server and gets the destination MAC “wrong” is testing exactly this.
What does the host ARP for? · pick the case

Part 4

A packet to an off-site server

Now follow a real example. Host A (192.168.1.10, MAC AA) sends to a server (10.0.0.20, MAC SRV) on a different network. The router has two interfaces: G0/0 = 192.168.1.1 (MAC R1) and G0/1 = 10.0.0.1 (MAC R2).

  1. Build the packet. Data is encapsulated up the stack. The IP header has source 192.168.1.10 and destination 10.0.0.20.
  2. AND test. Destination 10.0.0.20 is not in 192.168.1.0/24 → REMOTE → use the gateway.
  3. ARP for the gateway. Host A sends an ARP request for 192.168.1.1; the router replies with its MAC R1.
  4. Frame 1. Host A builds an Ethernet frame: source MAC AA, destination MAC R1. Source IP 192.168.1.10, destination IP 10.0.0.20. Sent to the router.
  5. Router decides. The router de-encapsulates the frame, reads the IP destination 10.0.0.20, and consults its routing table. It finds 10.0.0.0/24 is reachable out G0/1.
  6. ARP for the server. The router ARPs for 10.0.0.20 on the second LAN (or uses its cache) and learns MAC SRV.
  7. Frame 2. The router builds a brand-new Ethernet frame: source MAC R2, destination MAC SRV. The IP header is untouched — source 192.168.1.10, destination 10.0.0.20.
  8. Server receives it. Server sees a frame to its own MAC, de-encapsulates, and finds an IP packet addressed to itself.
The golden rule. Across the whole journey the IP addresses never change (barring NAT), but the MAC addresses are rewritten at every router hop. Each hop is a fresh, local delivery between two devices on the same link.
The journey · step through
Step 1 of 8
1

Part 5

The router rewrites the frame

The figure shows both frames for the same packet. Notice the frame changes; the packet does not.

One IP packet, two different frames Source IP 192.168.1.10 → Destination IP 10.0.0.20 (unchanged end to end) Host A 192.168.1.10 Router G0/0 192.168.1.1 G0/1 10.0.0.1 Server 10.0.0.20 LAN A (192.168.1.0/24) LAN B (10.0.0.0/24) Frame 1 · on LAN A SRC MAC = Host A → DST MAC = G0/0 Frame 2 · on LAN B SRC MAC = G0/1 → DST MAC = Server MAC addresses are rewritten at every router hop; IP addresses are not.
One packet, two frames · select a hop

Part 6

Media independence of IP

One of the network layer’s greatest strengths is that it does not care how a link carries bits. IP is media independent: the same IP packet can be carried over any Layer 2 technology, because each link builds its own frame around the packet.

Each of these has a different frame format and a different maximum frame size, yet the IP packet inside is identical. That is why a packet can start on Wi-Fi at your home, cross fibre in an ISP backbone, and arrive over Ethernet at a data centre. The network layer provides a common language that lets different physical networks interoperate — the property that makes the Internet a network of networks.

It also means the network layer is connectionless, best-effort in IP’s core design: it does not guarantee delivery, ordering, or error recovery. Those are left to higher layers (TCP), while IP simply makes the best effort to move each packet hop by hop.

Common pitfalls

Part 7 · Your turn

Review

Check what you have learned with these review questions.

Review · 6 questions

Sources

Sources & references

  1. Braden, R. RFC 1122: Requirements for Internet Hosts — Communication Layers (1989). Subnet masks, local vs. remote delivery, and default gateway behaviour. rfc-editor.org/rfc/rfc1122.
  2. Plummer, D. RFC 826: An Ethernet Address Resolution Protocol (1982). rfc-editor.org/rfc/rfc826.
  3. Cisco. CCNA (200-301) Exam Topics, IP Connectivity and IPv4 Addressing. cisco.com.

Target exams: CCNA 200-301 v1.1 · CyberOps Associate 200-201. Last content verification: 2026-10-11.