-
-
Save awsvpc/c15119f46fbf677685a00703189ae2b4 to your computer and use it in GitHub Desktop.
check for IPv6 connectivity
This file contains hidden or 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 | |
| # Check for IPv6 Connectivity by looking for a IPv6 address | |
| function check_ipv6() { | |
| # Lets see if we got an IPv6, which in return means that we're live | |
| IPv6=`curl -6 -s https://wtfismyip.com/text` | |
| if [ $IPv6 ] | |
| then | |
| # OK IPv6 was found, return code 0 - OK | |
| echo "OK - IPv6 connection ESTABLISHED. IP: $IPv6" | |
| exit 0 | |
| else | |
| # Error: IPv6 was not found, return code 2 - critical | |
| echo "CRITICAL - no IPv6 connection ESTABLISHED. Output: $IPv6" | |
| exit 1 | |
| fi | |
| } | |
| check_ipv6 | |
| eof |
This file contains hidden or 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
| [Unit] | |
| Description=IPv6 connectivity check | |
| After=network-online.target | |
| [Service] | |
| ExecStart=/usr/local/bin/ipv6.sh | |
| RestartSec=5 | |
| Restart=always | |
| [Install] | |
| WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment