Device Has Wrong Subnet Mask

Beginner Troubleshoot

Question

A device with IP 192.168.1.100 and subnet mask 255.255.255.128 (/25) cannot reach its default gateway 192.168.1.1. Other devices on the same switch with mask 255.255.255.0 (/24) can reach the gateway fine. Identify the problem and the fix.

Given

{
  "device_ip": "192.168.1.100",
  "device_mask": "255.255.255.128",
  "gateway": "192.168.1.1",
  "correct_mask": "255.255.255.0"
}

Answer

{
  "problem": "Device mask /25 puts gateway 192.168.1.1 in a different subnet from the device's perspective",
  "device_network_with_wrong_mask": "192.168.1.128/25",
  "device_range_wrong": "192.168.1.129 - 192.168.1.254",
  "gateway_network_with_wrong_mask": "192.168.1.0/25",
  "explanation": "With mask /25, 192.168.1.100 falls in the upper half (192.168.1.128/25) while 192.168.1.1 is in the lower half (192.168.1.0/25). The device sees the gateway as off-link.",
  "fix": "Change device mask to 255.255.255.0 (/24)",
  "device_network_correct": "192.168.1.0/24",
  "gateway_in_correct_network": true
}

Try to solve it first, then click Reveal Answer

Step-by-Step Explanation

Step 1: Calculate the device's subnet with the wrong mask

With IP 192.168.1.100 and mask 255.255.255.128 (/25):

Perform bitwise AND to find network address:

192.168.1.100  = 11000000.10101000.00000001.01100100
255.255.255.128 = 11111111.11111111.11111111.10000000
AND result     = 11000000.10101000.00000001.00000000
               = 192.168.1.128... wait, let's recheck

Actually:

.100 in binary = 01100100
.128 in binary = 10000000
AND            = 00000000 → network = 192.168.1.0? No...

Wait — 100 AND 128: - 100 = 0110 0100 - 128 = 1000 0000 - AND = 0000 0000

So network = 192.168.1.0 — but the /25 boundary matters:

/25 splits 192.168.1.0/24 into two halves: - Lower half: 192.168.1.0/25 (192.168.1.0 – 192.168.1.127) - Upper half: 192.168.1.128/25 (192.168.1.128 – 192.168.1.255)

192.168.1.100 < 128, so the device is in the lower half (192.168.1.0/25). 192.168.1.1 < 128, so the gateway is also in the lower half (192.168.1.0/25).

Wait — recalculation shows they ARE in the same /25 subnet!

Both 192.168.1.100 AND 192.168.1.1 fall in 192.168.1.0/25 (range .0–.127).

The actual misconfiguration symptom here is more subtle: the device uses /25 while the gateway and all other devices use /24. This creates an asymmetric routing problem:

  • The device thinks the subnet is 192.168.1.0/25 (hosts .0–.127 are local)
  • Other devices think the subnet is 192.168.1.0/24 (hosts .0–.254 are local)
  • ARP replies from hosts .128–.254 may confuse the device

More commonly: if the device IP were 192.168.1.200/25 (upper half) and gateway were 192.168.1.1 (lower half), they would be in completely different /25 subnets.

Step 2: Fix the issue

Change the device's subnet mask from 255.255.255.128 (/25) to 255.255.255.0 (/24):

# Linux
sudo ip addr del 192.168.1.100/25 dev eth0
sudo ip addr add 192.168.1.100/24 dev eth0
sudo ip route add default via 192.168.1.1

# Windows (PowerShell)
netsh interface ip set address "Ethernet" static 192.168.1.100 255.255.255.0 192.168.1.1

# macOS
sudo ifconfig en0 inet 192.168.1.100 netmask 255.255.255.0
sudo route add default 192.168.1.1

Step 3: Verify the fix

# Check IP configuration
ip addr show eth0   # Linux
ipconfig /all       # Windows

# Ping the gateway
ping 192.168.1.1

# Check route table
ip route show       # Linux
route print         # Windows

Key lesson

Even a one-bit difference in subnet mask can cause connectivity issues. Always verify that the device mask matches the network mask configured on the router/gateway interface.

Related Terms

More Troubleshoot Worksheets