SubnettingPractice.com The most extensive subnetting practice site on the web!

How To Subnet

The Quick and Easy

There are 2x subnets in a network, where x is the number of borrowed subnet bits.

There are 2h-2 usable hosts in a network, where h is the number of host bits.

The block size for a subnet is 256-subnet mask value. Start at zero and count in block sizes. Every block size will be a new network address.

The broadcast address is one less than the next network address. Count in block sizes.

The usable hosts are between the network address and the broadcast. So the usable hosts the block size plus one through the next block size minus two.

Confused? The best way to learn subnetting is to practice! Start with the basics and go from there.

A Bit More Depth

Learning how to subnet accurately and quickly are keys to success in the IT field and also to passing IT certifications, such as the CCNA. We subnet to avoid having one large network. A single giant network would be an unmanageable mess.

All subnetting is done in binary, however, because we humans are used to a base-ten system, we translate things into decimal numbers. This makes life a lot easier. It is important to understand the binary behind the decimal. Without understanding the binary, it is difficult to understand why we calculate network masks, broadcast addresses, etc. the way we do.

A binary digit is called a bit. It represents a 1 or a 0. An IPv4 address has 32 bits, and an IPv6 address has 128 bits, but let's stick with IPv4 for now. Each IPv4 address is split up into four octets separated by periods. Each bit represents a power of 2. An octet is a group of 8 bits and can have a value ranging from 0 to 255. If you do not know how to count in binary, or convert binary into decimals, and vice versa you should check out the Binary Practice page.

OK, so an IP address is 32 bits. This address is then divided into two parts, the subnet bits and the host bits. The subnet bits show what network a device is on, and the host bits define the individual device. Think of a telephone number, you have an area code and then the number. The area code can be thought of as the subnet bits. Many people who live near one another share an area code, but they all have an individual phone number. The same is of devices on a subnet. They all share the same subnet bits, but then each one has an individual combination of host bits.

The way we know which part of the IP address is the subnet bit part and which part is the host bit part is using a subnet mask. A subnet mask (or net-mask) is made up of 32-bits, like a regular IP address, but is used only to divide the subnet bits from the host bits. The subnet bits are all 1s and the host bits are all 0s. So a subnet mask might be 11111111.11111111.1111111.00000000, which in decimal should be 255.255.255.0. This would specify that any IP address with that subnet mask will have the first three octets be used as subnet bits, and the last octet will be used for host bits.

You can have subnets inside of subnets. That's essentially what subnetting is; dividing blocks of IPs into smaller blocks. To do this you 'borrow' bits from the host range and add them to the subnetting bits. For example, you can split the above 255.255.255.0 into 4 subnets with the subnet mask of 255.255.255.192. "Wait, what??" Well, lets look back at the binary subnet mask for 255.255.255.0: 11111111.11111111.11111111.00000000. We can 'borrow' two bits from the host bits and create a net subnet mask of 11111111.11111111.11111111.11000000. Changing those two bits from 0s to 1s makes the last octet equal to 192. (Don't get it? Practice your Binary.) By 'borrowing' those bits you can now create four new subnets within your original subnet. Why four? Because those two bits have four different possible combinations. You can have 00, 01, 10, 11. This number will always be 2x where x is the number of 'borrowed' subnet bits.

Now we know how many subnets we can create, but how many IPs does each subnet have? That is calculated the same way, only using the host bits. We have 6 host bits left (all the zeros) so we just find 2y where y is the number of host bits. 26=64. But wait! That is how many IPs a subnet has, not how many usable hosts a subnet has. Every subnet must have a network address and a broadcast address, and neither of those can ever be used by a host. So the usable hosts is actually 2y-2 where y is the amount of host bits. In this case there are 62 usable bits per subnet. As you can see, learning your powers of two is key to subnetting quickly.

The network address is used to identify the network that you are working on and the broadcast IP is used to send messages to every device on that subnet. The network address is always the very first IP address of a subnet, and the broadcast is always the very last IP address of a subnet. In other words, for a network address is the IP address where all the host bits are set to 0 and the broadcast address is the IP address where all the host bits are set to 1.

IP address classes

Though the class system of IP ranges has been replaced by CIDR, many people still talk about the five classes of IP address range. Only three are really important.
Class A addresses use the first octet for networking and the last three octets as host bits. The first octet range is 1-126 (or any ip address where the first bit is a 0).
Class B addresses use the first two octets for networking and the last two for host bits. The first octet range is from 128-192 (the first two bits are 10).
Class C addresses use the first three octets for networking and the last octet for host bits. The range of the first octet is 192-223 (the first three bits are 110 in binary).
There are also Class D and E addresses which go from 224-239 and 240-255 and are used for multicast and experimental uses, respectively.

Private IP ranges are:

Class Size Subnet Mask Range of IPs
Class A 10.0.0.0/8 255.0.0.0 10.0.0.0 - 10.255.255.255
Class B 172.16.0.0/12 255.240.0.0 172.16.0.0 - 172.31.255.255
Class C 192.168.0.0/16 255.255.0.0 192.168.0.0 - 192.168.255.255
Though classful IP addresses are largely a thing of the past, these private ranges are still in existence and must be known by an IT professional. They are used for internal network only not routable through the Internet.

You may also want to read up on IPv6.

Copyright 2014 SubnettingPractice.com. All rights reserved