IP Addressing and Subnet Masks: How Networks Work
IP Addressing and Subnet Masks: How Networks Work
Every device on the internet or a local network has an IP address.
But how does it know if another device is on the same network or not?
Thatโs where the subnet mask comes in.
๐ What is an IP address?
An IPv4 address has 4 numbers separated by dots โ e.g. 192.168.1.20
Itโs also called a dotted quad because it has 4 octets.
๐งฉ What does the subnet mask do?
The subnet mask tells you:
- What part of the address is the network
- What part is the host (specific device on that network)
Example:
IP: 192.168.1.20
Mask: 255.255.255.0
โ Network part: 192.168.1
โ Host part: 20
Devices on the same network can communicate directly.
If not, the message goes through a gateway.
๐ What does โ/24โ mean?
The CIDR notation (e.g. /24
) is a shorthand for the subnet mask.
/24
= 24 bits for the network โ255.255.255.0
/16
=255.255.0.0
/8
=255.0.0.0
Example:
192.168.1.0/24 โ 256 total IPs (0 to 255)
โ 254 usable for hosts (excluding network and broadcast)
๐ฏ Practical Example
Two PCs:
- IP: 192.168.1.10/24
- IP: 192.168.1.50/24
โ
Can talk directly.
But 192.168.2.10/24
? โ Outside the network โ needs a gateway.