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.
- Same network (say
192.168.1.20to the printer at192.168.1.45): send it straight there, no router involved. - Different network (say a website at
142.250.180.14): send it to the default gateway, the router, which passes it on to the internet.
Wirebook explains both in plain English: What is a gateway? and What is a subnet?
Find your gateway and subnet mask
| Device | How |
|---|---|
| Windows | Command Prompt: ipconfig shows Subnet Mask and Default Gateway for each adapter. |
| Mac | System Settings → Wi-Fi → Details… → TCP/IP shows Subnet mask and Router. In Terminal: route -n get default. |
| iPhone / iPad | Settings → Wi-Fi → (i) next to the network: Subnet Mask and Router. |
| Android | Settings → Network → Wi-Fi → tap the network (sometimes under Advanced): Gateway and Subnet mask or Network prefix length. Menus vary by brand. |
| Linux | ip 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.
| Mask | Short form | Usable addresses | Where you see it |
|---|---|---|---|
255.0.0.0 | /8 | 16,777,214 | Large company networks (10.x.x.x) |
255.255.0.0 | /16 | 65,534 | Offices, campuses |
255.255.252.0 | /22 | 1,022 | Some mesh systems and guest networks |
255.255.255.0 | /24 | 254 | Almost every home router |
255.255.255.128 | /25 | 126 | Small split networks |
255.255.255.252 | /30 | 2 | A 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
- Gateway is blank and the address starts 169.254: the device didn't get an address from the router at all. See Wi-Fi connected but no internet and renew the address.
- “The default gateway is not available” (Windows): the Wi-Fi or network adapter keeps dropping. Update its driver, turn off Allow the computer to turn off this device to save power in Device Manager, and restart the router.
- Can't reach the printer after a new router or mesh: compare the first three numbers of the printer's address and the laptop's.
192.168.0.xand192.168.1.xare different /24 networks, usually because two routers are each running their own network. Put one in access-point mode: see adding mesh without double NAT. - Static address set by hand, internet doesn't work but the printer does: the gateway field is wrong or empty. Set it to the router's address, or switch the device back to automatic (DHCP).
A two-ping test
ping 192.168.1.1(your gateway): no reply means the problem is between the device and the router (Wi-Fi, cable, adapter).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.- 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 .