

If a computer and router have a subnet mismatch a lot of weird stuff can happen.

What happens if the subnet does not match the associated router IP address? We can calculate the amount of valid host addresses as our magic number, 16, multiplied by 256 per octet to the right, subtracting 2 lastly.ġ. We now also know that our broadcast address is 66.52.3.31, and that the next subnet range will begin at 66.52.3.32, giving a valid host range of 14. Using this logic, we know that address 66.52.3.30 is within the network of 66.52.3.16, because the host range of the subnet extends from 66.52.3.17 through 66.52.3.30. In other words, we know we would have network addresses of 66.52.3.0, followed by 66.52.3.16, followed by 66.52.3.32, and so on. Our magic number is calculated from the 4th binary octet, so we know our subnets calculate in intervals of 16 from the 4th octet. To get our "magic number", we subtract 240 from 256, resulting in 16. Let's assume we are working with an IP of 66.52.3.30 and a subnet mask of 255.255.255.240. Assuming we have our subnet mask, perhaps using a lookup chart such as the cheatsheet at the bottom, we instead want to find our leftmost number that isn't 255. Now that we have examined the binary method, let's take a look at a simpler way of calculating the same subnet properties. We can calculate the amount of valid host addresses as rightmost bit value, 8, multiplied by 256 per octet to the right, subtracting 2 lastly.Įven Simpler Calculations with the Magic Number Method Since the first and last IP addresses are reserved for the network and broadcast addresses, the host address range (all valid addressable IPs) would be 192.168.0.1 through 192.168.7.254, giving a total of 2,046 valid host addresses (calculated as (8 x 256) - 2). Now we also know our broadcast address, which is always the last IP address in the range (192.168.7.255). The rightmost bit corresponds to 8, which indicates our range. More specifically, we look at whichever our rightmost octet is which contains 1 values, and then the value of our rightmost bit. We calculate this by once again looking at the bits assigned in our network mask octets, and keeping in mind the binary values of each.

Now, lets look at the range of this network. This is done with a bitwise AND operation, so the IP needs to be represented as binary as well, 11000000.10101000.00000000.00010111. Now that we have our subnet mask, lets calculate the network address, which is the very first IP in a subnet range. Simple Calculations with the Binary Method Like IPs, subnet masks are comprised of four binary octets. The portion preceding the "/" would be the IP, and the portion afterwards indicates the amount of subnet mask bits. When running commands such as ipconfig or ifconfig you may be given your IP and subnet mask but let's assume that we are working with a classless IP displayed as 192.168.0.23/21 and that you have to calculate the subnet mask yourself. In other words, “What is the network for for IP /XX? What is the IP range of this network?”, and so on. While this post will not go into detail on the benefits or implementation of subnetworks, it is important to be able to calculate subnetwork ranges, network addresses, and broadcast addresses. This has many benefits, such as speed increases, easier administration, and increased options for maintaining security. Subnetting is the product of logically dividing up a network up into smaller, modular networks. Hopefully this quick and dirty reference helps in it’s own way! For a more in depth overview I would highly recommend reading A Dive Into Subnetting, which wrote. I recently wrote up some information on subnetting, and figured I would share it.
