First of all, I know that private IP ranges are
192.168.0.0 - 192.168.255.255 (65,536 IP addresses)
172.16.0.0 - 172.31.255.255 (1,048,576 IP addresses)
10.0.0.0 - 10.255.255.255 (16,777,216 IP addresses)
But I am confused on what happens if I change the subnet mask of any the IP address of private IP range ?
I know that when we use subnet mask of different class with an IP address, we are using CIDR
.
For example,
The IP address 10.167.255.10
with subnet mask 255.0.0.0
is private.
But what if I change it's subnet mask to 255.255.0.0
. Did I just changed the IP address from private to public ?
I am really confused what's happening when I am changing the Subnet mask of the private IP range.
EDIT: I know that changing sub net mask will change the number of hosts and number of network addresses in the range, so my question is not about subnet mask. I am specifically asking about how the type of IP address affected, does it remain private?
Best Answer
The mask / prefix length are used for two different purposes: describing the address allocations aka ownership/purpose (e.g. 10.0.0.0/8 is reserved for use by LANs), and describing IP routing (e.g. packets for 10.32.0.0/12 are sent via the gateway 10.16.0.1).
These are written using the same syntax but are otherwise independent. A single allocation (range) can be subnetted – split up across several routers (e.g. 10.0.0.0/8 split up into multiple /12 or /16-sized subnets). On the other hand, multiple small subnets can often be aggregated into a single larger route – for example, in IPv6, an ISP would publish a single /32 route that covers the /48 allocations of all customers, and internally it'd have a single /48 route per customer that covers all the /64 subnets used by that customer.
Since the whole 10.0.0.0/8 range is massive, most networks will have to split it into many small subnets (e.g. one /12 per building or something such, and then one /16 per floor). For each subnet, the "subnet mask" only describes a route – it tells the OS what portion of the addresses are local (reachable without a gateway). But the individual address
10.167.255.10
still falls under the RFC 191810.0.0.0/8
private-address allocation regardless of subnetting, so it remains a private address.It might be easier to see this in terms of ownership. For example, if an organization owns the address range 123.123.0.0/16, that's just a short way of saying it owns all addresses from 123.123.0.0 to 123.123.255.255, regardless of what subnets are used.