Course contents

Unit 5: IP Addressing BasicsLesson 5.4 (4 of 6 in this unit)44 of 104 in the Network Fundamentals course

The Default Gateway

Why can your PC open a nearby shared folder while every remote website fails? Let's follow its default gateway and separate the next receiver from the final destination.

Beginner · 16 min read · Before this: What is an IP address?, Subnet mask basics, MAC addresses

You'll learn to predict, for any destination, whether a PC sends its frame straight to that device or to its default gateway, and which MAC and IP addresses the frame carries.

Who takes the packet beyond the local network?

PC-A is 192.168.10.10/24. PC-B at 192.168.10.20 is its local neighbour. A web server at 203.0.113.20 is remote. The switch can carry a frame between local devices, but PC-A needs a router to continue towards the web server.

The default gateway is the next-hop router used by a device's default route when no more specific route matches the destination. On this ordinary IPv4 LAN, it is configured as the address of a router interface on the device's own subnet. It is the device's "way out" of the local network. On a home network it is usually the home router, often at an address like 192.168.1.1.

It is called "default" because the device uses it whenever it has no more specific route. Most PCs know only two things: their own subnet, and the gateway for everything else.

The gateway is the next receiver of the frame; the remote server remains the destination of the IP packet. Learning the gateway's address does not replace the server's address.

Why a PC can't reach other subnets on its own

Diagram
The frame goes to R1; the packet is for the server
The frame goes to R1; the packet is for the server
The frame goes to R1; the packet is for the serverPC-A at 192.168.10.10/24 and PC-B at 192.168.10.20/24 connect to SW1. SW1 connects to router R1 Gi0/0 at 192.168.10.1/24. R1 Gi0/1 at 203.0.113.1/24 connects to a server at 203.0.113.20/24. Local delivery stays within the left LAN; remote delivery uses R1. Port labels sit beside their link ends.Local LAN · 192.168.10.0/24203.0.113.0/24PC-APC-BSW1R1ServerEth0 → Gi0/1Eth0 → Gi0/2Gi0/24Gi0/0Gi0/1Eth0192.168.10.10/24192.168.10.20/24192.168.10.1/24203.0.113.1/24203.0.113.20/24Ethernet destination: R1 Gi0/0 MAC addressIP destination: 203.0.113.20, unchanged by routing in this lab

On small screens, swipe sideways or focus the diagram and use the arrow keys.

A deliberately small routed lab: the documentation subnet represents the remote server network. R1 routes without NAT here; both endpoints have return routes through R1.

Read this figure from PC-A towards the server. The server's 203.0.113.20 address is outside PC-A's /24, so PC-A selects the default route through 192.168.10.1. If the gateway is not already in its ARP cache, PC-A first asks for that gateway's MAC address. It does not ask for the remote server's MAC address.

The resulting Ethernet frame is addressed to R1's Gi0/0 interface. Inside it, the IP packet is still addressed to the server. R1 removes the incoming Ethernet header, looks up the server's destination in its routing table, and sends a new frame from Gi0/1. This small lab has the server directly attached to that second interface, so R1 can resolve the server's MAC there. A larger network may use another router as the next hop instead.

For the reply to work, the server also needs a route back to PC-A; its gateway in this lab is 203.0.113.1. These are documentation addresses in an isolated teaching network, not a real public service. There is no NAT in this figure: routing between subnets and translating addresses are separate operations.

