A subnet is a group of local addresses
The mask (/24 = 255.255.255.0) says how many addresses share a network. A /24 holds 256 addresses (254 usable). Devices in the same subnet reach each other directly over the LAN; anything outside must be routed.
The default gateway is the way out
When a device wants to reach an address outside its subnet, it sends the packet to its default gateway - normally the router's address on that subnet. No gateway (or a wrong one) means local traffic works but the internet doesn't: the classic 'I can print but can't browse' symptom.
Sizing subnets (CIDR)
Smaller prefix = bigger block: /25 = 126 hosts, /26 = 62, /27 = 30, /28 = 14. To split one network for several groups, give each the smallest block that fits its host count, largest first, without overlapping or overflowing the base network.