There is a good explanation on how subnets work generally, but how is the information of what subnets exist, what are the available network IDs, and what subnet a machine is on, sent to the router and the machines on a network? Is it via a protocol?
-
1If you set a static IPv4 address, you set IP address and network mask etc - so, how does it know? Easy. You set it. If the IP address is obtained via DHCP, then it's DHCP that sets not only the IP address but the netmask etc. So, how does it know? DHCP set it – Jaromanda X Apr 12 '23 at 01:48
-
@JaromandaX Thank you! This is what I needed. – T. Webster Apr 12 '23 at 22:39
-
Additional to that, if you are able to not provide a subnetmask, it may be possible that the network software assumes a classful network configuration -> https://en.wikipedia.org/wiki/Classful_network , but this "feature" is often mostly integrated for backwards compatibility. In example, setting the IP to 10.0.0.1 but not setting any subnetmask (if the software allows you to not setting up a subnetmask), might result into subnetmask 255.0.0.0 . – paladin Apr 13 '23 at 10:36
1 Answers
IPv6 is easier in that there is a well-defined protocol, and you can forget about counting hosts.
Router advertisements (RA) are multicast from routers to announce themselves. Attached prefix information defines one or more prefixes, with an L bit set for hosts that are known to be on-link.
RA source IP address is a link local address, which cannot be routed and thus must be on-link. Hosts can use this address as a default route.
A default gateway may send a redirect telling senders that a destination is actually on-link, and can be sent there directly.
There should exist a means to manually set a prefix as on-link.
That's all, these fully define what hosts are on this layer 2 and which are at least one router away.
This is of course only the basics about host networking. Prefixes are also communicated with DHCP PD, or routing protocols.
Further reading: Russ White on on-link,
rfc 5942 IPv6 Subnet Model: The Relationship between Links and Subnet Prefixes
Regarding right-sizing prefixes to number of hosts, do not bother. The smallest reasonable size prefix is /64 which is effectively unlimited.
Lest you be concerned that you learned that binary math for nothing, it is still useful in address planning. Now the question becomes, will the number of nets your business unit need exceed the number of /64s in a /48.

- 32,050
- 2
- 19
- 34
-
1
-
The question was not restricted to IPv4. I suppose I could have contrasted it to IPv4 having only same network address comparison, but did not. – John Mahowald Apr 12 '23 at 18:52