On its own, a PC connected to a switch can only deliver frames to devices on its own local network. In a simple LAN like this one, that local network is one subnet (a range of IP addresses) and one broadcast domain (the devices that receive its broadcasts). The two usually match, but they are different ideas: a subnet is about addressing, a broadcast domain is about which devices a broadcast reaches. Two facts make a gateway necessary:

  • Switches don't move traffic between subnets. A Layer 2 switch forwards frames by MAC address inside one network. It does not use IP addresses to decide where to send a frame. (A Layer 3 switch can also route, which is why it can be a gateway, as the table below shows.)
  • ARP doesn't cross a router. To send a frame, a PC must learn the receiver's MAC address with an ARP broadcast, and routers don't forward ARP broadcasts. So a PC normally can't learn the MAC address of a server in another network. (The exception is proxy ARP, where a router answers on the server's behalf; the ARP lesson covers it.)

So the PC needs a device on its own subnet that is also connected to other networks and knows how to forward packets between them. That device is a router, and the address of its interface on your subnet is your default gateway. With no default route or other suitable route, a PC can reach its local neighbours but has no route to a remote destination.

One router interface in each subnet

In Figure 1, R1's G0/0 interface is 192.168.10.1/24. G0/0 means a Gigabit Ethernet interface named 0/0 on this example router. PC-A and PC-B use it as their gateway. The server address is a documentation example, not a live target to test; the cloud represents provider routers omitted from the drawing.

Diagram
The gateway is the router interface on your subnet
The gateway is the router interface on your subnet
192.168.10.0/24PC-AIP 192.168.10.10/24PC-BIP 192.168.10.20/24SwitchRouter R1G0/0 = 192.168.10.1InternetWeb serverIP 203.0.113.20

Device key: PC-A (laptop) · PC-B (computer)

Lines show the example’s network connections. Thick links: uplinks/WAN, as labelled. The coloured path and envelope follow the current step; its text identifies the sender, receiver and traffic type.

Reading the addresses

IP labels identify interfaces or destinations. Subnet labels identify networks; /n is the prefix length. A router ID (RID) identifies a routing process and need not be a reachable interface.

An IP address alone is not a URL. A web URL includes a scheme such as https://; an address on a router or printer does not imply a website.

  • PC-A: IP 192.168.10.10/24
  • PC-B: IP 192.168.10.20/24
  • Router R1: G0/0 = 192.168.10.1
  • Web server: IP 203.0.113.20
  1. 1. Local traffic skips the gateway. Traffic from PC-A to PC-B stays inside 192.168.10.0/24. The switch delivers it to PC-B; the router is not involved.
  2. 2. Remote traffic goes to the gateway. PC-A sends the packet for the web server to 192.168.10.1, the router's interface on its own subnet.
  3. 3. The router takes it from there. R1 looks up 203.0.113.20 in its routing table and forwards the packet towards the internet.
  4. 4. In this topology, replies come back the same way. The reply reaches R1, which delivers it directly to PC-A on the 192.168.10.0/24 subnet. Here R1 is the only way in, so the return path matches; in networks with several routers or links, replies can take a different path (asymmetric routing).
Figure 1. PC-A and PC-B share one subnet. The router interface 192.168.10.1 is their default gateway.

Several kinds of device can act as the gateway:

Diagram
One router interface in each subnet
One router interface in each subnet
WhereTypical gateway deviceTypical address
HomeHome router (router + switch + Wi-Fi + NAT in one box)192.168.1.1 or 192.168.0.1
Small officeA router or a firewallOften .1 or .254 of the subnet
Larger officeA Layer 3 switch with one interface per VLANOne gateway address in every VLAN
Cloud networkA virtual router provided by the cloudUsually the first usable address (.1) of the subnet
Read each row across: the left box names the item, the others describe it.

Gateway IP, gateway MAC and the default route

Gateway IP address

Typed in or learned from DHCP, for example 192.168.10.1. It must be inside the host's own subnet, or the host can't reach it.

Gateway MAC address

Learned with ARP the first time it is needed, then kept in the ARP cache. This is the address that goes into the frame.

Default route

Inside the host, the gateway setting becomes a route for 0.0.0.0/0: “send anything I have no better route for via 192.168.10.1”.

The router interface

The gateway is not a whole router; it is one router interface that sits in your subnet. Each subnet has its own gateway address.

A PC gets its gateway either from DHCP (the "router" option, which is how almost all laptops and phones get it) or from a static setting entered by an administrator.

How a PC decides: local or remote?

Before it sends a packet, the PC makes the same decision every time. It uses its own IP address and its subnet mask. In this example, PC-A has:

IP address192.168.10.10
Subnet mask255.255.255.0 (/24)
Default gateway192.168.10.1
Diagram
Process, step by step
1. Work out my own network
My address 192.168.10.10 with mask /24 → my network is 192.168.10.0. (Keep the octets where the mask is 255; set the rest to 0.)
2. Work out the destination's network, using MY mask
Destination 203.0.113.20 with /24 → 203.0.113.0.
3. Compare
192.168.10.0 vs 203.0.113.0 → different.
4a. Same network → local delivery
Find the destination's own MAC address with ARP and send the frame straight to it.
4b. Different network → remote delivery
Find the gateway's MAC address with ARP and send the frame to the gateway. The packet inside is still addressed to 203.0.113.20.

Read in arrow direction. Labels describe each stage or hop; connectors show the sequence, not a complete physical cabling plan or time to scale.

Figure 2. The local-or-remote decision. It happens on the sending PC; the switches and the destination are not involved.

Four destinations seen from PC-A

PC-A 192.168.10.10/24
192
168
10
10
Destination PC-B 192.168.10.20
192
168
10
20
Subnet mask 255.255.255.0 (/24)
255
255
255
0
Network part (24 bits) Host part (8 bits)
192.168.10.0 vs. 192.168.10.0: same network, so same subnet (deliver directly)
Figure 3. Network parts match: PC-B is local. No gateway needed.
PC-A 192.168.10.10/24
192
168
10
10
Destination web server 203.0.113.20
203
0
113
20
Subnet mask 255.255.255.0 (/24)
255
255
255
0
Network part (24 bits) Host part (8 bits)
192.168.10.0 vs. 203.0.113.0: different networks (send to the default gateway)
Figure 4. Network parts differ: the web server is remote, so the packet goes to the gateway.
DestinationWhat it isCompare (/24)PC-A's decision
192.168.10.20PC-B, same room192.168.10 = 192.168.10Local: send directly to PC-B
192.168.10.1The gateway itself192.168.10 = 192.168.10Local: send directly to the router
192.168.20.5File server, other floor192.168.10 ≠ 192.168.20Remote: send to the gateway
203.0.113.20Web server on the internet192.168.10 ≠ 203.0.113Remote: send to the gateway

How the PC really does it: the routing table. The comparison above is the simple version. Technically, the PC looks the destination up in its own routing table, which holds two routes:

Diagram
Four destinations seen from PC-A
Four destinations seen from PC-A
RouteMeansMatches 192.168.10.20?Matches 203.0.113.20?
192.168.10.0/24 on-linkDeliver directlyYes (24 bits match)No
0.0.0.0/0 via 192.168.10.1Default route: send to the gatewayYes (0 bits to match)Yes
Read each row across: the left box names the item, the others describe it.

When several routes match, the one with the longest prefix (the most matching bits) wins. For 192.168.10.20 the /24 beats the /0, so delivery is direct. For 203.0.113.20 only the default route matches, so the packet goes to the gateway. Routers use exactly the same rule, with many more routes.

Why remote traffic goes to the gateway

The PC can't send a frame straight to 203.0.113.20, because it can't learn that server's MAC address: its ARP broadcast would never leave the local subnet. Even if it could, a MAC address is only useful on one local link. So the PC does the only thing it can: it hands the packet to a device on its own link that can move it further. The router accepts the frame (because it is addressed to the router's MAC address), removes the Ethernet header, reads the destination IP address and forwards the packet towards its destination in a new frame.

The local frame and the remote frame side by side

This is the most important idea in this lesson. Compare the frame that PC-A sends to a local neighbour with the frame it sends to a remote server. This lesson uses these addresses:

Diagram
The local frame and the remote frame side by side
The local frame and the remote frame side by side
DeviceIP addressMAC address
PC-A192.168.10.1002:00:00:00:00:aa
PC-B192.168.10.2002:00:00:00:00:bb
Gateway (R1 G0/0)192.168.10.102:00:00:00:00:01
Web server203.0.113.20Unknown to PC-A, and not needed
Read each row across: the left box names the item, the others describe it.

Local: PC-A → PC-B

Destination is on 192.168.10.0/24

Layer 2 · Ethernet header (this hop)
Destination MAC
02:00:00:00:00:bb
PC-B
Source MAC
02:00:00:00:00:aa
PC-A
EtherType
0x0800
IPv4 inside
Layer 3 · IP header (end to end)
Source IP
192.168.10.10
PC-A
Destination IP
192.168.10.20
PC-B
Data (for example TCP/UDP + application data)

Remote: PC-A → web server

Destination is NOT on 192.168.10.0/24

Layer 2 · Ethernet header (this hop)
Destination MAC
02:00:00:00:00:01
the gateway!
Source MAC
02:00:00:00:00:aa
PC-A
EtherType
0x0800
IPv4 inside
Layer 3 · IP header (end to end)
Source IP
192.168.10.10
PC-A
Destination IP
203.0.113.20
the web server
Data (for example TCP/UDP + application data)

