Shorewall + Slackware. Servidor Slackware 10.1 actualizado al dia: Software requerido: ------------------------------------------------------- Nombre Version iptables 1.2.11 iproute2 2.6.9_ss040831 ------------------------------------------------------- Configuracion de la red: ------------------------------------------------------- Internet: ------------------------------------------------------- Dispositivo eth0 Tipo Ethernet Red 209.205.213.232/30 Broadcast 209.205.213.235 Direccion IP 209.205.213.234 Netmask Address 255.255.255.252 Default Gateway 209.205.213.233 MAC Address 00:48:54:53:BC:DB ------------------------------------------------------- ------------------------------------------------------- LAN: ------------------------------------------------------- Dispositivo eth1 Tipo Ethernet Red 10.0.20.0/24 Broadcast 10.0.20.255 Direccion IP 10.0.20.255 Netmask Address 255.255.255.0 MAC Address 00:40:F4:14:57:77 ------------------------------------------------------- Rutas: # route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 209.205.213.232 0.0.0.0 255.255.255.252 U 0 0 0 eth0 10.0.20.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo 0.0.0.0 209.205.213.233 0.0.0.0 UG 1 0 0 eth0 # installpkg shorewall-2.4.2-noarch-1jm.tgz - Primero hacer una copia de los archivos de configuracion originales como respaldoL # cd /etc # cp -a shorewall shorewall-2.4.2 - Configurar las zonas: # vim zones Al final agregar algo asi: #ZONE DISPLAY COMMENTS net Internet Internet loc Local Local Network #LAST LINE - ADD YOUR ENTRIES ABOVE THIS ONE - DO NOT REMOVE - Configurar las interfaces de red asignadas a las zonas: # vim interfaces #ZONE INTERFACE BROADCAST OPTIONS # net eth0 detect dhcp,routefilter,norfc1918,tcpflags loc eth1 detect tcpflags #LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVE - Configurar routestopped, esto para que no bloquee las rutas despues de detener shorewall: # vim routestopped #INTERFACE HOST(S) OPTIONS eth0 - eth1 10.0.20.0/24 #LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVE - Definir las politicas de acceso de una zona a otra: # vim policy #SOURCE DEST POLICY LOG LIMIT:BURST # LEVEL # From Firewall to the Internet fw net ACCEPT # From Firewall to Local fw loc ACCEPT # From Internet to Firewall net fw REJECT info # From Local to Firewall loc fw ACCEPT # From Local to Internet loc net ACCEPT # net all DROP info # THE FOLLOWING POLICY MUST BE LAST all all REJECT info #LAST LINE -- DO NOT REMOVE - Configurar las reglas de acceso: # vim rules #ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ # PORT PORT(S) DEST LIMIT GROUP # # Allow SMTP, HTTP, NTP, POP3, ICMP(8) from the Internet to the firewall # ACCEPT net fw tcp 21 ACCEPT net fw tcp 22 ACCEPT net fw tcp 25 ACCEPT net fw tcp 53 ACCEPT net fw udp 53 ACCEPT net fw tcp 80 ACCEPT net:198.123.30.132 fw tcp 123 ACCEPT net fw tcp 110 ACCEPT net fw tcp 143 ACCEPT net fw tcp 443 ACCEPT net fw icmp 8 # DNAT RULES DNAT net loc:10.0.20.2:22 tcp 2222 DNAT net loc:10.0.20.2:6881 tcp 6881 #LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVE - Configurar el enmascaramiento: # vim masq #INTERFACE SUBNET ADDRESS PROTO PORT(S) IPSEC eth0 eth1 #LAST LINE -- ADD YOUR ENTRIES ABOVE THIS LINE -- DO NOT REMOVE - Configurar el archivo shorewall.conf para parametros globales y configurar que se pueda iniciar como servicio: # vim shorewall.conf STARTUP_ENABLED=Yes Guardar todo e iniciar el firewall, de preferencia se recomienda hacerlo localmente, y no remotamente ya que si hubo alguna mala configuracion podria ser que se bloque el acceso al firewall. Limpiar todo rastro de reglas que se hayan configurado con cualquier otra herramienta o script. # /etc/rc.d/rc.firewall stop # shorewall clear Y ahora si iniciar Shorewall. # /etc/rc.d/rc.firewall start