Last active
August 29, 2015 14:16
-
-
Save enko/37e901e61a270819ad02 to your computer and use it in GitHub Desktop.
Convert MAC to IPv6 linklocal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python | |
def mac2ll(mac): | |
mac = mac.split(":") | |
mac.insert(3,'fe') | |
mac.insert(3,'ff') | |
mac[0] = str(int(mac[0]) ^ 6) | |
return "fe80::%s:%s:%s:%s" % ("".join(mac[0:2]),"".join(mac[2:4]),"".join(mac[4:6]),"".join(mac[6:8])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment