Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I know how to do the classic "network addressing" when I am allowed to waste IP addresses. For example, if I need to hook up 9 computers, I could use a /28 subnet, which allows 16 hosts to be mapped within it see the Wikipedia article on CIDR for details.

But what if I am asked to minimize the number of wasted IP addresses?

For example in this case:

enter image description here

Imagine, there is a network 6 which has 8 computers. We see that if the IP address wasting was not allowed, then the network 6 would use the unused range: 12.0.2.128 - 12.0.2.255

So, the network 6 would look like this:

  1. network address: 12.0.2.128
  2. subnet mask: 28
  3. 1st address of network: 12.0.2.129
  4. last address of network: 12.0.2.142
  5. broadcast: 12.0.2.143

What if there is additional network 7 with only 10 computers?

Am I limited to only one CIDR subnet / network for each free unused range, or am I allowed to "put" as many different subnets as can possibly fit within the free unused address range?

share|improve this question

3 Answers 3

when I am allowed to waste IP address ranges

I'm taking this to mean you are required to pick the smallest subnet that will accomodate the number of nodes you want to put in it

we see that if the IP address wasting was not allowed, then the network number 5 would be different. It would use the unused range: 12.0.2.127 - 12.0.3.0

Network 5, if you really need to conserve addresses in this fashion - that'd be 12.0.2.129 - 12.0.2.254. with 12.0.2.255/25 being the broadcast address.

A network 6 with 10 computers require the "nearest greatest power of 2" bits for each to have an address, which is 16 (0-15). 0-15 wants 4 bits.

12.0.4.128/25 is the next available, so you could do 12.0.4.128/28. 12.0.4.129 is the first available address, and 12.0.4.143/28 is the broadcast address.

share|improve this answer
    
You need seven bits (which provide 128 values) to handle 78 nodes (64 <= 78 <= 128). /25 gives you 7 bits for hosts (32 - 25 = 7). The subnet mask doesn't split on anything more granular than even powers of 2. It's the best you can do, and you always want room for expansion anyway. –  ultrasawblade Aug 5 '13 at 17:48

I don't know what you mean by IP address space waste. For example, network 3 has 78 machines but 126 usable addresses. If you didn't want to have unused IPs in that subnet, just assign available IPs to new interfaces.

In you example, there is a subnet not being used: 12.0.2.128/25.

The subnet rules are simple for v4 addresses. A v4 address has 32 bits. A subnet netmask tells you how many of those bits are fixed and not available within the subnet. The remaining bits are part of the subnet address. The first address in the subnet has all zero bits, and the last address in the subnet has all one bits. Subnets are like loves of bread in that the ends are different than the middle. The all-zeros subnet address--the first address in the subnet--is the name of the subnet. The all-ones subnet address--last address in the subnet--is the broadcast address.

Example A: 172.168.204.0/24 24 bits fixed, 8 bits in the subnet address. 
Subnet name and first address: 172.168.204.0 
Subnet broadcast and last address: 172.168.204.255 
Available addresses within the subnet: 172.168.204.1 ... 172.168.204.254

Example B: 10.1.5.4/30
30 bits fixed, 2 bits in the subnet address.
Subnet name and first address: 10.1.5.4
Subnet broadcast address: 10.1.5.7
Available addresses within the subnet: 10.1.5.5, 10.1.5.6

Example C: 192.10.56.20/32
No subnet, since the full 32 bits are fixed.
share|improve this answer
up vote 1 down vote accepted

I was talking to another PC network professional, who has 20 years of experience, yesterday and he told me that when there is a free unused range of IP addresses, it's allowed to "put" as many networks as possible to this unused range as long as they fit in there...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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