Beginner

Wrong subnet mask: why two hosts on one switch can't ping

Two PCs on the same switch, one with the wrong subnet mask. Each decides differently what is local, and the ping fails in both directions.

Open this lab

Free interactive lab. No signup. Runs in your browser.

The scenario

PC-A (10.0.1.10/24) and PC-B (10.0.1.200) are plugged into the same switch and belong on the same network, 10.0.1.0/24. PC-B was given a /25 mask by mistake. With /25, PC-B's network is only 10.0.1.128 to 10.0.1.255, so PC-B believes 10.0.1.10 is on a different network that it would need a router to reach, and there is no router. PC-A, with the correct /24, sees 10.0.1.200 as local and sends straight to it. The switch forwards frames either way; it never looks at IP addresses. The mistake lives entirely in PC-B's configuration.

What you will work out

Learn how a subnet mask decides what a host treats as local, and why both ends must agree.

Why this matters

A wrong mask is easy to miss: the address looks right, the link light is on, and the device may still reach part of its network. It happens when an address is typed by hand on a network where everything else came from DHCP, or copied from another site. Checking the route table on both ends ('ip route' on Linux, 'route print' on Windows, 'show ip route' on a router) is the quickest way to spot it.

Running it

Connected But Can't Ping (Mask Mismatch) opens on a canvas, already wired and addressed. Trace a packet through it hop by hop, or run the same topology live on real Linux network namespaces. How the two modes differ.

Open Connected But Can't Ping (Mask Mismatch)

Runs in your browser. No install, no signup, and the simulation starts instantly.

Open the lab →