A netmask separates the network portion of an IP address from its host portion. Hosts use it to determine whether a destination belongs to the local LAN or requires communication through the default gateway. section 4.1
Recognize netmasks in common host configuration and routing output:
- 255.255.255.0 is equivalent to /24 and identifies the 192.168.1.0 LAN for an address such as 192.168.1.226. section 4.3.2 section 4.3.3
- A host receives its netmask alongside an IP address, default gateway, and DNS server; DHCP automates delivery of these settings. section 4.1
- The netmask also appears in connected-LAN routes, such as 255.255.255.0 for 192.168.1.0. section 4.3.3
Reading a host configuration
In Linux output, `inet 192.168.1.226 netmask 255.255.255.0` identifies the host address and its /24 netmask. macOS may display the same mask as `0xffffff00`. section 4.3.2 section 4.3.3
jeremy@linuxpc ~ $ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.226 netmask 255.255.255.0 broadcast 192.168.1.255 #1
inet6 fe80::5054:ff:fe17:7862 prefixlen 64 scopeid 0x20<link>
ether 52:54:00:17:78:62 txqueuelen 1000 (Ethernet) #2
. . .
jeremy@linuxpc ~ $ route
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0 #3
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 #4
. . .
#1 linuxpc’s IP address is 192.168.1.226/24.
#2 linuxpc’s MAC address is 52:54:00:17:78:62.
#3 A default route
#4 A route to linuxpc’s connected LAN
Inspect annotated Linux interface and routing output showing the netmask, broadcast address, connected LAN, and default route. section 4.3.3

