How subnetting an IPv4 address works

176 views

How subnetting an IPv4 address works

In: 4

3 Answers

Anonymous 0 Comments

In order to understand subnetting you have to understand what a subnet mask is. An IP address has two parts, a network address and the host address. Routers route based on the network address and the last router, the one that ‘owns’ the network, is the one that will ARP (address resolution protocol) to find the MAC address of the host at the host address in question.

But…how does a router know where the network address ends? By something called a subnet mask. Think of an IP address and a subnet mask as two 32 bit parallel arrays divided into 4ths. So you have 4 groups of 8 bits per array. An IP address is going to look like any other binary number, it might look like: 11000000.10101000.00000001.10101000 or in decimal, [192.168.1.55](https://192.168.1.55). The subnet mask is an array that, starting from position 0 (far left) will count out how many bits the network address is by filling in those bits with ones. So the subnet mask might be 11111111.11111111.11111111.00000000 or decimal [255.255.255.0](https://255.255.255.0). That tells us the network address is 192.168.1 and the host address is anything between 1-254. 255 is unusable for reasons that aren’t important to just understand subnetting. The subnet mask is merely a measuring stick.

Say you have been given a /24 network [192.168.1.0](https://192.168.1.0) and you want to *subnet* it. What do you do? You add a bit to the subnet mask. Now your subnet is 11111111.11111111.11111111.10000000 or [255.255.255.128](https://255.255.255.128). You have now divided your network [192.168.](https://192.168.0.1/24)1.0/24 into [192.168.1.0](https://192.168.1.0) AND [192.168.1.128](https://192.168.1.128). You now have two different network addresses i.e. two different networks. You subdivided one larger network into two smaller ones.

This is what confuses people is that when you *subnet* a network, the bit you steal changes your network address and you get a smaller network, but the rest of your range doesn’t just poof into nothingness. The more bits you steal from the host addresses, the more networks you create, but they get smaller in successive half minus two increments. You can do the opposite and take bits away from the subnet mask and you create fewer networks with larger host ranges in increments of double minus two.

You are viewing 1 out of 3 answers, click here to view all answers.