Skip to content

Instantly share code, notes, and snippets.

@shield-9
Created April 21, 2014 04:07
Show Gist options
  • Save shield-9/11131949 to your computer and use it in GitHub Desktop.
Save shield-9/11131949 to your computer and use it in GitHub Desktop.
ConoHaの /etc/dhcp/dhclient-exit-hooks が天然記念物のような環境では動かないことがあるので修正版を作ってみた
#!/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
@shield-9
Copy link
Author

Licensed under the Public Domain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment