Last active
August 29, 2015 14:04
-
-
Save shield-9/3691b008c034159f8657 to your computer and use it in GitHub Desktop.
https://gist.github.com/shield-9/11131949 のCentOS7(iproute2)対応版
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
#!/bin/bash | |
FIRST=$(ip a show dev eth0|grep -E 'inet6 (.+) scope global'|head -n 1|sed -e "s/^ *inet6 *//g"|cut -d ":" -f1,2,3,4) | |
SECOND=$(ip a show dev eth0|grep -E 'inet6 (.+) scope global'|head -n 1|cut -d ":" -f5,6,7,8|cut -d "/" -f1) | |
if [ -z "${FIRST}" -o -z "${SECOND}" ]; then | |
exit 0 | |
fi | |
case "${SECOND}" in | |
a[0-9]* ) exit 0 | |
esac | |
IPV6=${FIRST}:a${SECOND} | |
for SUFFIX in `echo {0..9}` | |
do | |
ip addr add ${IPV6}${SUFFIX}/64 dev eth0 | |
done | |
for SUFFIX in `echo {a..f}` | |
do | |
ip addr add ${IPV6}${SUFFIX}/64 dev eth0 | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code is in the Public Domain!