Networking
Subnets

The University of Findlay's College of Education

To reduce the overall amount of traffic created when computers communicate across the network, the network addressing system determines which packets are to stay inside the local network and which packets need to go outside the network. The router is the hardware component of the network that accomplishes this task. The router distinguishes internal traffic from external traffic by looking at the destination IP address and subnet mask.

The IP address is divided into two parts. These parts are the NETWORK and HOST. The subnet mask determines how much of the IP address belongs to each part. All IP addresses not in the LAN's subnet are sent outside the LAN.

Here is how a subnet works. Suppose computer one sends a message to computer two. The router looks at computer one's IP address (10.10.10.100) and it's subnet mask (255.255.255.0). The subnet "mask" covers the computer's network portion of the IP address. If a subnet mask contains a 255, it means that number is the only number that can be in that octet. The 255.255.255.0 subnet mask defines computer one's network as an IP addresses beginning with 10.10.10. The fourth number can be any number between 0 and 255. Computer two has an IP address that falls within this IP range. So these two computers are part of the same network. The router prevents this local traffic from leaving the network.

If computer one sends a message to computer four, the router determines that these two computers are not part of the same network. Computer four has an IP address that starts with 10.100.30. This is a network outside of computer one's LAN. So the router sends the traffic outside the LAN.

To determine if two computers are on the same network, the "network" portion of the IP address must be determined. If this portion of the IP address is the same for two computers, the computers are "on the same network".

Remember that IP addresses are made of four octets. The octets need to be written in binary.

28=256 so there are 256 different possible numbers in each octet, the highest being 11111111 (eight ones). The first number in the sequence is zero and highest possible number is 255. This makes for a total of 256 possible numbers.

A common subnet mask in schools is 255.255.255.0 Written in binary, this subnet mask will look like this:

255 255 255 0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0

When written in binary, subnet masks must have consecutive one's or zero's. The above subnet has 24 one's in a row. This subnet is commonly referred to as a 24-bit subnet mask, and may be written with short-hand notation with a /24 after an IP address.

192.168.100.50/24 is another way of writing 192.168.100.50 with a subnet mask of 255.255.255.0

To calculate the network portion of the IP address, the IP address and the subnet mask must both be written in binary, and multiplied together.

Here are the binary numbers for an IP address of 192.168.100.50 with a subnet mask of 255.255.255.0

192.168.100.50 1 1 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 1 1 0 0 1 0 0 0 0 1 1 0 0 1 0
255.255.255.0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0
Multiply Down Column 1 1 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0

To determine the network, multiply down each column (this is a logical AND). The multiplication is simple... 1x1, 1x0 or 0x0. Writing it all out is the hard part.

Translate the answer back to decimal and it is 192.168.100.0

All non-zero numbers in the subnet mask make up the "network" portion of the IP address. So this computer's network is the 192.168.100 network. Any computer with the same subnet mask, and these first three (192.168.100) will be a part of the same network segment.

The following IP numbers are on this network.

IP Mask
192.168.100.1 255.255.255.0
192.168.100.51 255.255.255.0
192.168.100.254 255.255.255.0

There are a total of 256 numbers on this network. The last octet can be anything from zero to 255. Looking back at the rules of TCP/IP, no IP address can contain a 255, and no IP address can start or end with a zero. This eliminates 192.168.100.0 and 192.168.100.255 from the 256 possible, making the total number of IP addresses in this network equal 254.

Subnet masks usually start with 255. Each octet may end with one of these numbers:

Valid # Example Subnet Mask Number of Computers in Network
255 255.255.255.0 256-2=254
254 255.255.254.0 (2x256)-2=510
252 255.255.252.0 (4x256)-2=1022
248 255.255.248.0 (8x256)-2=2046
240 255.255.240.0 (16x256)-2=4094
224 255.255.224.0 (32x256)-2=8190
192 255.255.192.0 (64x256)-2=16382
128 255.255.128.0 (128x256)-2=32766