Lets say there are two public IP addresses. One is and the other is, they are different network IDs but when used over the internet how are they both differentiated? Or is it that classful addressing is used for public IPs and classless is used for private?

  • Those are the same addresses. Addresses on IP packets are only the address, they do not have the mask or length. The two hosts are on the same network, but one (or both) has a misconfigured mask. Classful addressing has been dead since 1993. By the way, you should never use public addresses not assigned to you. IANA has set aside three address ranges for examples:,, and
    – Ron Maupin
    Feb 20, 2021 at 22:59
  • Why do you care? Under what circumstances do you need to know anything about the size of a foreign network?
    – Ricky
    Feb 20, 2021 at 23:06
  • @Ricky, I'm trying to understand how classless addressing works, but its really confusing since it seems that there could be different networks that look the same but have a different subnet mask.
    – piny88
    Feb 20, 2021 at 23:08
  • 1
    An address is an address. Masks are for routing. There is a section in this two-part answer that explains how to tell if two addresses are in the same network. Use the shortest mask.
    – Ron Maupin
    Feb 20, 2021 at 23:11

1 Answer 1


They're not differentiated. The subnet size - or prefix length - is only relevant for routing table entries (which each carry a length field) or for a locally connected subnet where the host is configured with a specific netmask (statically or by DHCP).

One is and the other is, they are different network IDs

While both describe differently sized networks, the address is the same. The /16 network is just a subnet of the /8 network.

A subnet mask isn't ever detected. For a pure address the mask is simply irrelevant. An end-node host only needs to know its own subnet prefix length which is either statically configured or by DHCP. Route entries on a router (or on a host for that matter) are also either statically configured by the admin or learned via a routing protocol like OSPF or RIPv2, where the mask lengths are passed along as well.

Classful networking was obsoleted in 1993 by RFC 1518. Note that even when classful networking was used, different netmask sizes were possible - they just defaulted to their class length (and were handed out by the RIRs that way).

  • "The /16 network is just a subnet of the /8 network.". So then how would classless addressing work cause it seems that the network with the lowest number of network ID bits would always subnet the ones with higher number of network ID bits. There definitely seems like I'm misunderstood, can you please explain further.
    – piny88
    Feb 20, 2021 at 23:11
  • 1
    @piny88, those two addresses are the same, and it is all 32 bits. Masks are for routing. At least one of the hosts is misconfigured.
    – Ron Maupin
    Feb 20, 2021 at 23:13
  • @piny88 It's the network with the highest number of ID bits (prefix length) that is the subnet of the one with any lower number of mask bits and where those address bits match. is a subnet of (the host bits must be 0 for a network address). For excellent explanations on subnetting see this question.
    – Zac67
    Feb 21, 2021 at 8:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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