Created
April 21, 2014 04:07
-
-
Save shield-9/11131949 to your computer and use it in GitHub Desktop.
ConoHaの /etc/dhcp/dhclient-exit-hooks が天然記念物のような環境では動かないことがあるので修正版を作ってみた
This file contains 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=$(/sbin/ifconfig eth0|grep -i global|head -n 1|cut -d ":" -f2,3,4,5) | |
SECOND=$(/sbin/ifconfig eth0|grep -i global|head -n 1|cut -d ":" -f6,7,8,9|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 | |
ifconfig eth0 inet6 add ${IPV6}${SUFFIX}/64 | |
done | |
for SUFFIX in `echo {a..f}` | |
do | |
ifconfig eth0 inet6 add ${IPV6}${SUFFIX}/64 | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Licensed under the Public Domain.