In the remote frame, the two layers point at different devices. The destination MAC says "this frame is for the gateway"; the destination IP says "this packet is for the web server". The gateway's IP address 192.168.10.1 appears nowhere in the frame or the packet. The PC only uses it to look up the gateway's MAC address with ARP.

Try it: follow one packet

Pick a destination and watch every frame PC-A sends. The panel under the diagram shows the two sets of addresses for each step: the frame (MAC addresses, valid for one link) and the packet (IP addresses, end to end).

Diagram
Local versus remote delivery from PC-A
Local versus remote delivery from PC-A
Where does PC-A send it?
192.168.10.0/24PC-AIP 192.168.10.10/24PC-BIP 192.168.10.20/24SwitchRouter R1G0/0 = 192.168.10.1InternetWeb serverIP 203.0.113.20Frame–Packet–

Device key: PC-A (laptop) · PC-B (computer)

Lines show the example’s network connections. Thick links: uplinks/WAN, as labelled. The coloured path and envelope follow the current step; its text identifies the sender, receiver and traffic type.

Reading the addresses

IP labels identify interfaces or destinations. Subnet labels identify networks; /n is the prefix length. A router ID (RID) identifies a routing process and need not be a reachable interface.

An IP address alone is not a URL. A web URL includes a scheme such as https://; an address on a router or printer does not imply a website.

MAC addresses identify link-layer interfaces or destination groups. They are not IP addresses or website URLs.

  • PC-A: IP 192.168.10.10/24
  • PC-B: IP 192.168.10.20/24
  • Router R1: G0/0 = 192.168.10.1
  • Web server: IP 203.0.113.20

Tip: click or tap a device to see its details.

  1. 1. Decide: 192.168.10.20 is in PC-A's own network 192.168.10.0/24, so PC-A delivers it directly. The gateway is not used.
  2. 2. ARP request: PC-A broadcasts: who has 192.168.10.20? Every device on the subnet receives it; only PC-B answers.
  3. 3. ARP reply: PC-B answers with its MAC address. PC-A stores it in its ARP cache.
  4. 4. Frame to PC-B: The MAC and IP destinations are both PC-B. The switch forwards the frame out of PC-B's port only; R1 does not receive it.
  5. 5. Reply: PC-B answers straight back. It learned PC-A's MAC address from the ARP request, so it needs no ARP of its own.
Figure 5. PC-A uses ARP only for addresses on its own link. If the MAC address is already in its ARP cache, it skips the two ARP steps.

Later lessons follow this exact journey again, hop by hop.

Learn more: ARP for Local and Remote DestinationsDifferent-Subnet Communication

Opening a website from a home laptop

  1. Your laptop (192.168.1.10/24) got its settings from the home router by DHCP, including the gateway 192.168.1.1.
  2. You open a website. DNS returns its address, 203.0.113.20.
  3. The laptop compares the network parts: 192.168.1 ≠ 203.0.113, so the site is remote.
  4. It already has the router's MAC address in its ARP cache, so it sends the frame straight to the router.
  5. The home router translates the source address with NAT and sends the packet to the internet provider.
  6. The reply comes back to the router, which reverses the NAT translation and delivers it to the laptop on the local subnet. (Here it must come back through the same router, because that router holds the NAT translation. In networks with several exits, return traffic can take a different path, which is called asymmetric routing.)

Even the DNS query in step 2 goes through the gateway if the DNS server is outside the local subnet. Almost everything a laptop does online passes through the default gateway.

What happens when the gateway is wrong or missing

A gateway problem has a very typical signature: local devices work, everything else fails. Here are the common cases for PC-A:

Diagram
What happens when the gateway is wrong or missing
What happens when the gateway is wrong or missing
ProblemExample settingWhat happens
No gateway(blank)PC-A has no default route, so remote destinations fail immediately. Windows ping shows "transmit failed. General failure"; Linux shows "Network is unreachable".
Gateway address nobody uses192.168.10.99PC-A sends an ARP request for .99 and gets no reply. Remote pings report "Destination host unreachable" from PC-A's own address.
Gateway is another PC192.168.10.20 (PC-B)ARP works, so frames go to PC-B. PC-B is not a router, so it normally drops them. Remote traffic simply times out.
Gateway in a different subnet192.168.20.1PC-A can't reach it directly. Most systems warn you or refuse the setting; if it is accepted, remote traffic fails.
Correct gateway, but the router is down192.168.10.1The same as an unused address: no ARP reply and no ping reply. Every PC on the subnet loses access to other networks at once.
Read each row across: the left box names the item, the others describe it.

In practice, wrong gateways turn up most on devices with static addresses (printers, cameras, servers) after a subnet is renumbered or a device is moved. DHCP clients pick up the new gateway by themselves; static ones keep the old setting until someone changes it.

Diagram
Wrong gateway: local works, remote fails
Wrong gateway: local works, remote fails
PC-Agateway set to .99 ✗PC-BIP 192.168.10.20SwitchRouter R1IP 192.168.10.1Web serverIP 203.0.113.20

Device key: PC-A (laptop) · PC-B (computer)

Lines show the example’s network connections. Thick links: uplinks/WAN, as labelled. The coloured path and envelope follow the current step; its text identifies the sender, receiver and traffic type.

Reading the addresses

IP labels identify interfaces or destinations. Subnet labels identify networks; /n is the prefix length. A router ID (RID) identifies a routing process and need not be a reachable interface.

An IP address alone is not a URL. A web URL includes a scheme such as https://; an address on a router or printer does not imply a website.

  • PC-A: gateway set to .99 ✗
  • PC-B: IP 192.168.10.20
  • Router R1: IP 192.168.10.1
  • Web server: IP 203.0.113.20
  1. 1. Local still works. PC-B is on the same subnet, so the gateway setting is not used.
  2. 2. PC-A asks for the wrong gateway. To reach the web server, PC-A sends an ARP request for 192.168.10.99. Every device receives it, but nobody has that address.
  3. 3. No MAC, no frame. With no ARP reply, PC-A can't build the frame. Ping reports “Destination host unreachable”, and the router never even receives the packet.
Figure 6. A gateway problem normally affects only traffic to other networks; same-subnet traffic keeps working. That pattern points to the gateway.

Reading the gateway from ipconfig and ip route

Windows

Example output from a Windows PC, shortened and written for this lesson
C:\> ipconfig
Ethernet adapter Ethernet:

   IPv4 Address. . . . . . . . . . . : 192.168.10.10
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.10.1
What to look for: check three things on the Default Gateway line. It is filled in, it is inside your subnet (192.168.10.x here, given the 255.255.255.0 mask), and it is not your own address.
Example output from a Windows PC, shortened and written for this lesson
C:\> route print -4
IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0     192.168.10.1    192.168.10.10     25
        127.0.0.0        255.0.0.0         On-link         127.0.0.1    331
     192.168.10.0    255.255.255.0         On-link     192.168.10.10    281
    192.168.10.10  255.255.255.255         On-link     192.168.10.10    281
   192.168.10.255  255.255.255.255         On-link     192.168.10.10    281
