From 98d9df4ab45784973f84c7416549f2cc58146d20 Mon Sep 17 00:00:00 2001
From: Simon Michnowicz <simon.michnowicz@monash.edu>
Date: Mon, 27 Aug 2018 14:50:13 +1000
Subject: [PATCH] check to see if NAT is working by pinging external address

---
 roles/nhc/files/scripts/check_nat.nhc | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 roles/nhc/files/scripts/check_nat.nhc

diff --git a/roles/nhc/files/scripts/check_nat.nhc b/roles/nhc/files/scripts/check_nat.nhc
new file mode 100644
index 00000000..55b76495
--- /dev/null
+++ b/roles/nhc/files/scripts/check_nat.nhc
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+#checks that NAT is working by pinging an external address from a compute node
+
+function check_nat() {
+#echo ">>> Checking NAT on Compute Nodes Works >>>>>>>>>>>>>>>>>>>>>>>>>"
+
+
+PING_EXTERNAL="ping -c 2 8.8.8.8"
+$PING_EXTERNAL
+RESULT=$?
+if [ $RESULT -ne 0 ]; then
+     die 1 " $FUNCNAME ERROR on node. Can not ping external address. Please check NAT is working, or route on node is valid"
+     return 1
+fi
+return 0
+}
+
+
-- 
GitLab