diff options
| author | David M. Syzdek <syzdek@bindlebinaries.com> | 2018-09-12 14:16:59 -0800 |
|---|---|---|
| committer | David M. Syzdek <syzdek@bindlebinaries.com> | 2018-09-12 14:16:59 -0800 |
| commit | 0ecf2ab8d7d368249a5b2b49f691fed945635104 (patch) | |
| tree | a2d969d8d5f4c7fa3d34e943a22b71a2d7053cc8 | |
| parent | eefbbd962ce6a7f8776084c87d2309b890212440 (diff) | |
| download | scratchpad-0ecf2ab8d7d368249a5b2b49f691fed945635104.tar.gz scratchpad-0ecf2ab8d7d368249a5b2b49f691fed945635104.tar.bz2 scratchpad-0ecf2ab8d7d368249a5b2b49f691fed945635104.tar.xz scratchpad-0ecf2ab8d7d368249a5b2b49f691fed945635104.zip | |
Updating scripts
| -rwxr-xr-x | notes/projects/sd-wan/scripts/check_dns.sh | 2 | ||||
| -rwxr-xr-x | notes/projects/sd-wan/scripts/check_net.sh | 48 |
2 files changed, 39 insertions, 11 deletions
diff --git a/notes/projects/sd-wan/scripts/check_dns.sh b/notes/projects/sd-wan/scripts/check_dns.sh index bc366a4..ee61a55 100755 --- a/notes/projects/sd-wan/scripts/check_dns.sh +++ b/notes/projects/sd-wan/scripts/check_dns.sh | |||
| @@ -113,4 +113,4 @@ for NET in 124 125;do | |||
| 113 | done | 113 | done |
| 114 | done | 114 | done |
| 115 | 115 | ||
| 116 | 116 | printf "\n" | |
diff --git a/notes/projects/sd-wan/scripts/check_net.sh b/notes/projects/sd-wan/scripts/check_net.sh index e154321..3d0ab58 100755 --- a/notes/projects/sd-wan/scripts/check_net.sh +++ b/notes/projects/sd-wan/scripts/check_net.sh | |||
| @@ -12,45 +12,73 @@ print_result() | |||
| 12 | 12 | ||
| 13 | printf "\nping sweep 209.193.12.0/24 ...\n" | 13 | printf "\nping sweep 209.193.12.0/24 ...\n" |
| 14 | COUNT=0; | 14 | COUNT=0; |
| 15 | while test $COUNT -lt 254;do | 15 | while test $COUNT -le 255;do |
| 16 | |||
| 17 | COUNT=$((${COUNT}+1)); | ||
| 18 | 16 | ||
| 19 | DIG_PTR=$(dig -x 209.193.12.${COUNT} IN PTR +short 2> /dev/null); | 17 | DIG_PTR=$(dig -x 209.193.12.${COUNT} IN PTR +short 2> /dev/null); |
| 20 | test -z "${DIG_PTR}" \ | 18 | test -z "${DIG_PTR}" \ |
| 21 | && continue; | 19 | && { COUNT=$((${COUNT}+1)); continue; }; |
| 22 | 20 | ||
| 23 | echo ${DIG_PTR} \ | 21 | echo ${DIG_PTR} \ |
| 24 | |egrep '^209-193-12-|^OPEN' > /dev/null; | 22 | |egrep '^209-193-12-|^OPEN' > /dev/null; |
| 25 | test $? -eq 0 \ | 23 | test $? -eq 0 \ |
| 26 | && continue; | 24 | && { COUNT=$((${COUNT}+1)); continue; }; |
| 27 | 25 | ||
| 28 | ping -t 1 -c 1 209.193.12.${COUNT} > /dev/null 2> /dev/null | 26 | ping -t 1 -c 1 209.193.12.${COUNT} > /dev/null 2> /dev/null |
| 29 | test $? -eq 0 \ | 27 | test $? -eq 0 \ |
| 30 | && print_result UP 209.193.12.${COUNT} ${DIG_PTR} \ | 28 | && print_result UP 209.193.12.${COUNT} ${DIG_PTR} \ |
| 31 | || print_result DOWN 209.193.12.${COUNT} ${DIG_PTR}; | 29 | || print_result DOWN 209.193.12.${COUNT} ${DIG_PTR}; |
| 32 | 30 | ||
| 31 | COUNT=$((${COUNT}+1)); | ||
| 32 | |||
| 33 | done | 33 | done |
| 34 | 34 | ||
| 35 | 35 | ||
| 36 | printf "\nping sweep 10.0.59.0/24 ...\n" | 36 | printf "\nping sweep 10.0.59.0/24 ...\n" |
| 37 | COUNT=0; | 37 | COUNT=0; |
| 38 | while test $COUNT -lt 254;do | 38 | while test $COUNT -le 255;do |
| 39 | |||
| 40 | COUNT=$((${COUNT}+1)); | ||
| 41 | 39 | ||
| 42 | DIG_PTR=$(dig -x 10.0.59.${COUNT} IN PTR +short 2> /dev/null); | 40 | DIG_PTR=$(dig -x 10.0.59.${COUNT} IN PTR +short 2> /dev/null); |
| 43 | test -z "${DIG_PTR}" \ | 41 | test -z "${DIG_PTR}" \ |
| 44 | && continue; | 42 | && { COUNT=$((${COUNT}+1)); continue; }; |
| 45 | 43 | ||
| 46 | echo ${DIG_PTR} \ | 44 | echo ${DIG_PTR} \ |
| 47 | |egrep '^10-0-59-|^OPEN' > /dev/null; | 45 | |egrep '^10-0-59-|^OPEN' > /dev/null; |
| 48 | test $? -eq 0 \ | 46 | test $? -eq 0 \ |
| 49 | && continue; | 47 | && { COUNT=$((${COUNT}+1)); continue; }; |
| 50 | 48 | ||
| 51 | ping -t 1 -c 1 10.0.59.${COUNT} > /dev/null 2> /dev/null | 49 | ping -t 1 -c 1 10.0.59.${COUNT} > /dev/null 2> /dev/null |
| 52 | test $? -eq 0 \ | 50 | test $? -eq 0 \ |
| 53 | && print_result UP 10.0.59.${COUNT} ${DIG_PTR} \ | 51 | && print_result UP 10.0.59.${COUNT} ${DIG_PTR} \ |
| 54 | || print_result DOWN 10.0.59.${COUNT} ${DIG_PTR}; | 52 | || print_result DOWN 10.0.59.${COUNT} ${DIG_PTR}; |
| 55 | 53 | ||
| 54 | COUNT=$((${COUNT}+1)); | ||
| 55 | |||
| 56 | done | ||
| 57 | |||
| 58 | |||
| 59 | for SUBNET in 10.0.124 10.0.125;do | ||
| 60 | printf "\nping sweep ${SUBNET}.0/24 ...\n" | ||
| 61 | COUNT=0; | ||
| 62 | while test $COUNT -le 255;do | ||
| 63 | |||
| 64 | DIG_PTR=$(dig -x ${NET}.${COUNT} IN PTR +short 2> /dev/null); | ||
| 65 | test -z "${DIG_PTR}" \ | ||
| 66 | && { COUNT=$((${COUNT}+1)); continue; }; | ||
| 67 | |||
| 68 | echo ${DIG_PTR} \ | ||
| 69 | |egrep '^([0-9]{1,}-){4,4}-|^OPEN' > /dev/null; | ||
| 70 | test $? -eq 0 \ | ||
| 71 | && { COUNT=$((${COUNT}+1)); continue; }; | ||
| 72 | |||
| 73 | ping -t 1 -c 1 ${NET}.${COUNT} > /dev/null 2> /dev/null | ||
| 74 | test $? -eq 0 \ | ||
| 75 | && print_result UP ${NET}.${COUNT} ${DIG_PTR} \ | ||
| 76 | || print_result DOWN ${NET}.${COUNT} ${DIG_PTR}; | ||
| 77 | |||
| 78 | COUNT=$((${COUNT}+1)); | ||
| 79 | |||
| 80 | done | ||
| 56 | done | 81 | done |
| 82 | |||
| 83 | |||
| 84 | printf "\n" | ||
