Skip to content

Instantly share code, notes, and snippets.

@cunnie
Last active April 1, 2017 00:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cunnie/ab40974ce66ad1e7ae00a4981522fc79 to your computer and use it in GitHub Desktop.
Save cunnie/ab40974ce66ad1e7ae00a4981522fc79 to your computer and use it in GitHub Desktop.
IPv6 Troubleshooting Notes for IPv6 on AWS
* * * * * root /bin/bash -x /usr/local/bin/recuperate.sh >> /tmp/recuperate.out 2>&1
#!/bin/bash -x
#
LOCK_FILE=/tmp/recuperate.lock
if [ -f $LOCK_FILE ] && [ -f "/proc/$(cat $LOCK_FILE)" ]; then
echo "bailing, already running"
fi
echo $$ > $LOCK_FILE
date # record timestamps
if ps auxwww | grep dhclient | grep -v grep; then
# dhclient is running, network should be up...
if ! ping -c 2 10.0.0.6; then
if ! ping -c 2 8.8.8.8; then
# ... but it's not up, it's down, probably dhclient is stuck
killall -9 dhclient # kill it with fire
mv /etc/network/interfaces{,.$$}
cat > /etc/network/interfaces << EOF
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
iface eth0 inet6 dhcp
EOF
fi
fi
ifup eth0
fi
rm $LOCK_FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment