IP Address Range Calculation Logic

3

I want to calculate

  1. Network Address
  2. Address Of First Host
  3. Address Of Last Host
  4. Broadcast address

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

Kanishka Dilshan

Posted 2013-06-06T16:03:19.657

Reputation: 239

With the IP address alone that is impossible. – NickW – 2013-06-06T16:13:40.253

@NickW It really isn't. Assuming the network in question was done correctly. – Austin T French – 2013-06-06T16:32:50.430

Ok, tell me the starting and ending network numbers of this IP address 10.6.23.122. – NickW – 2013-06-06T16:34:41.203

@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... – Austin T French – 2013-06-06T17:43:42.033

Exactly why I say you can't do it with an IP alone... – NickW – 2013-06-07T08:20:39.863

Answers

2

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

Austin T French

Posted 2013-06-06T16:03:19.657

Reputation: 9 766

Thanks for your explanation and links. Those were very helpful for me. – Kanishka Dilshan – 2013-06-06T19:47:58.457