Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/12/2009, 12:12
dref_09
 
Fecha de Ingreso: octubre-2009
Mensajes: 6
Antigüedad: 14 años, 7 meses
Puntos: 0
Problema iptables

Hola, buenas tardes. Tengo un problema con IP tables y no soy capaz de resolverlo.

Es algo bastante simple, unicamente quiero que solo puedan tener acceso a una determinada ip un rango de direcciones que asigna un servidor dhcp, es decir, que si me pongo una ip fija de cualquier rango no pueda salir a ningún sitio.

mi archivo de iptables es el siguiente:

#!/bin/sh
#
# Firewall script for ChilliSpot on OpenWRT
#
# Uses $WANIF (vlan1) as the external interface (Internet or intranet) and
# $WLANIF (eth1) as the internal interface (access point).
# $LANIF is used as a trusted management interface.
#
# SUMMARY
# * All connections originating from ChilliSpot are allowed.
# * Nothing is allowed in on WAN interface.
# * Nothing is allowed in on WLAN interface.
# * Everything is allowed in on LAN interface.
# * Forwarding is allowed to and from WAN interface, but disallowed
# to and from the WLAN interface.
# * NAT is enabled on the WAN interface.

. /etc/functions.sh

WLANIF="ath0"
LANIF="br-lan"
WANIF="br-lan"

IPTABLES="/usr/sbin/iptables"

for T in filter nat mangle ; do
$IPTABLES -t $T -F
$IPTABLES -t $T -X
done

$IPTABLES -P INPUT DROP
$IPTABLES -P FORWARD ACCEPT
$IPTABLES -P OUTPUT ACCEPT

#Allow related and established on all interfaces (input)
$IPTABLES -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

#Allow SSH, related and established $WANIF. Reject everything else.
$IPTABLES -A INPUT -i $WANIF -p tcp -m tcp --dport 22 -j ACCEPT
$IPTABLES -A INPUT -i $WANIF -j REJECT


#Allow related and established $WLANIF. Drop everything else.
$IPTABLES -A INPUT -i $WLANIF -j DROP

#Allow 3990 on other interfaces (input).
$IPTABLES -A INPUT -p tcp -m tcp --dport 3990 --syn -j ACCEPT

#Allow everything on loopback interface.
$IPTABLES -A INPUT -i lo -j ACCEPT

#Allow everything on $LANIF
$IPTABLES -A INPUT -i $LANIF -j ACCEPT

#Drop everything to and from $WLANIF (forward)
$IPTABLES -A FORWARD -i $WLANIF -j DROP
$IPTABLES -A FORWARD -o $WLANIF -j DROP

#Enable NAT on output device.
$IPTABLES -t nat -A POSTROUTING -o $WANIF -j MASQUERADE


Alguien podría echarme una mano? Tengo una ligera idea de lo que hay que poner, pero no me hace caso y entiendo que es porque no se donde tengo que colocarlo.

Gracias de ante mano

Saludos