# subnetting basics

If we checkout the ipconfig (in windows) or in linux (ip addr show) we should find a ip and a subnet-mask if we got one. As well there is a standard-gateway. In the following I will describe how this works and what this will tell you about your network.

With IPv4 the unit of all ip-addresses are capped and in the future we will swap to  IPv6 because of this cap.

If we have a network like 192.168.0.0 /24 you will note the “/24”. This means that the network uses 24 bit to declare the network. The rest of the bits is for the hosts (and network address and broadcast).

8 bits . 8 bits . 8 bits . 8 bits
The first 24 bit are for the network and the last 8 are for the hosts, network and broadcast address.

Now we want to split this network into 56 parts. After this we should have 56 networks. To do this we need to find out the value that you can put in n in 2^n >= the needed unit of the networks. So:

2^n >= 56
2^6 >= 64 … so we will take the 6

So now we check out the values of the last 8 bits that we have to use:

bit 8 -> 2^0 -> 1
bit 7 -> 2^1 -> 2
bit 6 -> 2^2 -> 4
bit 5 -> 2^3 -> 8
bit 4 -> 2^4 -> 16
bit 3 -> 2^5 -> 32
bit 2 -> 2^6 -> 64
bit 1 -> 2^7 -> 128

With this information we take n (6) and check out the bit of this (marked big). So now we now that we have 4 IP address for every network if we want to split it into 56 networks.

As well we should know:

• The first IP address in a network describes the network

So for example the first network of 56 would be like: