IPv4 – Public Subnetting Clarification

ipipv4

I've been delving into the wonderful word of networking (lol) and I have a few questions of clarification for IPv4 subnetting.

I'm pretty comfortable with the idea of subnetting. I understand that it's a way of splitting up an IP address into public/local addresses. From my experience though, the only time I've seen this used is in private networks (10.x.x.x, 198.162.x.x, etc).

How does subnetting work for public IP addresses? For instance, if I'm running a datacenter, would owning 30.214.41.2/16 be equivalent to owning the ~65000 addresses between 30.214.41.2 and 30.215.41.2?

As a follow up, do ISPs use this as a convenience for routing purposes?

I ask this because working with AWS, as far as I'm aware its not possible to allocate consecutive public IP addresses for public subnets. I'm building a public subnet, filling it with machines running an API, and would like each machine to have a consecutive public IPs within the subnet. Am I correct in assuming this isn't possible?

I understand IP allocation in AWS is in its own little world (since you're basically borrowing IPs that Amazon had previously purchased) and that it may be different everywhere else.

Apologies for the noob question 🙂

EDIT: 65000 not 600000

Best Answer

How does subnetting work for public IP addresses? For instance, if I'm running a datacenter, would owning 30.214.41.2/16 be equivalent to owning the ~65000 addresses between 30.214.41.2 and 30.215.41.2?

The subnet mask is always applied left-to-right, so no subnet that is /24 or less will ever have a non-zero start for the rightmost value. For your example:

      30.     214.      41.       2
00011110 11010110 00101001 00000010 address
11111111 11111111 00000000 00000000 network mask (/16)
======== ======== ======== ======== (bitwise AND)
00011110 11010110 00000000 00000000 network

The network in this case is 30.214.0.0/16 and the host range is 30.214.0.1-30.214.255.254 (30.214.0.0 and 30.214.255.255 have special meanings.)

As a follow up, do ISPs use this as a convenience for routing purposes?

ISPs can use the fact that they have subnetted their address range to simplify routing tables. This is known as route summarization and is pretty important in keeping the Internet working, because instead of your ISP having to advertise every network block that they use in a contiguous range, they can advertise just one. There's more to it than this, but fortunately that's beyond the scope of this question (it's complex and I have forgotten most of the details!)

As an aside, if you needed more than 65534 hosts in your hypothetical network, you could obtain two /16 networks that were adjacent to each other (e.g. 10.214.0.0/16 and 10.215.0.0/16) and supernet those into a single network (10.214.0.0/15). It's more common at the smaller network allocations (/24 and smaller), but you should be aware of its existence.

Related Topic