- ifmask="`/sbin/ifconfig $interface | awk '/Mask/{if($3~/Mask/)a=$3;else if ($4~/Mask/)a=$4;printf ("%s\n", substr(a,index(a,":")+1))}'`"
+ #ifmask="`/sbin/ifconfig $interface | awk '/Mask/{if($3~/Mask/)a=$3;else if ($4~/Mask/)a=$4;printf ("%s\n", substr(a,index(a,":")+1))}'`"
+ #ifmask="`/sbin/ifconfig $interface | awk '/netmask /{ printf($4) }'`"
+ cidr="`ip -o -4 addr show $interface scope global | awk '{print $4;}'`"
+ ifmask="`ipcalc -nb $cidr | awk '/^Netmask:/{print $2}'`"