# IP Address Range Calculation Logic

I want to calculate

when an IP address of the network is given. is there any standard calculate to solve this question?

I could find the following site supports in solving above question. http://www.csgnetwork.com/ipinfocalc.html

-
With the IP address alone that is impossible. – NickW Jun 6 '13 at 16:13
@NickW It really isn't. Assuming the network in question was done correctly. – AthomSfere Jun 6 '13 at 16:32
Ok, tell me the starting and ending network numbers of this IP address 10.6.23.122. – NickW Jun 6 '13 at 16:34
@NickW What is your subnet? Assuming 255.0.0.0 / 8 then 10.0.0.0 address, 10.0.0.1 first and last host 10.255.255.254 or 10.255.255.255 for braodcast... – AthomSfere Jun 6 '13 at 17:43
Exactly why I say you can't do it with an IP alone... – NickW Jun 7 '13 at 8:20

This requires a decent understanding of subnetting, and I will give a birds eye view of how to guess-timate.

Your subnet and IP addresses are inverse binary numbers that are in dot-decimal format. (If everything is using standard ranges.

The subnet 255.255.255.0 == 11111111 1111111111 11111111 00000000 in decimal, which means you have 256 IPs available (0 - 255).

Using standard subnetting we can assume with an IP of 192.168.1.101 as a client's IP that:

Our network address should be 192.168.1.0 Our first address (And likely Gateway) is the first address in that range 192.168.1.1 Our Broadcast address is always the last number in the range 192.168.1.255 Our last useable address for clients is the broadcast - 1, or 192.168.1.254

This really is a very high level, and not perfect explanation as it is decently involved.

For help with the math: Look at how to calculate your address, easily script-able.

Here is a good intro to subnetting as well

-
Thanks for your explanation and links. Those were very helpful for me. – Kanishka Dilshan Jun 6 '13 at 19:47