Subnet mask
A subnet mask is used to divide the network classes into even finer sections. Like the IP address, the subnet mask is represented by 4 decimal numbers separated by decimal points.
Each decimal number stands for 1 byte (8 bits) of the subnet mask and can also be represented using binary code:
Example of a subnet mask: 255.255.255.128 | ||
|---|---|---|
Byte | Decimal | Binary |
1 | 255 | 11111111 |
2 | 255 | 11111111 |
3 | 255 | 11111111 |
4 | 128 | 10000000 |
The binary representation of the IP address and the subnet mask shows that in the subnet mask, all bits of the network address are set to 1 and only the bits of the node addresses have the value 0:
IP address: 192.168.10.129 | Subnet mask: 255.255.255.128 | |
|---|---|---|
Meaning | Bytes 1 – 4 | Bytes 1 – 4 |
Network address | 11000000 | 11111111 |
10101000 | 11111111 | |
00001010 | 11111111 | |
Node address | 10000001 | 10000000 |
The class C network with the network address 192.168.10 is further subdivided into the following 2 networks by the subnet mask 255.255.255.128:
Network address | Node addresses |
|---|---|
192.168.10.0 | 192.168.10.1 – 192.168.10.126 |
192.168.10.128 | 192.168.10.129 – 192.168.10.254 |
The network nodes use a logical AND operation for the IP address and the subnet mask to determine whether there is a communication partner in the same network or in a different network. If the communication partner is in a different network, the standard gateway is addressed for passing on the data.