CIDR IP Assignment

25.7k views Asked by At

A large number of consecutive IP address are available starting at 198.16.0.0. Suppose that four organizations, A, B, C and D request 4000, 2000, 4000, and 8000 address, respectively, and in that order. For each of these, I need to give the first IP address assigned, the last IP address assigned, and the mask int the w.x.y.z/s notation. Please explain for each organization.

3

There are 3 answers

8
CustomX On

I'm going to keep it short. You should learn the basics of subnetting by Googling for information, I can suggest Cisco for excellent learning material. Your network, 198.16.0.0 /16, offers you 16 bits to use as subnet/host bits. This entire network offers a bit more than 65.000 hosts.

Step 1 - Sort your subnets, starting with the subnet requiring the most amount of hosts. 8000, 4000, 4000, 2000

Step 2 - How many host bits do you need for 8000 usable hosts? 13 host bits: 2^13 = 8192 hosts - 2 = 8190 usable hosts

Step 3 - We know we need 3 subnet bits, so we can add 3 towards the 16. Our new subnet mask for this subnet is /19. Now we'll need to use binaries to figure out the complete first subnet. All zeroes in the host part gives you the network id and all ones in the host part gives you the broadcast id.

198.16.000|00000.00000000 = 198.16.0.0
198.16.000|11111.11111111 = 198.16.31.255

Step 4 - Your subnet for Organisation with 8000 usable hosts is 198.16.0.0/19.

Network ID: 198.16.0.0 
First usable host: 198.16.0.1 
Last usable host: 198.16.31.254 
Broadcast ID: 198.16.31.255

Now we repeat those steps for the remaining 3 Organisations.

Step 1 - We know our next subnet needs to support 4000 usable hosts.

Step 2 - How many host bits do you need for 4000 usable hosts? 12 host bits: 2^12 = 4096 hosts - 2 = 4094 usable hosts

Step 3 - We know we need 4 subnet bits, so we can add 4 towards the 16. Our new subnet mask for this subnet is /20. Now we'll need to use binaries to figure out the complete first subnet. All zeroes in the host part gives you the network id and all ones in the host part gives you the broadcast id. Because we have already subnetted the network, we start where we ended.

198.16.0010|0000.00000000 = 198.16.32.0
198.16.0010|1111.11111111 = 198.16.47.255

Step 4 - Your subnet for Organisation with 4000 usable hosts is 198.16.32.0/20.

Network ID: 198.16.32.0
First usable host: 198.16.32.1
Last usable host: 198.16.47.254
Broadcast ID: 198.16.47.255

I have shown you the way for the first two. You can do the last two yourself as practice. Remember to first do the subnet with 4000 hosts and then the subnet with 2000 hosts. If you have any questions, don't hesitate to ask.

0
danmaze On

To start with, all the requests are rounded up to a power of two. The starting address, ending address, and mask are as follows 1:

A: 198.16.0.0 – 198.16.15.255 written as 198.16.0.0/20

B: 198.16.16.0 – 198.16.23.255 written as 198.16.16.0/21

C: 198.16.32.0 – 198.16.47.255 written as 198.16.32.0/20

D: 198.16.64.0 – 198.16.95.255 written as 198.16.64.0/19

1
Stanislav Voytas On

Now, a few years after this question was asked I was struggling with the same task. Actually it is a problem from Andrew Tanenbaums Computer Networks Book and you are not allowed to sort stuff :)

To solve this one you need to do as follows:

You are starting with 198.16.0.0 Now company A requests 4000 IPs. You have to round this number (and any later request too) up to a power of two - 4096.

Now let's think: An IP-address consists of 32 Bit. Some of them are network Bits and some are host Bits (if this is new for you read this). How many host Bits do you need, so company A gets 4096 hosts? Right: log²(4096) = 12. So the remaining 20 Bits (32-12) are reserved for the network. Now we already have the start IP-address for company A and also the subnet mask: 198.16.0.0/20 (again if this confuses you read the link above). Now we need to determine the last IP-address for company A. To do so we look at our IP and subnet-mask in binary (consider "|" the boundary between network part and host part of the ip-address):

Start-IP (A):
11000110.00010000.0000|0000.00000000
Subnet-Mask(/20):
11111111.11111111.1111|0000.00000000

As you can see, now you have 12 Bits for your hosts, all of them are free to change so you have all in all 2^12 possibilities = 4096.. The last available IP would be the one, where all hosts are equal to 1:

End-IP: 11000110.00010000.0000|1111.11111111 In dezimal this would look like: 198.16.15.255

Now let's look at company B: it requests 2000 - we round it up to the power of two: 2048

log²(2048)= 11 host-bits = 21 network-bits = /21

Now remember the last IP we assigned to A was:

End-IP: 11000110.00010000.00001111.11111111

So the next available one should be bigger by at least 1 right?

11000110.00010000.00001111.11111111 +1 = 11000110.00010000.00010000.00000000 = 198.16.16.0 We should be able to use this one as the start IP for company B

Lets try this out with our netmask of /21:

Start-IP (B):
11000110.00010000.00010|000.00000000
Subnet-Mask(/21):
11111111.11111111.11111|000.00000000

Seems to be working! We have 11 host Bits so we can connect 2^11 hosts =2048. The last usable IP-address however will be the one where all host bits are equal to one:

11000110.00010000.00010|111.11111111 = 198.16.23.255

Now with company C things start to get complicated, please bear with me: The problem here is, that they require more IPs then their predecessor. But we will handle it anyway :)

Company C wants 4000 IPs we round it up to 4096 and calculate the number of hosts bits as before: hosts=20.

Now we will try the same approach as before, so that you can see the problem:

We take the last assigned IP-address and increment it by one:

11000110.00010000.00010111.11111111 + 1=

11000110.00010000.00011000.00000000

Now let us apply our netmask of /20 on this IP:

Start-IP (B):
11000110.00010000.0001|1000.00000000
Subnet-Mask(/21):
11111111.11111111.1111|0000.00000000

Now you should see the problem:

We have have a 1 in our host-bit section. Therefore we can not use all 12 Bits but only 11 which would give us only 2^11 =2018 hosts.

So you might wonder: What if we just turn the 1 in the host part to a 0? Well in that case you would completely collide with the IP-addresses you provided to company B. So this is not an option. The only way is to "push" the 1 in to the network-bit section by applying the increment to the network section only, so that instead of:

11000110.00010000.0001|1000.00000000

you get (incrementing network part only: 11000110.00010000.0001 + 1)

11000110.00010000.0010|0000.00000000

which is equal to 198.16.32.0

the last ip would be again, where all host-bits are equal to 1 so

198.16.47.255

Now you can do the same thing with company D :)

The results should be:

A: 198.16.0.0 – 198.16.15.255 written as 198.16.0.0/20
B: 198.16.16.0 – 198.16.23.255 written as 198.16.16.0/21
C: 198.16.32.0 – 198.16.47.255 written as 198.16.32.0/20
D: 198.16.64.0 – 198.16.95.255 written as 198.16.64.0/19