Subnet and netmask

An IP address can be split into 2 different parts – the network- and the host-part.

When/How this partition is happening is defined via the netmask, which is built by the same 32 bit as an IP address (therefore in a range between 0.0.0.0 and 255.255.255.255)

The network part can be seen from left to right, the host part from right to left.

Example

Netmask 255.255.255.0 – Short /24
Available IP addresses in this subnetwork: 254

This means if we define a network with 192.168.0.0 the first 3 numbers 192.168.0 are the network part and the last number 0 is the host part.

Theoratically there are 256 IP addresses available, but the first and last IP address inside a subnet are predefined. With our example of a /24 subnet

192.168.0.0 => Network address
192.168.0.255 => Broadcast address

That why we “only” have an actual useable area between 192.168.0.1 and 192.168.0.254 which sums up to a maximum of 254 usable addresses.

If we want to have more than 254 concurrent clients inside a given network we have to decrease the netmask. See the following table:

Netmaskusable IPv4 addressesNetmask visualized as bits
255.0.0.0(/8)max. 16.777.2141111’1111.0000’0000.0000’0000.0000’0000
255.240.0.0 (/12)max. 1.048.5741111’1111.1111’0000.0000’0000.0000’0000
255.255.0.0 (/16)max. 65.5341111’1111.1111’1111.0000’0000.0000’0000
255.255.240.0 (/20)max. 40941111’1111.1111’1111.1111’0000.0000’0000
255.255.248.0 (/21)max. 20461111’1111.1111’1111.1111’1000.0000’0000
255.255.252.0 (/22)max. 10221111’1111.1111’1111.1111’1100.0000’0000
255.255.254.0 (/23)max. 5101111’1111.1111’1111.1111’1110.0000’0000
255.255.255.0 (/24)max. 2541111’1111.1111’1111.1111’1111.0000’0000
255.255.255.128 (/25)max. 1261111’1111.1111’1111.1111’1111.1000’0000
255.255.255.192 (/26)max. 621111’1111.1111’1111.1111’1111.1100’0000
255.255.255.224 (/27)max. 301111’1111.1111’1111.1111’1111.1110’0000
255.255.255.240 (/28)max. 141111’1111.1111’1111.1111’1111.1111’0000
255.255.255.248 (/29)max. 61111’1111.1111’1111.1111’1111.1111’1000
255.255.255.252 (/30)max. 21111’1111.1111’1111.1111’1111.1111’1100
255.255.255.254 (/31)2 as P2P1111’1111.1111’1111.1111’1111.1111’1110
255.255.255.255 (/32)None1111’1111.1111’1111.1111’1111.1111’1111

But of course you can use multiple subnetworks and combine them with each other via a Router.

Why do we need subnetworks?

Subnetworks are needed so clients know if an IP-packet should be redirected only in the local network or if it should be handled by a router (and therefore redirected to another network).

Share this post

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.