echo "Executando regras para clientes locais..."
if [ $DHCP != "N" ]
then
for i in `cat $CLIENTELOCAL`; do
NOMECLI=`echo $i | cut -d ';' -f 1`
IPSOURCE=`echo $i | cut -d ';' -f 2`
MACSOURCE=`echo $i | cut -d ';' -f 3`
LOCALCLI=`echo $i | cut -d ';' -f 4`
STATUS=`echo $i | cut -d ';' -f 5`
LINK=`echo $i | cut -d ';' -f 6`
### Se status = aberto aceita IP/MAC
if [ $STATUS = "aberto" ]; then
$IPT -A INPUT -s $IPSOURCE -m mac --mac-source $MACSOURCE -j ACCEPT
$IPT -A FORWARD -s $IPSOURCE -m mac --mac-source $MACSOURCE -j ACCEPT
$IPT -A FORWARD -d $IPSOURCE -j ACCEPT
echo $IPSOURCE " " $NOMECLI"_"$LOCALCLI >> /tmp/hosts
if [ $LOCALCLI != "ext" ]; then
echo $IPSOURCE":"$LINK >> /tmp/ips
fi
echo "host $NOMECLI"-"$LOCALCLI {
hardware ethernet $MACSOURCE;
fixed-address $IPSOURCE;
}" >> /tmp/dhcpd
else
if [ $STATUS = "fechado" ]; then
$IPT -t nat -I PREROUTING -i eth2 -p tcp -s $IPSOURCE -j REDIRECT --to-port 1236
else
$IPT -A INPUT -m mac --mac-source $MACSOURCE -j DROP
$IPT -A FORWARD -m mac --mac-source $MACSOURCE -j DROP
$IPT -A INPUT -s $IPSOURCE -j DROP
$IPT -A FORWARD -s $IPSOURCE -j DROP
$IPT -A FORWARD -d $IPSOURCE -j DROP
fi
fi
done
fi
Acho que com esse scritp ai dá para começar a brincadeira.