Skip to main content
Explainer · networking

What is a default gateway?

Every time your computer sends a packet to something outside your own network — which is almost every packet — it hands that packet to a single device and trusts it to carry it onward. That device is the default gateway, and on your home network it is almost always your router. Here is what it does, the routing decision behind it, and how to find yours.

The one-sentence definition

A default gateway is the device your computer sends a packet to whenever the destination is not on your own local network. It is the exit door. Anything bound for your own subnet — the printer down the hall, the laptop in the next room — is delivered directly, but anything bound for the wider internet gets handed to the default gateway, which forwards it on toward its destination. On a home or small-office network that gateway is your router.

The routing decision: local or not?

To understand the gateway you have to understand the choice your computer makes for every single packet it sends. That choice is simple: is the destination on my own subnet, or somewhere else? The answer determines whether the packet is delivered directly or handed to the gateway.

Your machine works this out using its own IP address and its subnet mask. The mask defines which portion of an IP address is the network and which portion is the host. For example, with an address of 192.168.1.42 and a mask of 255.255.255.0 (a /24), the first three octets — 192.168.1 — are the network, and everything from 192.168.1.1 to 192.168.1.254 is considered “local.” When your computer wants to send to a destination IP, it applies the mask to both its own address and the destination address and compares the network portions.

This is the whole reason the gateway exists. Your computer has no idea how to reach a server three continents away; it only knows how to reach things on its own wire and how to reach one device that promises to handle everything else. That one device is the default gateway.

Why the gateway is your router's LAN IP

The default gateway has to be an address on your own subnet — otherwise your machine couldn't deliver packets to it directly, and you'd have a chicken-and-egg problem. That is exactly what your router's LAN-side interface provides. A home router has (at least) two faces: a WAN interface pointing at your ISP, and a LAN interface pointing at your own network with an address like 192.168.1.1 or 192.168.0.1. That LAN address, sitting on the same subnet as all your devices, is the default gateway.

This is also why the default gateway is the same thing people casually call the “router IP.” It is the address you type into a browser to open the router's admin page, the address your devices route through, and the address reported as the gateway all at once. If you have ever gone looking for it, our guide on how to find your router's IP address walks through it on every platform — the router IP it finds and the default gateway are the same value.

How your device learns the gateway: DHCP

You almost never type the gateway in by hand. When a device joins a network, it usually asks for its configuration automatically using DHCP — the Dynamic Host Configuration Protocol. In a single exchange, the DHCP server (again, typically your router) hands the new device a bundle of settings:

Those four together are enough for a device to participate fully in the network. The mask and the gateway are a matched pair: the mask decides the local-or-not question, and the gateway is the answer for everything that comes back “not.” This is why a misconfigured mask or a wrong gateway both produce the same symptom — the machine can talk to its neighbours but cannot reach the internet.

How to find your default gateway

Every operating system exposes the gateway; you just have to know where to look.

Windows

Open Command Prompt or PowerShell and run ipconfig. Under your active adapter (usually “Ethernet adapter” or “Wireless LAN adapter Wi-Fi”), look for the line labelled Default Gateway. The address beside it — something like 192.168.1.1 — is your gateway.

macOS

Open Terminal and run route -n get default. Read the line that begins with gateway: — that is the address. You can also run netstat -rn and find the row whose destination is default; the gateway column on that row is the same value.

Linux

Open a terminal and run ip route. The first line typically reads default via 192.168.1.1 dev eth0 — the address after via is your default gateway. On systems with the older net-tools installed, route -n or netstat -rn show the same information in a table.

The default route: 0.0.0.0/0

Under the hood, “default gateway” is a friendly name for an entry in your machine's routing table called the default route, written as 0.0.0.0/0. A routing table is an ordered list of rules of the form “to reach this range of addresses, send packets to thatnext hop.” When a packet needs sending, the machine looks for the most specific rule that matches the destination.

The route 0.0.0.0/0 is deliberately the least specific rule possible: a/0 prefix matches every address there is. It is the catch-all — the rule that applies when no more specific route fits. Your local subnet has its own, more specific route (the 192.168.1.0/24 entry, say, which matches only local addresses and says “deliver directly”). Anything that doesn't match that or any other specific route falls through to 0.0.0.0/0, whose next hop is the default gateway. That is precisely how “everything not on my subnet goes to the gateway” is expressed in the table.

Gateway versus DNS server: different jobs, same source

Because DHCP hands you the gateway and the DNS servers together, it is easy to blur them. They are not the same and they do not do the same thing.

A normal request uses both in sequence. First your machine asks a DNS server to resolve the hostname into an IP address. Then, armed with that address, it makes the local-or-not decision and — for any internet destination — hands the packet to the default gateway. On many home networks the router happens to be both the gateway and the DNS server, which is why the two addresses are often identical, but they are independent settings and can point at completely different machines.

Where the gateway sits in the bigger picture

Your gateway is the boundary between your private network and everything beyond it. On one side are your devices with their private addresses; on the other is the public internet. The router at that boundary does more than forward — it also performs NAT, translating your many private addresses into the single public address the outside world sees. That private-versus-public split is worth understanding on its own; see our explainer on public versus private IP addresses for how the two relate. And if you want to see the public address your gateway presents you to the world as, check what your IP is.

Frequently asked questions

Is the default gateway the same as my router?

On a typical home or office network, yes. The default gateway is the LAN-side IP address of your router — the address on the router that faces your own network, such as 192.168.1.1. It is the same address you mean when you say the “router IP,” and the same address you type into a browser to open the router's admin page. A gateway does not have to be a router in the abstract, but in practice, for almost every home network, the default gateway and the router are the same box.

How do I find my default gateway?

On Windows, run ipconfig and read the Default Gateway line under your active adapter. On macOS, run route -n get default and read the gateway line. On Linux, run ip route and read the address after default via. All three report the same thing: the next-hop address your machine sends off-subnet traffic to.

What is the difference between a default gateway and a DNS server?

They do completely different jobs even though DHCP usually hands you both at once. The default gateway is where packets go — it forwards your traffic toward the internet. A DNS server is where names go — it translates hostnames into IP addresses. You need DNS to work out the destination and the gateway to actually deliver the packet there. They are often the same device (your router frequently acts as both), yet the two settings are independent.

Related reading