Subnets and the Network Mask

Netmasks, which travel hand-in-hand with IP addresses when configuring TCP/IP on a machine, are one of the most misunderstood parts of the whole structure, and yet potentially one of the most elegant when understood properly.

The purpose of the network mask (or netmask) is simply to tell a router or host whether a packet is supposed to go to the network it's on, or go upstream to the next router. This is the decision that is made in a situation such as the one we just discussed in the section on ARP. When a router receives a packet (not an ARP, a real TCP/IP packet), and it has to decide what to do with it, it checks the packet's destination IP address against its own netmask.

The netmask, a 32-bit string like an ...

Get FreeBSD® Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.