Created
December 10, 2018 11:23
-
-
Save user890104/80aef7c6cb4582f54eb04486bd63a80d to your computer and use it in GitHub Desktop.
Fix network on lxd
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
for cnt in $(lxc list --format csv --columns n) | |
do | |
GATEWAY_NUM=$(lxc exec $cnt -- bash -c 'route -n -A inet6 | grep -F "::/0" | grep -Fv "!n" | wc -l') | |
if [ $GATEWAY_NUM -eq 0 ] | |
then | |
echo restart network on $cnt | |
lxc exec $cnt -- netplan apply | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment