Hola. 

Quisiera que me pudieran ayudar comentándome las líneas que tengo en el
iptables ya que no las entiendo. (las copie de una pagina para poder hacer
funcionar mi Proxy transparente y hasta el momento todo ok) pero quisiera
entender un poco mas que hace cada regla.

 

Se los agradecería en el alma.

 

#IP del servidor Squid

SQUID_SERVER="192.168.1.1"

 

#Tarejeta conectada a internet

INTERNET="eth1"

 

#Tarjeta wifi

LAN_IN="eth0"

 

#Tarjeta red laboratorio

LAN_IN_2="eth2"

 

#Puerto del Squid

SQUID_PORT="3128"

 

#Limpiar reglas firewall

iptables -F

iptables -X

iptables -t nat -F

iptables -t nat -X

iptables -t mangle -F

iptables -t mangle -X

 

#habilitar bit de forwarding

echo 1 > /proc/sys/net/ipv4/ip_forward

 

# Definir reglas por defecto

iptables -P INPUT DROP 

iptables -P OUTPUT ACCEPT 

 

# Acceso ilimitado para interfaz de loop back

iptables -A INPUT -i lo -j ACCEPT 

iptables -A OUTPUT -o lo -j ACCEPT

 

#Permitir UDP, DNS

iptables -A INPUT -i $INTERNET -m state --state ESTABLISHED,RELATED -j
ACCEPT

 

# Definir el proxy como gateway para las redes

iptables --table nat --append POSTROUTING --out-interface $INTERNET -j
MASQUERADE

iptables --append FORWARD --in-interface $LAN_IN -j ACCEPT "

iptables --append FORWARD --in-interface $LAN_IN_2 -j ACCEPT 

 

# Acceso ilimitado a las redes

iptables -A INPUT -i $LAN_IN -j ACCEPT 

iptables -A INPUT -i $LAN_IN_2 -j ACCEPT 

 

# Cualquier petición hacia el puerto 80 (servicio HTTP) hecha desde la red
local hacia el exterior, se re-direccionará hacia el puerto 3128 del
servidor.(Reglas para las dos redes)

iptables -t nat -A PREROUTING -i $LAN_IN -p tcp --dport 80 -j DNAT --to
$SQUID_SERVER:$SQUID_PORT

iptables -t nat -A PREROUTING -i $LAN_IN_2 -p tcp --dport 80 -j DNAT --to
$SQUID_SERVER:$SQUID_PORT

 

# Rechazar el resto y crear log

iptables -A INPUT -j LOG

iptables -A INPUT -j DROP

 

_______________________________________________
Lista de correo Linux-plug
Temática: Discusión general sobre Linux
Peruvian Linux User Group (http://www.linux.org.pe)

Participa suscribiéndote y escribiendo a:  [email protected]
Para darte de alta, de baja  o hacer ajustes a tu suscripción visita:
http://listas.linux.org.pe/mailman/listinfo/linux-plug

IMPORTANTE: Reglas y recomendaciones
http://www.linux.org.pe/listas/reglas.php
http://www.linux.org.pe/listas/comportamiento.php
http://www.linux.org.pe/listas/recomendaciones.php

Responder a