HAKATEMIA
07Internet layer

Subnets, netmasks and CIDR notation

Easy10MIN

Subnets

Subnet is essentially an IP range, a set of consecutive IP addresses, within which network devices can communicate with each other directly using MAC addresses. If you want to connect a device whose IP address is not in the same subnet, you need a gateway that knows how to route the packet to the recipient in another network. But we will cover gateways and routing in a future module.

Example: Jaska's laptop and phone are in a small subnet with two IP addresses: 192.168.0.5 and 192.168.0.6. The laptop's IP address is 192.168.0.5 and the phone's address is 192.168.0.6.

You can directly connect Jaska's laptop to Jaska's phone using the MAC address (using ARP protocol as we learned earlier) at address 192.168.0.6.

But now Jaska wants to connect to a game server on the Internet at address 1.2.3.4. The IP address 1.2.3.4 does not belong to Jaska's small subnet, so Jaska needs to route to the game server through the Internet.

But how does Jaska's computer know that 1.2.3.4 is not within Jaska's subnet IP range, but 192.168.0.6 is? The answer lies in the IP address combined with the subnet mask set in Jaska's network card settings, which allow Jaska's computer to directly determine that both 1.2.3.4 and even 192.168.0.7 are outside Jaska's network.

1 / 5
Hakatemia Pro

Learn to hack — start here

Hundreds of interactive courses, virtual labs and CTF challenges in your browser. Start a free trial — no card required.