100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace

What is a Default Gateway?

Learn what a default gateway is, how devices decide to use it, and how to diagnose common gateway misconfiguration issues.

easyQ94 of 224 in Computer Networks Est. time: 5 minsLast updated:
Open Code Lab

Expected Interview Answer

A default gateway is the router a device sends traffic to whenever the destination address is not on its own local network, acting as the exit point that forwards packets toward the wider internet or other remote networks.

When a device wants to send a packet, it first checks whether the destination IP address falls within its own subnet. If it does, the device delivers the packet directly using ARP to find the destination’s MAC address on the local segment. If the destination is outside the local subnet, the device instead sends the packet to its configured default gateway (typically a router’s local IP, like 192.168.1.1) which then forwards it onward, hop by hop, toward the actual destination based on its own routing table. A default gateway is usually assigned automatically via DHCP alongside the device’s own IP address and subnet mask, though it can be configured manually. Without a correctly set default gateway, a device can talk to other hosts on its own LAN but cannot reach anything beyond it, including the internet — a classic symptom is local network access working while nothing external loads.

  • Provides the exit point for all off-subnet and internet traffic
  • Lets a device reach destinations without knowing the full path
  • Typically auto-configured via DHCP alongside IP and subnet mask
  • A misconfigured gateway is a common, diagnosable cause of “no internet” issues

AI Mentor Explanation

A default gateway is like the one exit gate every fan must pass through to leave the stadium and reach the outside city — inside the ground, fans can walk freely between stands (the local network), but the moment they want to go anywhere beyond the stadium walls, they funnel through that single gate. If the gate is locked or unmanned, fans can still mingle inside the ground but cannot reach the city at all. A device’s default gateway plays that exact exit-gate role for any traffic leaving the local network.

Step-by-Step Explanation

  1. Step 1

    Destination check

    The device compares the destination IP against its own subnet mask to see if it is local.

  2. Step 2

    Local delivery

    If the destination is local, the device uses ARP to find its MAC address and delivers directly.

  3. Step 3

    Gateway forwarding

    If the destination is off-subnet, the device instead sends the packet to its configured default gateway.

  4. Step 4

    Onward routing

    The gateway router forwards the packet toward the destination using its own routing table, hop by hop.

What Interviewer Expects

  • Clear definition: the router used for traffic leaving the local subnet
  • Understands the local-vs-remote destination check that triggers gateway use
  • Knows it is typically assigned via DHCP alongside IP and subnet mask
  • Can diagnose “local works, internet does not” as a likely gateway issue

Common Mistakes

  • Confusing the default gateway with a DNS server
  • Thinking every packet, even local ones, goes through the gateway
  • Not knowing the gateway is usually just another device's IP (a router interface) on the same subnet
  • Forgetting a misconfigured gateway breaks only off-subnet reachability, not local

Best Answer (HR Friendly)

A default gateway is the router your device automatically sends traffic to whenever it wants to reach somewhere outside your own local network, like the internet. Think of it as the front door of your home network — anything staying inside the house does not need it, but anything going out into the world has to pass through that door first. It is usually set automatically when you connect to Wi-Fi or plug in, and if it is misconfigured, you will notice local devices still work but nothing external loads.

Code Example

Inspecting and testing the default gateway
# Show the configured default gateway (Linux)
ip route show default
# default via 192.168.1.1 dev eth0

# Confirm the gateway itself is reachable
ping -c 4 192.168.1.1

# Trace the path a packet takes, starting at the gateway
traceroute 8.8.8.8

Follow-up Questions

  • How is a default gateway typically assigned to a device?
  • What happens if a device's default gateway is misconfigured?
  • How does the device decide whether to use ARP directly or send to the gateway?
  • What is the difference between a default gateway and a DNS server?

MCQ Practice

1. When does a device send a packet to its default gateway?

The default gateway is used only when the destination IP is not on the device's own local subnet.

2. How is a default gateway usually assigned to a device?

DHCP typically hands out the default gateway address along with the device's IP and subnet mask.

3. A user reports local file sharing works but no websites load. What is a likely cause?

Local traffic does not need the gateway, but reaching external sites does — this pattern points to a gateway issue.

Flash Cards

What is a default gateway?The router a device sends traffic to when the destination is outside its own subnet.

How is it usually assigned?Automatically via DHCP, alongside the device's IP address and subnet mask.

What does a bad gateway break?Off-subnet and internet reachability, while local network access still works.

How does a device decide to use it?By comparing the destination IP against its own subnet mask.

1 / 4

Continue Learning