Validating IPv6 netmask
Just as we have rules governing the validity of an IPv4 netmask, does IPv6 have its own set of rules 开发者_开发技巧to qualify a netmask?
Thanks!
What is your use case? Normally in IPv6 your addresses will be auto-generated from a /64 prefix your router provides.
You don't usually see a netmask written out in IPv6. Usually you will see a prefix length. For example:
2001:db8:0:160::/64
would have a netmask of
ffff:ffff:ffff:ffff::
But you would only ever see the former.
Technically the better answer may be that with IPv6 you no longer have a netmask. With IPv6 you have a "prefix length" which you can interpret as the number of 1 bits in an equivalent netmask.
Taking the concept of "prefix length" you no longer have to have "netmask rules", although there pretty much is only one: the netmask should consist of only left aligned contiguous 1 bits.
精彩评论