Last active
April 1, 2017 00:38
-
-
Save cunnie/ab40974ce66ad1e7ae00a4981522fc79 to your computer and use it in GitHub Desktop.
IPv6 Troubleshooting Notes for IPv6 on AWS
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
* * * * * root /bin/bash -x /usr/local/bin/recuperate.sh >> /tmp/recuperate.out 2>&1 |
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 -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