Skip to contents

Derives the IPv6 interface identifier from a MAC address, as used by stateless address autoconfiguration (RFC 4291, appendix A): FF:FE is inserted in the middle of the address and the U/L bit is inverted.

Usage

eui64_MAC(mac, link_local = FALSE)

Arguments

mac

A character vector of MAC addresses.

Logical. If TRUE, return the IPv6 link-local address (fe80::/64 prefix) instead of the interface identifier alone.

Value

A character vector in IPv6 notation (lower case, leading zeros omitted, as recommended by RFC 5952). NA for invalid addresses.

Examples

eui64_MAC("1C:4C:7E:30:D8:13")
#> [1] "1e4c:7eff:fe30:d813"
eui64_MAC("1C:4C:7E:30:D8:13", link_local = TRUE)
#> [1] "fe80::1e4c:7eff:fe30:d813"