Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mac_to_ipv6 () {
- IFS=':'; set $1; unset IFS
- ipv6_address="fe80::$(printf %02x $((0x$1 ^ 2)))$2:${3}ff:fe$4:$5$6"
- }
- mac_to_ipv6 () {
- mac=$1
- ipv6_address=fe80::$(printf %02x $((0x${mac%%:*} ^ 2)))
- mac=${mac#*:}
- ipv6_address=$ipv6_address${mac%:*:*:*}ff:fe
- mac=${mac#*:*:}
- ipv6_address=$ipv6_address${mac%:*}${mac##*:}
- }
- mac_to_ipv6 () {
- local mac=$1 byte0
- printf %02x -v byte0 $((0x${mac:0:2} ^ 2))
- ipv6_address="fe80::$byte0${mac:3:5}ff:fe${mac:9:5}${mac:15:2}"
- }
- #!/bin/bash
- IFS=':'; set $1; unset IFS
- printf "fe80::%x%x:%x:%x:%xn" 0x$(( 0x${1} ^ 0x02 )) 0x${2} 0x${3}ff 0xfe${4} 0x${5}${6}
- $ mac_to_ipv6 00:00:00:00:00:00
- fe80::200:00ff:fe00:0000
- mac_to_ipv6_ll() {
- IFS=':'; set $1; unset IFS
- echo "fe80::$(printf %02x $((0x$1 ^ 2)))$2:${3}ff:fe$4:$5$6"
- }
Add Comment
Please, Sign In to add comment