X-Git-Url: http://lab.mitty.jp/git/?a=blobdiff_plain;f=iptables%2Fsetnapt.sh;h=5626c6c78a81618c900412794b7a7b894836cd09;hb=c8daa6983248628690543c953d99bad4dd6cb64d;hp=6093f6df9bf742de75fc3c455420339571cc40d0;hpb=39eda0b67765385af21a00eb6d61e1d9b9915e51;p=lab.git diff --git a/iptables/setnapt.sh b/iptables/setnapt.sh old mode 100644 new mode 100755 index 6093f6d..5626c6c --- a/iptables/setnapt.sh +++ b/iptables/setnapt.sh @@ -30,7 +30,7 @@ fi sleep 60 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 for GW in ${GATEWAYS}; do @@ -39,7 +39,7 @@ for GW in ${GATEWAYS}; do continue 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 continue