[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Reglas para iptables con laptop en diferentes redes



Eso mismo estaba pensando, pero erre el tiro pensando en una solucion basada en iptables, cuando el viejo grupo bash, grep, awk y sed hacen la tarea :-)

La idea es justamente ponerlo todo en un script de arranque y que ejecute las reglas segun la IP que asigne, tengo la IP de mi oficina en /etc/interfaces y me estoy pensando volver a probar los softwares de asignacion de IP al arranque que hace un tiempo atras probe y no me gustaron, si encuentro algo elegante lo posteo a ver si a alguien le sirve.

Saludos


 (o_   Pablo A. Wolter N.
 //\   Usuario Registrado #284649
 V_/_  Linux Debian Sid Kernel 2.6.8

 "Pienso....luego instalo Linux....entonces existo."


Miguel Angel Júlvez wrote:
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



Reply to: