如何将Ruby中的00:16:3e:15:d3:a9
这样的mac地址转换为Ruby中的IPv6链接本地地址(如EUI-64,如fe80::216:3eff:fe15:d3a9
这样的修改后的EUI-64?
到目前为止,我有以下步骤:
mac = "00:16:3e:15:d3:a9"
mac.delete!(':') # Delete colons
mac.insert(6, 'fffe') # Insert ff:ee in the middle
mac = mac.scan(/.{4}/) # Split into octets of 4
[C0是要翻转第一个八位位组的第六个位,这是我遇到的麻烦。
基于next step的答案。
this answer