Let's say I have a network with 17 devices.

The minimum mask I could use to accommodate these 17 devices is (i.e. /27), which itself can contain 30 useful addresses (excluding the broadcast and network address).

That means if I have only 17 devices, 13 useful addresses are wasted.

My question is: why not just use IP address ranges?

Why do the number of addresses in a network need to be a power of two?

For example, why not just say: Network A: - (inclusive)?

What are the disadvantages of this, apart from having to store 8 octets (the start address and the end address) instead of 4 octets (the subnet mask)?

  • 2
    Some questions to ask yourself in your example are how would know that is on the same network when trying to communicate with it. How would know that is on a different network? You CAN accomplish what you're looking at by having each IP as a /32 host route but what are the downsides of that? – Luke Klimasauskas Nov 8 '15 at 20:41
  • IP addresses and masks are 32-bit unsigned integers. As you change the number of bits included in the mask length, you change a binary (base 2) number. each bit represents a doubling of the number, hence you do it by a power of two. It is all binary math. – Ron Maupin Nov 8 '15 at 20:44
  • 1
    @LukeKlimasauskas The administrator (or dhcp) already has to configure a subnet mask for every device. So just replace the subnet mask with fields like start address and end address. would know is in the network by checking whether is between start and end address. – orange orange Nov 8 '15 at 20:53
  • 1
    Let me answer the question with a question: Why use IP addresses at all? Every device has a MAC addresses which uniquely identifies it from every other device in the world. If your device has a unique address, why create another addressing scheme (IP), when you can already address any device in the world? – Ron Trunk Nov 8 '15 at 21:26
  • 1
    Given that you are making your example in NAT-space, there is precisely NO "savings" nor "waste" - it make no practical difference if you use a /27 or a /24 - all private-space addresses are free, and saving them makes no more sense than saving dryer lint. Indeed, it makes considerably less sense, when device number 18 comes along and everything needs to be reconfigured on your super-saver plan. – Ecnerwal Nov 9 '15 at 23:31

Your idea of start and end addresses will slow routing decisions down a lot, and a packet may traverse multiple routers to get to its destination; mask and compare for equality uses far fewer CPU cycles than compare for >= AND <=. More CPU cycles equals more time and more CPU load. Using a mask is fast and easy to do in either software or special hardware (ASIC). You have to remember that routers switch packets individually, and a router must make the determination which way to switch a packet for each and every packet which passes through it, and each router through which a packet travels will need to do the same thing.

How can route aggregation work with odd sized subnets? The number of Internet routes is already out of hand, and the ISPs won't advertise any IPv4 prefix longer than /24.

Your idea adds unacceptable overhead and delay to packet switching. You also need to think about so tightly restricting subnets that there is no room for growth. If you have assigned to for subnet 1, and each subsequent subnet is equally restrictive, what happens when a manager on subnet 1 wants to add a printer, scanner, new PC, etc. Suddenly, you need to move everyone to a new, larger subnet, and you have an unused subnet that may never have a good fit, thereby wasting those 17 addresses.

This idea doesn't really solve any problems since even doubling the number of available IPv4 addresses will not even come close to fixing the IPv4 address shortage, and it adds considerably to router overhead and real world implementation support.

Keep thinking about things, but realize that there are many, many extremely intelligent people who live, eat, breathe, and sleep this stuff, and have for many years, with no thought but how to make it work better. Everything about IP is under constant review and can be changed if a consensus decides it should be. The proof is the demise of IP classes in favor of CIDR and VLSM.

  • "can be changed if a consensus decides it should be" - eventually... ;) – Alnitak Nov 9 '15 at 7:52

When IP was designed performance was a much bigger deal than conserving address space. Checking if something is in an arbitary range is more complex than checking it against a single number and a bitmask. This is somewhat true in software and even more true in hardware. Changing that once the IP address shortage became so acute it was worthwhile would have been a massive task.

Having said that if you are desperate there are a few ways to workaround the issue. They all come at a cost though.

One option is to run multiple subnets on the same link. The downside is that you waste more network/broadcast/gateway addresses and more traffic bounces via a router. Still it can save some addresses (for example in your case you could use a /28 and a /29.

If you are using linux then it supports /32 addresses as secondary addresses ( https://www.zmonkey.org/blog/content/using-32-netmask-linux ) . So if you are running linux and get desperate for IP space you can use private space as your primary address and then manually route your handful of public addresses to individual boxes. This allows you to achieve near-perfect public IP utilisation but obviously the price you pay is larger routing tables on your routers and in some cases local traffic bouncing via a router rather than going direct. https://www.zmonkey.org/blog/content/using-32-netmask-linux

Another option is to use private IPs (or IPv6) internally and then put NATs or load balancers at your network border.

Yet another option is to set your netmask wide open and then use arp proxying to pick up traffic that clients think is local to their subnet but actually isn't. Again making this work is going to be more work for the routers but it's possible (at least with linux routers).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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