Think Like a Computer
No ads, no affiliate links, no software recommendations you did not ask for.

What a Default Gateway Does on an IP Network

How a host compares the subnet mask, decides a destination is off-link, ARPs for the gateway's MAC, and falls back to the 0.0.0.0/0 route in route print.

A default gateway is the address of a router interface on the same subnet as the host, used as the next hop for every destination the host cannot reach directly. The host does not send traffic to the gateway because the gateway is special; it sends traffic there because the destination failed a mask comparison and no more specific route exists. Understanding that comparison explains most gateway faults, including the message that the default gateway is not available.

How a host decides a destination is off its subnet

Every IPv4 interface is configured with an address and a subnet mask. The mask marks which bits of the address identify the network and which identify the host. To test a destination, the host performs a bitwise AND of the destination address with its own mask and compares the result with its own network address, computed the same way.

If the two network addresses match, the destination is on-link. The host resolves the destination’s MAC address directly and sends the frame onto the local segment. If they differ, the destination is off-link. The host cannot address a frame to it, because MAC addresses only have meaning on the local segment, so it looks for a router to forward the packet.

A host at 192.168.1.20 with mask 255.255.255.0 has network address 192.168.1.0. A destination of 192.168.1.200 ANDs to 192.168.1.0 and is on-link. A destination of 192.168.2.200 ANDs to 192.168.2.0 and is off-link. The mask, not the address range alone, makes that decision: the same 192.168.2.200 destination is on-link for a host using 255.255.0.0. This is the mechanism described in IP addressing and subnets, and it is why a wrong mask produces selective failures rather than a total loss of connectivity.

The frame goes to the gateway’s MAC address, not its IP address

When the destination is off-link, the host consults its routing table for a route matching the destination. The matching route supplies a next-hop address, which is the gateway. The host then needs a MAC address for that next hop, so it issues an ARP request for the gateway’s IP address and receives the gateway’s MAC in the reply. The IP packet is left unchanged, with the original destination address in its header, but the Ethernet frame is addressed to the gateway’s MAC.

The gateway receives the frame, strips it, examines the destination IP, and repeats the process from its own routing table. This is why a host can reach the internet with a gateway address it has never communicated with at the IP layer: the gateway is only ever a link-layer destination for the first hop. The resolution process and its cache are covered in ARP and MAC addresses.

If ARP for the gateway fails, the host has a route but no way to use it. Packets queue or are dropped, and the interface may report the gateway as unreachable even though its address is configured correctly. A gateway address that is not actually on the host’s subnet produces exactly this: the host tries to ARP for an address no device on the segment owns.

The 0.0.0.0/0 route in route print

A default gateway is stored as a route, not as a separate setting. On Windows, route print shows the IPv4 route table. The default route appears with destination 0.0.0.0 and netmask 0.0.0.0, which matches every address, and its gateway column holds the next-hop address.

route print -4

The output lists interface entries, then the active routes. A line such as 0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.20 25 means: any destination, reached via 192.168.1.1, from local address 192.168.1.20, at metric 25. The metric column is a cost; when several routes match a destination, the host uses the most specific mask first, then the lowest metric among equally specific routes. Because 0.0.0.0/0 is the least specific possible route, it is used only when nothing else matches. A more specific route, such as one for 10.0.0.0/8 pointing at a different next hop, wins for addresses inside 10.0.0.0/8 regardless of metric. The full structure of the table is described in the routing table.

Multiple gateways, interface metrics and which one wins

A machine with more than one active interface, such as Ethernet and Wi-Fi, can hold more than one default route. Windows assigns each interface an automatic metric derived from link speed, and the route inherits it. The default route with the lower total metric is preferred; the other remains in the table but is not used while the preferred one exists.

Get-NetIPInterface -AddressFamily IPv4 | Format-Table InterfaceAlias, InterfaceMetric

This lists each interface with its metric. A lower value is preferred. If a laptop keeps sending traffic out Wi-Fi when the Ethernet cable is connected, the two metrics explain it: the route with the lower metric is the one in use, and the other default route is dormant rather than wrong.

Get-NetRoute -DestinationPrefix 0.0.0.0/0 | Format-Table InterfaceAlias, NextHop, RouteMetric, InterfaceMetric

This shows every default route with its next hop and both metric components. The effective cost is the route metric plus the interface metric. Comparing the rows tells you which gateway the host will actually use for off-link traffic, and which one is only a standby.

What “the default gateway is not available” is reporting

Windows network diagnostics emit this message when the configured default gateway does not answer. The wording is about reachability of the next hop, not about the internet. The host has a default route, has an address on the subnet, and has tried to contact the gateway without a reply, typically because ARP for the gateway address went unanswered or because the gateway did not respond to the probe.

Several distinct faults produce the same sentence. The gateway device may be powered off or its interface down. The host may have been given a gateway address outside its own subnet by a misconfigured DHCP scope, so ARP is asking for an address that no device on the segment owns. The host may have a static address with the wrong mask, placing a correct gateway address off-link. Or the gateway may be reachable but configured not to answer the probe the diagnostic uses, in which case the message is misleading and traffic may still flow. The same gap between what a configuration claims and what is actually reachable is what scammers exploit when they build fake trading platforms, as explained in this guide to recognizing pig butchering scams.

The distinction matters because the repairs differ. Confirm the host’s address, mask and gateway first:

ipconfig /all

The output shows the IPv4 address, subnet mask and default gateway for each adapter. Check that the gateway address falls inside the range the mask defines for the host’s subnet. If it does not, the configuration is wrong regardless of whether the gateway device is healthy.

Then check whether the gateway answers at the link layer:

arp -a

The table lists IP addresses the host has resolved to MAC addresses. If the gateway address appears with a MAC, ARP succeeded and the next hop is present on the segment. If it is absent, the host has not resolved it, and the problem is local reachability rather than routing beyond the gateway.

ping <gateway address>

A reply confirms the gateway is reachable at IP. A timeout with a valid ARP entry points beyond the host; a timeout with no ARP entry points at the segment or the gateway’s own configuration.

When the gateway is not the cause

A working default gateway does not guarantee that off-subnet traffic succeeds, and a failing one does not always explain every symptom. The table separates the cases.

SymptomGateway involvementWhen this explanation does not apply
No reply from any off-subnet address, gateway pings fineGateway is working; the fault is upstream or on the remote sideLocal subnet traffic also fails, which points at the switch or adapter
Gateway pings fail, ARP entry presentGateway reachable at layer 2 but not answering IP; check the gateway deviceThe host has no address on the subnet at all
Gateway pings fail, no ARP entryNext hop absent from the segment or address misconfiguredA more specific route sends the traffic elsewhere
Some off-subnet hosts reachable, others notDefault route is fine; a more specific route or remote firewall is involvedAll off-subnet traffic fails
Off-subnet works, on-subnet failsDefault gateway is not used for on-link trafficThe mask is wrong and the host believes the peer is off-link

Why a second default route does not create redundancy by itself

Two default routes in the table do not mean the host fails over between them. The host uses the preferred route while it exists. If the preferred gateway stops answering but its route remains in the table, the host continues to send traffic to it and the traffic is lost; the standby route is not consulted. Failover requires the route to be removed, which happens when the interface goes down or when a routing protocol withdraws it. A machine with a wired and a wireless adapter therefore has a standby default route that is only used after the preferred interface is disabled or loses its link. This is the behaviour to expect when a laptop on Wi-Fi does not recover after a cable is unplugged mid-session: the wired route may persist briefly, or the wireless route may carry a higher metric and remain unused.

Reading the gateway from the host’s own configuration

When the route table and the adapter settings disagree, the adapter settings are the source and the table is the result. Get-NetIPConfiguration reports the address, mask and gateway per interface in one view:

Get-NetIPConfiguration | Format-List InterfaceAlias, IPv4Address, IPv4DefaultGateway

A populated IPv4DefaultGateway with a matching 0.0.0.0/0 row in route print is a consistent configuration. A gateway shown here but absent from the route table indicates the route was removed manually or by policy, and off-link traffic will fail until it is restored. A gateway absent here means DHCP did not supply one or the static configuration omits it, and the host has no default route at all; in that state, on-link traffic works and everything else does not, which is the cleanest way to recognise a missing gateway as distinct from an unreachable one.

Common questions

What is a default gateway in simple terms?

It is the router address a host sends traffic to when the destination is not on its own subnet. The host compares the destination against its subnet mask, finds no match, and forwards the packet to the gateway's MAC address for delivery onward.

How do I find my default gateway?

Run `ipconfig` and read the Default Gateway line for the active adapter, or run `route print -4` and look for the 0.0.0.0 destination with netmask 0.0.0.0. The gateway column on that row is the next hop used for off-subnet traffic.

Why does it say the default gateway is not available?

Windows could not get a reply from the configured gateway address. Common causes are a gateway address outside the host's subnet, a gateway device that is down, or a wrong subnet mask on a static configuration. Check the address and mask with `ipconfig /all` before assuming the router is faulty.

Can a computer have more than one default gateway?

Yes. Each active interface can carry its own default route, and the one with the lower combined route and interface metric is used. The other stays in the table as a standby and is not consulted unless the preferred route is removed.

Does the default gateway have to be the router's IP address?

It has to be an address on the host's own subnet that a router answers for. It is usually the router interface on that segment, but any device that forwards packets and answers ARP for that address will work as the next hop.

Read next