===========================================================================
What to look for: the line with destination 0.0.0.0 and netmask 0.0.0.0 is the default route, created from the gateway setting; its Gateway column shows 192.168.10.1. On-link means "deliver directly", so 192.168.10.0 / 255.255.255.0 On-link is the local subnet.
Example output from a Windows PC, written for this lesson
C:\> ping 192.168.10.1
Pinging 192.168.10.1 with 32 bytes of data:
Reply from 192.168.10.1: bytes=32 time<1ms TTL=255
Reply from 192.168.10.1: bytes=32 time<1ms TTL=255
Reply from 192.168.10.1: bytes=32 time<1ms TTL=255
Reply from 192.168.10.1: bytes=32 time<1ms TTL=255

Ping statistics for 192.168.10.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss)
What to look for: four Reply from 192.168.10.1 lines and 0% loss mean the path from your PC to the router is working. Some routers and firewalls block ping, so no reply is a clue, not proof that the gateway is down.
Example output from a Windows PC with its gateway set to an unused address, written for this lesson
C:\> ping 203.0.113.20
Pinging 203.0.113.20 with 32 bytes of data:
Reply from 192.168.10.10: Destination host unreachable.
Reply from 192.168.10.10: Destination host unreachable.
Reply from 192.168.10.10: Destination host unreachable.
Reply from 192.168.10.10: Destination host unreachable.
What to look for: the "reply" comes from PC-A's own address, 192.168.10.10. The PC is telling you it couldn't find the next hop's MAC address with ARP. That points to a wrong gateway setting or a gateway that is down.

Linux route checks, with macOS alternatives

Example output from a Linux PC, written for this lesson
$ ip route
default via 192.168.10.1 dev eth0 proto dhcp metric 100
192.168.10.0/24 dev eth0 proto kernel scope link src 192.168.10.10 metric 100
What to look for: the default via 192.168.10.1 line is the default route, so 192.168.10.1 is the gateway. proto dhcp shows it was learned from DHCP. The second line is the local subnet. On macOS, use netstat -rn or route -n get default.
Example output from a Linux PC, written for this lesson
$ ip route get 203.0.113.20
203.0.113.20 via 192.168.10.1 dev eth0 src 192.168.10.10 uid 1000
    cache
This command asks Linux directly how it would reach an address. What to look for: via 192.168.10.1 means "remote, through the gateway". For a local address such as 192.168.10.20, the answer has no via: 192.168.10.20 dev eth0 src 192.168.10.10.

Working outwards from the PC

Diagram
Process, step by step
1. ipconfig / ip route: is a gateway set, and is it in my subnet?
Blank or in another subnet → fix the setting or check DHCP.
2. Ping a neighbour on the same subnet
This fails too → not a gateway problem; check the cable, Wi-Fi or IP settings first.
3. Ping the gateway
No reply → wrong address, router down or ping blocked.
4. arp -a: is there an entry for the gateway?
Missing or incomplete → ARP for the gateway is failing.
5. Ping a public address, then a name
IP works but names don't → a DNS problem, not a gateway problem.

Read in arrow direction. Labels describe each stage or hop; connectors show the sequence, not a complete physical cabling plan or time to scale.

Figure 7. Work outwards from the PC: local network first, then the gateway, then beyond.

The troubleshooting unit and the command guides give you more practice.

Learn more: IP and Gateway ProblemsEssential Windows Network CommandsEssential Linux Network Commands

Gateway mistakes that look like an internet outage

  • Thinking the destination IP becomes the gateway's IP. It doesn't. Only the destination MAC address points at the gateway.
  • Putting the gateway in a different subnet from the PC. The PC can't reach it with ARP. This often happens after copying settings from another office.
  • Setting a server's gateway to its own address. A server is not a router, so remote traffic has nowhere to go.
  • Blaming the gateway when local traffic also fails. If PC-B is unreachable too, check the cable, the switch or the IP address first.
  • Setting default gateways on two adapters. The PC chooses one by metric, and traffic can leave through the wrong interface.
  • Assuming the gateway is always .1. It is only a convention, so check the real setting.
The gateway in five rules
  • The default gateway is the next-hop router used when no more specific route matches. It also needs a usable onward route.
  • The PC uses its subnet mask to compare network parts: same → deliver directly; different → send to the gateway.
  • For remote traffic: destination MAC = gateway, destination IP = the remote host.
  • For a remote destination, the PC uses ARP to find the gateway's MAC address, not the remote host's.
  • Local works and remote fails: investigate the gateway and routing, then DNS and the remote service. This symptom alone does not identify the failed component.

The shared folder works, but no website loads

A user at 192.168.10.37 reports: "I can open the shared folder on PC-B, but no website loads." You ask them to run ipconfig:

Example output from a Windows PC, shortened and written for this lesson
C:\> ipconfig
Ethernet adapter Ethernet:

   IPv4 Address. . . . . . . . . . . : 192.168.10.37
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.1.1
Before reading on, find the problem yourself, then answer the first question below.

Short lab: follow the selected next hop

Use your own PC and addresses. Reading a routing table does not change it. Do not set your adapter to the example IPs on a live network.

  1. On Windows, run ipconfig and route print -4. Find the active adapter and compare its gateway with the route whose destination and mask are both 0.0.0.0.
  2. Predict the frame destination for a local host and a remote host. For remote traffic using the default route, the Ethernet destination is the gateway's MAC address.
  3. Use ping <your-gateway-address> and inspect arp -a. An ARP entry confirms a local address mapping; a ping reply confirms an ICMP (Internet Control Message Protocol) response. Neither alone proves that a remote website works.
  4. On Linux, run ip route get <destination-address>. Read via as the next hop, dev as the outgoing interface and src as the chosen source address. Replace the bracketed text with an address relevant to your network.

A single gateway keeps host configuration simple, but it can be a point of failure. Larger networks can provide a shared virtual gateway backed by two routers. The PC still uses one address while the routers manage failover. That is a later topic, not something this lab assumes.

Test yourself on gateways and frames

Predict · scenario 1

In the ipconfig output above, what is wrong?

Predict · scenario 2

PC-A (192.168.10.10/24, gateway 192.168.10.1) sends a packet to 203.0.113.20. What is the destination MAC address of the frame it sends?

Predict · scenario 3

PC-A sends a packet to 203.0.113.20 through the gateway. What is the destination IP address in the packet?

Predict · scenario 4

A ping to 203.0.113.20 shows "Reply from 192.168.10.10: Destination host unreachable." (192.168.10.10 is the PC itself). What does this tell you?

Predict · scenario 5

PC-A's gateway is set to 192.168.10.20, which is PC-B (an ordinary PC). What happens to traffic for the internet?

To see how a device turns the gateway's IP address into a MAC address, continue with ARP.

Learn more: ARP Fundamentals

Technical references

The host forwarding model follows RFC 1122, section 3.3.1. Windows configuration output follows Microsoft ipconfig documentation. Outputs are teaching examples rather than a report of your network.

FAQ

Is the default gateway the same as my router?
Almost. The default gateway is the IP address of one router interface on your subnet. At home, the router has only one inside network, so people use the two words for the same thing. In an office, one router may be the gateway for many subnets, with a different gateway address in each one.
Can two devices on the same subnet talk without a gateway?
Yes. Same-subnet traffic goes directly from host to host through the switch, using ARP to find the other device's MAC address. The gateway is only used for destinations on other subnets.
Does the destination IP change to the gateway's IP?
No. The destination IP address stays the remote host's address for the whole trip (unless NAT changes it). Only the destination MAC address in the Ethernet frame points at the gateway.
Why does my PC say the gateway must be on the same network?
Because the PC has to reach the gateway directly, using ARP and a frame on the local link. If the gateway address is in a different subnet, the PC has no way to reach it, so most systems warn you or refuse the setting.