Index: iproute/setroute-rhel.sh
===================================================================
--- iproute/setroute-rhel.sh	(revision c1094188ede7a1445e590417ab77e4020724332c)
+++ iproute/setroute-rhel.sh	(revision 84d82932ad5d20fba956d85c903705ff2f2c6a7a)
@@ -3,8 +3,8 @@
 set -x
 
-IF="${1:?"usage: $0 <ether_device> [gateway] "}"
+IFACE="${1:?"usage: $0 <ether_device> [gateway] "}"
 GATEWAY=$2
 
-TID=`/sbin/ip addr show dev ${IF} | grep -w ${IF}: | cut -d : -f 1`
+TID=`/sbin/ip addr show dev ${IFACE} | grep -w ${IFACE}: | tr -s ' ' | cut -d : -f 1`
 
 if [ "${GATEWAY}" = "down" ]; then
@@ -15,5 +15,5 @@
     /sbin/ip rule del table ${TID} priority ${TID}
     /sbin/ip route flush cache
-    echo "remove routing table and policy for ${IF}"
+    echo "remove routing table and policy for ${IFACE}"
     exit
 fi
@@ -21,12 +21,12 @@
 
 # get IP address, network mask, default gateway info
-IPADDR=`/sbin/ip addr show dev ${IF} | grep -w inet | cut -d t -f 2 | cut -d ' ' -f 2 | cut -d / -f 1`
-NETWORK=`/sbin/ip route show dev ${IF} | grep -w ${IPADDR} | cut -d ' ' -f 1`
+IPADDR=`/sbin/ip addr show dev ${IFACE} | grep -w inet | tr -s ' ' | cut -d ' ' -f 3 | cut -d / -f 1`
+NETWORK=`/sbin/ip route show dev ${IFACE} | grep -w ${IPADDR} | tr -s ' ' | cut -d ' ' -f 1`
 
 if [ -z "${GATEWAY}" ]; then
-    GATEWAY=`/sbin/ip route show dev ${IF} | grep -w default | cut -d ' ' -f 3`
+    GATEWAY=`/sbin/ip route show dev ${IFACE} | grep -w default | tr -s ' ' | cut -d ' ' -f 3`
 fi
 if [ -z "${GATEWAY}" ]; then
-    GATEWAY=`/sbin/ip route | grep -w default | cut -d ' ' -f 3`
+    GATEWAY=`/sbin/ip route | grep -w default | tr -s ' ' | cut -d ' ' -f 3`
     # this may add wrong default route especially on RHEL
 fi
@@ -34,6 +34,6 @@
 
 # set routing table
-/sbin/ip route add ${NETWORK} dev ${IF} table ${TID}
-/sbin/ip route add default via ${GATEWAY} dev ${IF} table ${TID}
+/sbin/ip route add ${NETWORK} dev ${IFACE} table ${TID}
+/sbin/ip route add default via ${GATEWAY} dev ${IFACE} table ${TID}
 
 # set routing policy
@@ -41,3 +41,3 @@
 
 /sbin/ip route flush cache
-echo "add routing table and policy for ${IF} on table ${TID}"
+echo "add routing table and policy for ${IFACE} on table ${TID}"
Index: iproute/setroute.sh
===================================================================
--- iproute/setroute.sh	(revision c1094188ede7a1445e590417ab77e4020724332c)
+++ iproute/setroute.sh	(revision 84d82932ad5d20fba956d85c903705ff2f2c6a7a)
@@ -16,5 +16,5 @@
 GATEWAY=$1
 
-TID=`/sbin/ip addr show dev ${IFACE} | grep -w ${IFACE}: | cut -d : -f 1`
+TID=`/sbin/ip addr show dev ${IFACE} | grep -w ${IFACE}: | tr -s ' ' | cut -d : -f 1`
 
 if [ "${PHASE}" = "post-down" ]; then
@@ -31,5 +31,5 @@
 
 # get IP address, network mask, default gateway info
-IPADDR=`/sbin/ip addr show dev ${IFACE} | grep -w inet | cut -d t -f 2 | cut -d ' ' -f 2 | cut -d / -f 1`
+IPADDR=`/sbin/ip addr show dev ${IFACE} | grep -w inet | tr -s ' ' | cut -d ' ' -f 3 | cut -d / -f 1`
 if [ -z "${IPADDR}" ]; then
     # fail to bind IP address to device
@@ -37,11 +37,11 @@
     exit
 fi
-NETWORK=`/sbin/ip route show dev ${IFACE} | grep -w ${IPADDR} | cut -d ' ' -f 1`
+NETWORK=`/sbin/ip route show dev ${IFACE} | grep -w ${IPADDR} | tr -s ' ' | cut -d ' ' -f 1`
 
 if [ -z "${GATEWAY}" ]; then
-    GATEWAY=`/sbin/ip route show dev ${IFACE} | grep -w default | cut -d ' ' -f 3`
+    GATEWAY=`/sbin/ip route show dev ${IFACE} | grep -w default | tr -s ' ' | cut -d ' ' -f 3`
 fi
 if [ -z "${GATEWAY}" ]; then
-    GATEWAY=`/sbin/ip route | grep -w default | cut -d ' ' -f 3`
+    GATEWAY=`/sbin/ip route | grep -w default | tr -s ' ' | cut -d ' ' -f 3`
     # this may add wrong default route especially on RHEL
 fi
Index: iptables/setnapt.sh
===================================================================
--- iptables/setnapt.sh	(revision c1094188ede7a1445e590417ab77e4020724332c)
+++ iptables/setnapt.sh	(revision 84d82932ad5d20fba956d85c903705ff2f2c6a7a)
@@ -31,5 +31,5 @@
 
 if [ -z "${GATEWAYS}" ]; then
-    GATEWAYS=`/sbin/ip route show table main | grep -w default | cut -d ' ' -f 5`
+    GATEWAYS=`/sbin/ip route show table main | grep -w default | tr -s ' ' | cut -d ' ' -f 5`
 fi
 
@@ -40,5 +40,5 @@
     fi
     
-    IPADDR=`/sbin/ip addr show dev ${GW} | grep -w inet | cut -d t -f 2 | cut -d ' ' -f 2 | cut -d / -f 1`
+    IPADDR=`/sbin/ip addr show dev ${GW} | grep -w inet | tr -s ' ' | cut -d ' ' -f 3 | cut -d / -f 1`
     if [ -z "${IPADDR}" ]; then
         # device doesn't seem to have an IP address
