A subnet of an IP network has a range of IP host address from
172.19.40.1 to 172.19.47.254.
- What is the maximum number of host addresses that can exist on this subnetwork?
I'm googling but not found a clear answer. how should we compute maximum number of host addresses?
Best Answer
Method 1
Let's use a simple method to find this...
IP addresses contain four 8-bit integers; 8-bit integers have a maximum value of 255. Think of it like this... if we merely build a sequence of third-octets from 40 to 47 and account for the hosts, we'll find the answer with minimal math...
Number of hosts = 2*255 + 6*256 = 2046 hosts
Method 2
Use this method to find the number of hosts between two arbitrary IP addresses... convert the two 32-bit IP addresses to integers and subtract...
2886938622 - 2886936577 + 1 = 2046 hosts
Note that I added an extra host in the subtraction, since you're including the first host in the list of available hosts.
As someone mentioned below you can also use the host bits of the netmask, if you're merely calculating the number of hosts in an IP CIDR block.
How to convert an IPv4 addess to decimal:
172*256**3 + 19*256**2 + 40*256**1 + 1*256**0 = 2886936577