| Class | NetAddr::CIDRv6 |
| In: |
lib/cidr.rb
|
| Parent: | CIDR |
IPv6 CIDR address - Inherits all methods from NetAddr::CIDR. Addresses of this class are composed of a 128-bit address space.
Generate an IPv6 Unique Local CIDR address based on the algorithm described in RFC 4193.
From the RFC:
1) Obtain the current time of day in 64-bit NTP format [NTP].
2) Obtain an EUI-64 identifier from the system running this
algorithm. If an EUI-64 does not exist, one can be created from
a 48-bit MAC address as specified in [ADDARCH]. If an EUI-64
cannot be obtained or created, a suitably unique identifier,
local to the node, should be used (e.g., system serial number).
3) Concatenate the time of day with the system-specific identifier
in order to create a key.
4) Compute an SHA-1 digest on the key as specified in [FIPS, SHA1];
the resulting value is 160 bits.
5) Use the least significant 40 bits as the Global ID.
6) Concatenate FC00::/7, the L bit set to 1, and the 40-bit Global
ID to create a Local IPv6 address prefix.
Example:
eui = NetAddr::EUI.create('aabb.ccdd.eeff')
NetAddr::CIDRv6.unique_local(eui) => fdb4:3014:e277:0000:0000:0000:0000:0000/48