A ver si esta vez me he enterado bien. El siguiente script recibe como
argumento una interfaz de red y saca la ip:
if [ $# != 1 ]; then echo "Usage: $0 <interface>"; exit; else ETHX=$1; fi
IFCONFIG=/sbin/ifconfig;
GREP=/bin/grep;
AWK=/usr/bin/awk;
SED=/bin/sed;
IP=`$IFCONFIG $ETHX | $GREP 'inet addr' | $AWK '{print $2}' | $SED -e
's/.*://'`
if [ "$IP" == "" ]; then echo "Error: la interfaz $ETHX no existe";
exit; fi
****
reglas iptables
****
Se puede pensar mejor y añadirlo a init.d para q se ejecute despues de
iniciar la red haciendo algunas modificaciones para q te pille todo
automaticamente y la verdad q sería mu elegante :)
Un saludo