Default gateway and subnet mask explained (255.255.255.0, /24)

Open your network details and next to your IP address sit two more numbers that most people never touch: the subnet mask and the default gateway. Between them, they decide whether a message goes straight to the printer down the hall or out through the router to the internet.

How a device decides where to send something

Every time your laptop sends a packet, it asks one question: is the destination on my network? It compares the network part of its own address with the destination's, using the subnet mask.

Wirebook explains both in plain English: What is a gateway? and What is a subnet?

Find your gateway and subnet mask

DeviceHow
WindowsCommand Prompt: ipconfig shows Subnet Mask and Default Gateway for each adapter.
MacSystem Settings → Wi-Fi → Details… → TCP/IP shows Subnet mask and Router. In Terminal: route -n get default.
iPhone / iPadSettings → Wi-Fi → (i) next to the network: Subnet Mask and Router.
AndroidSettings → Network → Wi-Fi → tap the network (sometimes under Advanced): Gateway and Subnet mask or Network prefix length. Menus vary by brand.
Linuxip route (the line default via 192.168.1.1 is the gateway) and ip -4 addr (the /24 after the address is the mask).

The gateway address is usually also the router's admin page: see how to log in to your router.

Subnet masks and what they mean

A mask is 32 bits: ones for the network part, zeros for the device part. 255 is 11111111 in binary, so 255.255.255.0 is 24 ones then 8 zeros, hence /24. Try it in the number base converter.

MaskShort formUsable addressesWhere you see it
255.0.0.0/816,777,214Large company networks (10.x.x.x)
255.255.0.0/1665,534Offices, campuses
255.255.252.0/221,022Some mesh systems and guest networks
255.255.255.0/24254Almost every home router
255.255.255.128/25126Small split networks
255.255.255.252/302A link between two routers

In a /24, the first address (.0) names the network and the last (.255) is the broadcast address, which is why there are 254 usable addresses, not 256. A /24 home network handed out by DHCP rarely needs more.

Common problems

A two-ping test

  1. ping 192.168.1.1 (your gateway): no reply means the problem is between the device and the router (Wi-Fi, cable, adapter).
  2. ping 1.1.1.1: the gateway replies but this doesn't, so the problem is past your router, with the line or the provider.
  3. Both reply but websites don't load by name: that is DNS. Try another DNS server or restart the router.

Related

Best Wi-Fi channel (1, 6, 11 and 5 GHz) · Mesh Wi-Fi backhaul and where to put the units · 2.4 GHz vs 5 GHz Wi-Fi · Double NAT and CGNAT · Log in to your router (192.168.1.1)

Questions

What is a default gateway?

The address a device sends traffic to when the destination isn't on its own network. At home it is the router, usually 192.168.1.1, 192.168.0.1 or 10.0.0.1.

What does subnet mask 255.255.255.0 mean?

The first three numbers of an IP address identify the network and the last number identifies the device. It is the same as /24 and allows 254 devices.

How do I find my default gateway?

On Windows run ipconfig and look for Default Gateway. On a Mac, iPhone or Android it is listed as Router or Gateway in the Wi-Fi network's details. On Linux run ip route.

Why is my default gateway blank?

The device didn't get settings from the router's DHCP, often shown by a 169.254 address. Renew the address, restart the router, or check that the device is really connected.

Why can't I reach a device on 192.168.0.x from 192.168.1.x?

With a /24 mask they are different networks, so traffic would have to go through a router between them. Usually two routers are each running their own network; put one in access-point mode.

Published .

Try it

Related guides

Newest guides