# IP address calculation [duplicate]

ISP grants block of addresses starting with 190.100.0.0/16. It needs to distribute IP's to customer as:-

a)First group has 64 customers, each with 256 addresses.

b)Second group has 128 customers, each with 128 addresses.

c)Third group has 128 customers, each with 64 addresses.

What are the address ranges for each group ?

The solution says that for 1st group we allocate IP addresses from 190.100.0.0/24 (1st customer) to 190.100.63.255/24(last or 64th customer).

My doubt is how is network id 24? 190.100.0.0 can be written as 190.100.00000000.00000000 . I think that the bold part acts as a subnet ID which is given to each group by the ISP and the remaining (32-(16+2))=14 should be the host ID.

So if we consider 1st group then starting address will be 190.100.00000000.00000000/18 and ending address should be 190.100.00111111.11111111/18 which is the same address range as given in the solution except for the number of bits in the network ID part which I think should be 18 (16+2).

Also, for the 2nd group we can have subnet ID as 01 and have address range as 190.100.01000000.00000000/18 to 190.100.01111111.11111111/18 but here the solution says netid part should have 25 bits.

Where am I going wrong?

PS:- This is not an homework question. It is a solved example in forouzan book which I am trying to understand.

## 2 Answers

The book mentions /24, /25 and /26 as they are for each customer in 1st, 2nd and 3rd group, respectively.

What you are concerning (/18, /19 and /19) is for each group (1st, 2nd and 3rd group, respectively).

``````##First Group:      190.100.0.0/18      (190.100.0.1        -   .63.255     /18)

Customer 1:     190.100.0.0/24      (190.100.0.1        -   .255        /24)
Customer 2:     190.100.1.0/24      (190.100.1.1        -   .255        /24)
...
Customer 64:    190.100.63.0/24     (190.100.63.1       -   .255        /24)

##Second Group:     190.100.64.0/18     (190.100.64.1       -   .127.255    /18)

Customer 1:     190.100.64.0/25     (190.100.64.1       -   .127        /25)
Customer 2:     190.100.64.128/25   (190.100.64.129     -   .255        /25)
Customer 3:     190.100.65.0/25     (190.100.65.1       -   .127        /25)
Customer 4:     190.100.65.128/25   (190.100.65.129     -   .255        /25)
...
Customer 127:   190.100.127.0/25    (190.100.127.1      -   .127        /25)
Customer 128:   190.100.127.128/25  (190.100.127.129    -   .255        /25)

##Third Group:      190.100.128.0/19    (190.100.128.1      -   .159.255    /19)

Customer 1:     190.100.128.0/26    (190.100.128.1      -   .63         /26)
Customer 2:     190.100.128.64/26   (190.100.128.65     -   .127        /26)
Customer 3:     190.100.128.128/26  (190.100.128.129    -   .191        /26)
Customer 4:     190.100.128.192/26  (190.100.128.193    -   .255        /26)
...
Customer 125:   190.100.159.0/26    (190.100.159.1      -   .63         /26)
Customer 126:   190.100.159.64/26   (190.100.159.65     -   .127        /26)
Customer 127:   190.100.159.128/26  (190.100.159.129    -   .191        /26)
Customer 128:   190.100.159.192/26  (190.100.159.193    -   .255        /26)
``````
• Is it like subnetting inside subnetting? For ISP, these groups are subnets and for each group, all customers are different subnets with each customer(subnet) having many addresses ? Oct 11 '17 at 9:47
• @Zephyr Likely. Oct 11 '17 at 9:54

The ISP has granted 190.100.0.0/16. The /16 part means that the range granted is:

from `190.100.0.0` to `190.100.255.255`.

That whole range can be subnetted as you want according to your needs.

• The first group is:

64 customers with 256 addresses. Remember that 256 = 2^8.

It means that to allocate 256 addresses you will need 8 bits. From the full 32 bits of an IPv4 adddress, 8 bits will go to host and the remaining 24 will be network. Then each of the 64 networks should use /24.

``````First network:   190.100.0.0/24 (190.100.0.0 - 190.100.0.255)
Second network:  190.100.1.0/24 (190.100.1.0 - 190.100.1.255)
.
.
.
Last network:  190.100.63.0/24 (190.100.63.0 - 190.100.63.225)
``````
• The second group is:

128 customers, each with 128 addresses. 128=2^7.

To allocate 128 addresses you will need 7 bits. From the full 32 bits of the IPv4 adddress, 7 bits will go to host and the remaining 25 will be network. Then each of the 128 networks should use /25.

As the last address of the first group is `190.100.63.255` then we have to start from `190.100.64.0`:

``````First network:   190.100.64.0/25   (190.100.64.0 - 190.100.0.127)
Second network:  190.100.64.128/25 (190.100.64.128 - 190.100.64.255)
Third network:   190.100.65.0/25   (190.100.65.0 - 190.100.65.255)
Fourth network:  190.100.65.128/25 (190.100.65.128 - 190.100.65.255)
.
.
.
Last network:    190.100.127.128/25 (190.100.127.128 - 190.100.127.225)
``````
• What is the subnet id in your division ? And why is my subnetting wrong ? Oct 11 '17 at 9:25
• @Zephyr /16 means first 16 bits to host and the remaining 16 to network. I don't know why you are separating two bits for host id Oct 11 '17 at 9:33