An IPv4 address splits into four 8-bit chunks (like 192.168.1.100) that combine into a 32-bit number, with the slash notation (e.g., /24) showing how many leading bits belong to the network. The first three chunks (192.168.1) usually point to your local network, while the last chunk (100) singles out a specific device. This setup tells routers whether traffic should stay local or head out to the internet.
What’s Really Happening
IPv4 addresses are 32-bit binary numbers broken into four 8-bit octets, each ranging from 0 to 255. The CIDR notation (the /24 in 192.168.1.100/24) tells devices how many of those 32 bits are locked for the network. Picture it like a phone number: the area code (first three octets) directs the call to the right neighborhood, and the last four digits (host bits) ring the specific house.
The subnet mask (255.255.255.0 for /24) acts like a filter. It hides the host portion, showing devices which part of the address matters for routing. If your mask says /24, only the first 24 bits count for network decisions. Switch that to /16, and suddenly a wider range (like 192.168.x.x) becomes part of your local network—great for big offices but overkill for a home setup.
This isn’t just theory; it’s why your smart speaker can chat with your phone without bothering the internet. These numbers are the real deal behind how the internet actually functions, not some random labeling system.
Step-by-Step Solution
To troubleshoot or fix subnet problems, first confirm your IP and mask, split the address to separate network from host bits, test basic connectivity, and only tweak the mask if needed. The goal is making sure devices on the same network can "see" each other before assuming the config is broken.
- Grab your IP and mask in one step
- Windows 10/11: Hit Win + R, type
cmd, then Enter. Run:
ipconfig /all
Look under the right adapter (Wi-Fi or Ethernet) for “IPv4 Address” and “Subnet Mask.” If you see “192.168.1.100” and “255.255.255.0,” you’re on a /24 network. Pro tip: If you’re fixing a printer, check its settings too—sometimes gadgets default to weird masks.
- Ubuntu 24.04 LTS: Open Terminal. Run:
ip a
Find your interface (usually eth0 or wlan0). The line starting with “inet” shows something like “192.168.1.100/24.” If you see “/25” or “/26,” that’s your mask in CIDR form—no conversion needed.
- Split the address by hand
Take the CIDR (e.g., /24) and turn it into a dotted mask: /24 → 255.255.255.0. Write out the 32-bit binary for both the IP and mask. Example:
| Octet | 192 | 168 | 1 | 100 |
| Binary IP | 11000000 | 10101000 | 00000001 | 01100100 |
| Binary Mask (/24) | 11111111 | 11111111 | 11111111 | 00000000 |
| Network Bits | 192.168.1 | (fixed) |
| Host Bits | (0) | 100 (device-specific) |
If your mask is /16, the network bits cover the first two octets (192.168), leaving the last two octets (up to 65,534 hosts) for devices. Offices use this often, but homes usually stick with /24—it’s plenty. Set a /16 at home by accident? Your router might choke trying to track thousands of devices you don’t even own.
- Test basic connectivity
- Ping yourself to confirm the interface is alive:
ping 192.168.1.100
- Ping your router (usually the first address, like 192.168.1.1):
ping 192.168.1.1
- Try pinging another device on the same network, like a printer or laptop:
ping 192.168.1.50
If you can ping the router but not another device, the problem’s likely on that device’s IP or firewall. Can’t reach the router? Double-check your IP and mask. Nine times out of ten, it’s a typo in the mask or a messed-up default gateway.
- Adjust the mask if needed
- Windows: Head to Settings → Network & Internet → Change adapter options → right-click your adapter → Properties → IPv4 → Properties. Pick "Use the following IP address" and enter:
- IP address:
192.168.1.100
- Subnet mask:
255.255.255.0
- Default gateway:
192.168.1.1 (or your router’s IP)
Click OK and restart the adapter if needed. (Setting a static IP? Make sure it’s outside your router’s DHCP range to dodge conflicts.)
- macOS: Go to System Settings → Network → Wi-Fi/Ethernet → Details → TCP/IP. Choose “Manually” and type:
- IPv4 Address:
192.168.1.100
- Subnet Mask:
255.255.255.0
- Router:
192.168.1.1
Click OK and reconnect. Using a different subnet? Tweak the numbers (e.g., 10.0.0.50/24 for a /24 network).
If This Didn’t Work
If simple fixes fail, hunt for IP conflicts, verify the gateway, or check physical connections. These are the usual culprits when subnet masks don’t behave.
- IP conflict: Two devices on the same subnet with matching host IDs (e.g., both 192.168.1.100) will scramble the network. On Windows, run
arp -a in Command Prompt to list devices and their MACs. On Linux, use ip neigh. Spot a duplicate? Change the last octet on one device (e.g., 192.168.1.101). IoT gadgets like cameras often default to the same IP, so check those first.
- Wrong gateway: If your router’s IP is 192.168.2.1 but you typed 192.168.1.1, your device will look for the router in the wrong place. Confirm the gateway in your settings. One digit off (like 192.168.1.1 vs. 192.168.1.10) can break everything.
- Interface disabled: On Windows, open Device Manager (Win + X → Device Manager), expand “Network adapters,” and ensure your adapter isn’t disabled. On Linux, run
ip link to check status. If it says “DOWN,” bring it up with sudo ip link set eth0 up (swap eth0 for your interface). Don’t ignore physical issues—a loose cable or dead port can cause silent failures.
- Firewall or security software: Still no luck seeing other devices? Check your firewall. Windows Defender or third-party tools might block pings or local discovery. Turn it off briefly to test. (If it’s the problem, add an exception for your local subnet.)
Prevention Tips
Keep the same subnet mask across all local devices, enable DHCP for most gadgets, and jot down your network’s IP ranges. Small habits like these stop 90% of subnet headaches before they start.
- Stick to standard masks for your network size:
| Network Size | CIDR | Subnet Mask | Hosts |
| Small home network | /24 | 255.255.255.0 | 254 |
| Medium office | /22 | 255.255.252.0 | 1,022 |
| Large network | /20 | 255.255.240.0 | 4,094 |
Most home networks do fine with /24. Offices with lots of devices might need /22 or /20, but even then, hitting the host limit is rare. Start with /24 and expand only if you must.
- Enable DHCP for most devices: Let your router hand out IPs automatically for phones, laptops, and smart gadgets. Reserve static IPs only for devices that need them (servers, printers) to avoid conflicts. Most routers handle this in DHCP settings under “Address Reservation.”
- Document your network’s IP ranges: Write down the subnet mask, gateway, and DHCP range for your router. Example:
- Subnet: 192.168.1.0/24
- Gateway: 192.168.1.1
- DHCP Range: 192.168.1.100–192.168.1.200
- Static IPs: 192.168.1.50 (printer), 192.168.1.60 (NAS)
This saves time when adding devices or troubleshooting. You’ll instantly know if a new gadget’s IP is outside the DHCP range.
- Test your network periodically: Run a quick ping test between devices monthly to catch issues early. Use
ping 192.168.1.1 to check the router and ping 192.168.1.255 (the broadcast address) to test local connectivity. Dropped pings? Investigate before they become bigger problems.
Can I use a /8 or /16 mask at home?
Yes, but it’s usually overkill and can cause headaches like IP exhaustion or routing messes. A /8 (255.0.0.0) or /16 (255.255.0.0) mask is way more than most homes need—stick with /24 (255.255.255.0).
A /16 covers 65,534 hosts, which sounds impressive but isn’t practical at home. Set your laptop to /16, and it might try sending traffic to devices across your whole neighborhood—even ones you don’t own. That slows things down or creates security risks. Honestly, /24 is simpler and more than enough for home use.
That said, if you’re running a small server or lab at home, a /22 (255.255.252.0) might work. It covers 1,022 hosts, enough for a few dozen devices without the sprawl of /16. Just tweak your router’s DHCP settings to avoid overlapping with your ISP’s range.
What if my ISP gives me a /32?
A /32 mask means your ISP assigned you a single IP with no room for a local network. This pops up with some ISPs that only provide one public IP, like point-to-point links or certain business plans.
Here’s the fix: Use NAT (Network Address Translation) on your router to share that one IP across multiple devices. Your router assigns private IPs (like 192.168.1.x) to local gadgets and handles the translation between private and public IPs. This is how most home networks work, even with a /32 from your ISP.
Hosting a server? Set up port forwarding on your router to direct traffic to the right device. Say you’re running a web server on 192.168.1.50—forward port 80 to that IP. Just watch out: some ISPs block ports like 25 (email) to stop spam.
How do I tell if my subnet mask is wrong?
Clues include devices not seeing each other on the same network, failing to reach the router, or weird routing behavior. The mask must match the network’s size and the router’s setup.
Example: Your router’s IP is 192.168.1.1, and you’re on a /24. Your device’s IP should start with 192.168.1. If your mask is /16 (255.255.0.0), your device might try reaching 192.168.2.1 (outside your network) when it should stay local. That causes lag or outright failure.
Another sign? You can ping the router but not other devices. A mask that’s too large (e.g., /16 on a /24 network) makes your device think others are on a different subnet and refuse to talk. Compare your mask to the router’s—consistency is everything.
Why does my Linux box show /24 but my Windows box shows 255.255.255.0?
Linux and Windows are just showing the same subnet mask in different formats. A /24 in CIDR is the same as 255.255.255.0 in dotted decimal—both mean a 24-bit network mask.
Linux uses CIDR (e.g., 192.168.1.100/24) for clarity, while Windows sticks to dotted decimal (255.255.255.0). They’re two ways to write the same thing. When troubleshooting, convert mentally: /24 = 255.255.255.0, /16 = 255.255.0.0, /8 = 255.0.0.0. Some Linux tools (like ip a) use CIDR, while Windows tools (like ipconfig) prefer dotted decimal. It’s just a display choice—both systems understand the same network.
What’s the difference between a subnet mask and a gateway?
A subnet mask splits an IP into network and host parts, while a gateway is the router’s IP that links your local network to the internet. The mask handles local traffic, and the gateway handles external traffic.
Think of the subnet mask as a neighborhood filter. It tells your device, “The first three numbers (192.168.1) are the street, and the last number is the house.” The gateway is the mail carrier—it takes traffic from your street to other streets (the internet). No gateway? Your device can chat locally but won’t reach the outside world. No subnet mask? Your device won’t know which traffic stays local or goes to the gateway.
Can two devices have the same IP if they’re on different subnets?
Technically yes, but it’s a bad idea and can confuse routers. Two devices with the same IP (e.g., 192.168.1.100) on different subnets (e.g., 192.168.1.0/24 and 10.0.0.0/24) won’t clash because routers treat them as separate networks.
Still, this is messy and risky. If you accidentally assign the same IP to two devices on the same subnet, you’ll get a conflict and both devices will fail. Even if routers ignore duplicates on different subnets, it’s a habit that can bite you later. Play it safe—use unique IPs within each subnet.
What happens if I set my mask to 255.255.0.0 on a /24 network?
Setting a /16 mask (255.255.0.0) on a /24 network makes your device think the network is way bigger than it is. This can make local devices look “unreachable” even though they’re right there.
Say your router is 192.168.1.1 and you set your device to 192.168.1.100 with /16. Your device might try sending traffic to 192.168.2.1 (outside your network) instead of keeping it local. That breaks pings to other devices on the same /24. Fix it by resetting the mask to /24 (255.255.255.0) to match your router. Consistency matters—your mask should fit the network’s real size and the router’s config.
How do I find the network address from an IP and mask?
To find the network address, do a bitwise AND between the IP and subnet mask. This zeros out the host bits, leaving only the network part.
Example: IP 192.168.1.100, mask 255.255.255.0:
- Convert both to binary:
- IP: 11000000.10101000.00000001.01100100
- Mask: 11111111.11111111.11111111.00000000
- Bitwise AND (1 AND 1 = 1, 1 AND 0 = 0):
- Result: 11000000.10101000.00000001.00000000
- Convert back to decimal: 192.168.1.0
This network address (192.168.1.0) is the base of your subnet. All devices on this network share it as their “neighborhood.” Troubleshooting? Check that all local devices share the same network address. Mismatches are a common cause of “no network” errors.
Modern OSes do this math automatically, but knowing the manual method helps when debugging. Feeling lazy? Use an online subnet calculator.
Why do some routers use 255.255.255.254 as a mask?
Routers use 255.255.255.254 (/31) for point-to-point links where only two devices need to talk. This mask saves IPs by reserving just two addresses (network and broadcast) instead of 256 for a /24.
In a /31 subnet, the network and broadcast addresses are the only reserved ones, leaving both IPs usable for devices. This is common in ISP-to-customer links or between two routers. Example: Two routers connected via a dedicated link might get IPs like 192.168.1.1/31 and 192.168.1.2/31. The mask 255.255.255.254 ensures they see each other as part of the same tiny network.
This isn’t for home networks—/24 or /22 masks are standard there. /31 is mostly for pros managing point-to-point links or ISPs optimizing IP usage.
What’s the smallest subnet I can use?
The smallest practical subnet is a /31 (255.255.255.254), supporting exactly two devices. This is for point-to-point links where only two endpoints exist.
Technically, the smallest is a /32 (255.255.255.255), which assigns a single IP with no hosts. This is used for loopback (like 127.0.0.1) or hosting one device in a dedicated network. Example: A server might get a /32 if it’s the only device on a subnet.
In real life, /31 is the smallest useful subnet outside ISPs or specialized setups. For a home lab or tiny isolated network, /30 (255.255.255.252) is the next step, supporting two usable hosts (e.g., 192.168.1.5 and 192.168.1.6 in a /30 network).
Edited and fact-checked by the TechFactsHub editorial team.