Philip,
from 192.168.10.0/24, generate
ADDR=192.168.10
MASK=255.255.255.0
then, the matching interface will be spit out with the following:
ifconfig -a | \
sed -e :a -e N -e 's/\n / /' -e ta | \
grep -i "inet addr:$ADDR" | \
grep -i "mask:$MASK" | \
awk '{ print $1; }'
sed des
Updated,
given,
INPUT="192.168.10.0/24"
NETWORK=`ipcalc -s -n "$INPUT" | awk -F= '{ print $2; }'`
BROADCAST=`ipcalc -s -b "$INPUT" | awk -F= '{ print $2; }'`
ADDR=""
NET=`echo "$NETWORK" | awk -F. '{ print $1; }'`
BST=`echo "$BROADCAST" | awk -F. '{ print $1; }'`
if [ "$NET" = "$BST" ]; then
A
Hmmm found a minor but really annoying bug in the IPSec code. The
fix is simple, but difficult to automate in bash.
Anyone have an easy to figure out which interface corresponds to a
particular network?
For instance, if I have the below, then for input "192.168.10.0/24",
then I want the