0

I am trying to find exact formula for finding the IP ranges for the below sample input

    10.144.26.192/28

I am getting different IP count in different portals. I used the below online IP range calculator. http://www.gregthatcher.com/Papers/IT/SubnetCalculator.aspx

Subnet Mask is: 255.255.255.240

It shows the result as 14

But in my Azure portal Address count shows 16.

I have created 5 VMs and one load balancer (5+1=6), then run the below powershell command to find free IPs.

  (Test-AzureStaticVNetIP -VNetName “XYZS”-IPAddress 10.144.26.192).AvailableAddresses

It shows only 5 available IPs!! Which is right compared to Azure.

So where is rest of the free IPs? or what is standard to calculate IP/subnet ranges?

What should be my value for X to get 3 subnets each with 10+ IPs

    10.144.26.192/X
  • 2
    The first calculator has given you a result without network ID or broadcast, while Azure has given you one with. Furthermore, your available addresses depend on which subnet mask you actually used, and you haven't posted that explicitly. – Thor Apr 29 '16 at 7:27
  • updated subnet mask. I do not know what is subnet mask and not getting clear info in internet. – kudlatiger Apr 29 '16 at 8:10
  • 5
    I'm voting to close this question as off-topic because Serverfault is a site for professional sysadmins - in the same way as I'm sure the math.stackexchange would expect its users to be able to count to 10 I'd expect SF users to be able to fully understand IPv4 as a minimum requirement - these teach this stuff to 12 years olds these days! – Chopper3 Apr 29 '16 at 9:28
  • It's not necessary that everyone knows about IPv4. I am from c# background and I am doing it on my personal interest. I posted it on Server fault but there was no response. But I got quick answer in "stack overflow". There are 100 questions on networking in "stack overflow" . why they did not get down vote? – kudlatiger Apr 29 '16 at 9:32
  • 1
    I'm not sure it's an off-topic question. In fact the question was legitimate because Azure reserved some specific IP in every VNet that change the number of available IP in a range. May be the title of the question was too generic and didn't mention Azure that's all. – Stanislas Quastana Pro Apr 29 '16 at 9:45
3

Azure reserves some IP addresses within each subnet. The first and last IP addresses of the subnets are reserved for protocol conformance, along with 3 more addresses used for Azure services. So 5 adresses that you cannot use in your VNet

So in your case, 16-6-5= 5 available addresses

Additional info : https://azure.microsoft.com/en-us/documentation/articles/virtual-networks-faq/

  • perfect answer. But what is the standard formula? Is it 2 to the power (32 bits - X ) – kudlatiger Apr 29 '16 at 9:24
  • 1
    Standard formula is : Maximum Number of hosts = 2**(32 - netmask_length) - 2 The reason to subtract 2 above is because the all-ones and all-zeros host numbers are reserved. The all-zeros host number is the network number; the all-ones host number is the broadcast address. In our case, Azure SubNet, the formula is changed to Maximum Number of hosts = 2**(32 - netmask_length) - 5 The reason to subtract 2 above is because the all-ones and all-zeros host numbers are reserved and Azure reserved 3 IP for services. – Stanislas Quastana Pro Apr 29 '16 at 9:40
1

/28 gives you 4 bits for your network addresses. The first address is the network address, the last one is the broadcast address. So you technically have 16 addresses, 14 of which can be used.

A subnet that provides addresses for 14 hosts needs to be a /28 network. So to hold at least 3 of these subnets you need a /26 network.

00001010 10010000 00011010 11100000 # 10.144.26.192 in binary
11111111 11111111 11111111 11100000 # subnet mask of /26

So 10.144.26.192/26 is the network address for the /26. Now, the following two bits are used for addressing the subnets:

00001010 10010000 00011010 11100000
                              ^^

This leaves you with the addresses:

00001010 10010000 00011010 11100000 / 28 # 10.144.26.224/28
00001010 10010000 00011010 11101000 / 28 # 10.144.26.232/28
00001010 10010000 00011010 11110000 / 28 # 10.144.26.240/28
00001010 10010000 00011010 11111000 / 28 # 10.144.26.248/28

I don't know anything about Azure, but this is plain subnetting. You can get additional info here: https://en.wikipedia.org/wiki/Subnetwork

Not the answer you're looking for? Browse other questions tagged or ask your own question.