diff --git a/common.sh b/common.sh
index 0081a491ca064f03779290b13355a793fe35170c..cb030e093a98f7e339d656db24be360bdfe83b20 100644
--- a/common.sh
+++ b/common.sh
@@ -70,3 +70,21 @@ function tryWget(){
                                      --proxy-password="${ppasswd}" \
                                      $* || return 1
 }
+
+#------------------------------------------------------------------------------
+# function: getNetworkInterface
+# Get the network interface which the client must bind to (in case there is
+# more than one default route) and the collect will use to obtain the MAC
+# address.
+function getNetworkInterface()
+{
+    interface=""
+
+    for interface in $(route | grep default | awk '{print $NF}'); do
+        # Send ICMP ECHO_REQUEST to root server I or J
+        if ping -c 1 -I ${interface} 192.36.148.17 > /dev/null 2>&1 ||
+           ping -c 1 -I ${interface} 192.58.128.30 > /dev/null 2>&1 ; then
+            break
+        fi
+    done
+}