Bienvenido(a) a Alcance Libre 06/09/2025, 07:28
|
![]() |
Índice del foro > Todo acerca de Linux > Redes y Servidores |
![]() ![]() |
![]() |
Page navigation |
Cesar A. Polo Hernandez |
|
|||||||
![]() ![]() ![]() ![]() ![]() Participa poco Estado: desconectado ![]() Identificado: 12/09/08 Mensajes: 33 |
Hola amigos soy nuevo en este mundo de Linux, tengo instalado la Version 5.2 de CentOS, lo que sucede es que quiero limitar el acceso a internet mediante un Proxy, he seguido al pie de la letra el manual que existe en esta pagina pero aun nada, no se que otra cosa mas hacer.
Tengo dos tarjetas de red eth0 192.168.1.20 eth1 192.168.7.1 la puerta de enlace 192.168.1.1 dns 200.48.225.130 200.48.225.146 hostname cesar he creado estos archivos permitidos.acl # todas las direccion ip permitidas sin_messenger.acl # todas las direccion ip sin messenger no_web.acl # todas las direccion ip a paginas web restringidas si necesitan mas datos para poder ayudame por favor solo me dicen que es lo que necesitan otra cosa cuando hago ping a 192.168.1.20 obtengo respuesta cuando hago ping a 192.168.7.1 obtengo respuesta cuando hago ping a www.google.com obtengo respuesta pero cuando voy a la pc con ip 192.168.7.10 no ingresa a internet que estoy haciendo mal. en que ruta del iptables doy salida al internet a mi red (como seria un ejemplo) de antemano muchas gracias por la ayuda y su tiempo y disculpen que soy muy novato en este mundo de linux |
|||||||
|
||||||||
ilidan |
|
|||||||
![]() ![]() ![]() ![]() ![]() Participa mucho ![]() Estado: desconectado ![]() Identificado: 05/06/08 Mensajes: 41 Localización:Ecuador |
Saludos amigo, primero que nada antes de poder responder a tu pregunta por favor indicanos si lo que necesitas es un servidor proxy transparente o un proxy no transparente, te explico; con el proxy transparente no necesitas configurar tu browser para que acceda al internet, todos los usuarios son libres de utilizar este servicio y el servidor proxy no transparente no permite libertad del uso del internet es más seguro.
\../_ Metal por sobre todas las cosas _\../ |
|||||||
|
||||||||
Cesar A. Polo Hernandez |
|
|||||||
![]() ![]() ![]() ![]() ![]() Participa poco Estado: desconectado ![]() Identificado: 12/09/08 Mensajes: 33 |
gracias por la respuesta y la explicacion, exactamente es un servidor proxy transparente
espero tu ayuda, gracias |
|||||||
|
||||||||
Perseus |
|
|||||||
![]() ![]() ![]() ![]() ![]() Miembro regular ![]() Estado: desconectado ![]() Identificado: 02/08/07 Mensajes: 115 Localización:Chiapas, México |
Por que no publicas tus acls? y sería bueno revisar los resultados de:
tail -f /var/log/squid/squid.out A lo mejor desde ahí resuelves algo. Saludos --------------------o00o-----| º L º |-------o00o-------------------- También en la Selva existen los pingúinos!! |
|||||||
|
||||||||
Ernesto Muñoz (LinuxTol) |
|
|||||||
![]() ![]() ![]() ![]() ![]() Participa poco ![]() Estado: desconectado ![]() Identificado: 01/03/07 Mensajes: 27 Localización:Toluca Edo.Méx |
Esto es lo que pondrias en el iptables dentro de /etc/init.d/iptables
esto en la parte de start #!/bin/bash echo "estableciendo las reglas de ruteo para acceso a internet por proxy transparente" iptables -t nat -A POSTROUTING -s 192.168.1.0/255.255.255.0 -j MASQUERADE iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 3128 echo "se anadieron correctamente las reglas de ruteo, las cuales se listaran acontinuacion" iptables -t nat -L espero te sirva recuerda eth0 = a internet y eth1= a tu switch con tus pcs Saludos LinuxTol LinuxMéxico |
|||||||
|
||||||||
Cesar A. Polo Hernandez |
|
|||||||
![]() ![]() ![]() ![]() ![]() Participa poco Estado: desconectado ![]() Identificado: 12/09/08 Mensajes: 33 |
ya hice todas esas cosas pero tengo otros mensajes
service squid start iniciando squid: . [ok] y cuando hago esto service squid status se esta ejecutando squid (pid 5130) aclParseAclLine: WARNING: empty ACL: acl permitidos src "/etc/squid/ippermitidos.acl" aclParseAclLine: WARNING: empty ACL: acl restringidos src "/etc/squid/iprestringidos.acl" aclParseAclLine: WARNING: empty ACL: acl conmsn src "/etc/squid/ippermitidos.acl" aclParseAclLine: WARNING: empty ACL: acl sinmsn src "/etc/squid/ippermitidos.acl" aclParseAclLine: WARNING: empty ACL: acl pwrestringidos src "/etc/squid/pwrestringidos.acl" que hago, ya me esta dando mucho vuelta todo esto gracias |
|||||||
|
||||||||
ilidan |
|
|||||||
![]() ![]() ![]() ![]() ![]() Participa mucho ![]() Estado: desconectado ![]() Identificado: 05/06/08 Mensajes: 41 Localización:Ecuador |
Saludos,
Mira, el error que tienes es el siguiente, lar reglas que se definen y que se almacenan en los archivos del directorio /etc/squid/ no deben tener como extensión .acl, pueden ser del tipo .txt o en el mejor de los casos sin extensión, ya que si le pones como extensión .acl estás declarando un tipo de regla que reconoce el squid y por eso te da el error, es decir tus reglas de acceso deberían ser asi: acl permitidos src "/etc/squid/ippermitidos" acl restringidos src "/etc/squid/iprestringidos" acl conmsn src "/etc/squid/ippermitidos" acl sinmsn src "/etc/squid/ippermitidos" acl pwrestringidos src "/etc/squid/pwrestringidos" Otra cosa, si quieres que el Proxy sea transparente, no olvides configurar los puertos a los que se redirecciona como transparentes en el inicio del squid.conf, de esta forma: http_port 8080 transparent Dónde 8080 es el puerto que tu configuras, por defecto viene el 3128 pero tu lo puedes cambiar o puedes definir ambos puertos. Además, cuando el squid ya no te de problemas, debes manipular los iptables si sabes como crear un script para que se ejecuten todas las reglas al encender el equipo sería bueno y debes ejecutar las siguientes lineas: iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -j MASQUERADE iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080 Dónde eth0 es la interfaz que tiene la salida al internet y pues 8080 es el puerto que definiste en el squid, en la parte http_port 8080 transparent. \../_ Metal por sobre todas las cosas _\../ |
|||||||
|
||||||||
Cesar A. Polo Hernandez |
|
|||||||
![]() ![]() ![]() ![]() ![]() Participa poco Estado: desconectado ![]() Identificado: 12/09/08 Mensajes: 33 |
ya hice lo que dijiste pero ahora sale lo siguiente :
[root@diresa ~]# service squid start Iniciando squid: . [ OK ] [root@diresa ~]# service squid status Se está ejecutando squid (pid 5042)... 2008/09/17 11:04:14| strtokFile: /etc/squid/ippermitidos not found 2008/09/17 11:04:14| aclParseAclLine: WARNING: empty ACL: acl permitidos src "/etc/squid/ippermitidos" 2008/09/17 11:04:14| strtokFile: /etc/squid/iprestringidos not found 2008/09/17 11:04:14| aclParseAclLine: WARNING: empty ACL: acl restringidos src "/etc/squid/iprestringidos" 2008/09/17 11:04:14| strtokFile: /etc/squid/conmsn not found 2008/09/17 11:04:14| aclParseAclLine: WARNING: empty ACL: acl conmsn src "/etc/squid/conmsn" 2008/09/17 11:04:14| strtokFile: /etc/squid/sinmsn not found 2008/09/17 11:04:14| aclParseAclLine: WARNING: empty ACL: acl sinmsn src "/etc/squid/sinmsn" 2008/09/17 11:04:14| strtokFile: /etc/squid/pwrestringidos not found 2008/09/17 11:04:14| aclParseAclLine: WARNING: empty ACL: acl pwrestringidos src "/etc/squid/pwrestringidos" gracias |
|||||||
|
||||||||
ilidan |
|
|||||||
![]() ![]() ![]() ![]() ![]() Participa mucho ![]() Estado: desconectado ![]() Identificado: 05/06/08 Mensajes: 41 Localización:Ecuador |
Bueno, parece que el error es en otra parte, por favor ejecuta el mandato:
grep -v "#" /etc/squid/squid.conf Servirá para ver las líneas que no se encuentran comentadas del archivo squid.conf, las seleccionas, las copias y las pegas para que podamos ver cual es la configuración de tu squid, por favor. \../_ Metal por sobre todas las cosas _\../ |
|||||||
|
||||||||
Cesar A. Polo Hernandez |
|
|||||||
![]() ![]() ![]() ![]() ![]() Participa poco Estado: desconectado ![]() Identificado: 12/09/08 Mensajes: 33 |
Ya lo solucioné los errores de los archivos que supuestamente eran textos, pero ahora me sale el error siguiente :
[root@diresa ~]# service squid start Iniciando squid: . [ OK ] [root@diresa ~]# service squid status Se está ejecutando squid (pid 5299)... 2008/09/17 11:20:47| aclParseAclLine: WARNING: empty ACL: acl restringidos src "/etc/squid/iprestringidos" 2008/09/17 11:20:47| aclParseAclLine: WARNING: empty ACL: acl sinmsn src "/etc/squid/sinmsn" al parecer estoy considerando mal algun el comando "src" para restringir. lo otro es que ruta (directorios) activo esta opcion iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -j MASQUERADE iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080 gracias y disculpen mi ignorancia, pero soy nuevo en todo esto |
|||||||
|
||||||||
ilidan |
|
|||||||
![]() ![]() ![]() ![]() ![]() Participa mucho ![]() Estado: desconectado ![]() Identificado: 05/06/08 Mensajes: 41 Localización:Ecuador |
Bueno como dije por favor publica la configuración de tu squid, con el comando:
grep -v "#" /etc/squid/squid.conf Lo puedes ejecutar desde cualquier parte al igual que los comandos: iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -j MASQUERADE iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080 Cabe recalcar que debes estar logeado como root. \../_ Metal por sobre todas las cosas _\../ |
|||||||
|
||||||||
Cesar A. Polo Hernandez |
|
|||||||
![]() ![]() ![]() ![]() ![]() Participa poco Estado: desconectado ![]() Identificado: 12/09/08 Mensajes: 33 |
HOLA Y GRACIAS POR LA PACIENCIA, POR QUE AL MENOS A MI SE ME ESTA AGOTANDO
TE DEJO EL CODIGO DEL SQUID.CONF # NETWORK OPTIONS # ----------------------------------------------------------------------------- http_port 3128 http_port 8080 transparent # OPTIONS WHICH AFFECT THE CACHE SIZE # ----------------------------------------------------------------------------- # TAG: cache_mem (bytes) # NOTE: THIS PARAMETER DOES NOT SPECIFY THE MAXIMUM PROCESS SIZE. #Default: # cache_mem 8 MB cache_mem 52 MB # LOGFILE PATHNAMES AND CACHE DIRECTORIES # ----------------------------------------------------------------------------- # TAG: cache_dir # Usage: # #Default: # cache_dir ufs /var/spool/squid 100 16 256 cache_dir ufs /var/spool/squid 700 16 256 # TAG: access_log # These files log client request activities. Has a line every HTTP or # ICP request. The format is: # access_log <filepath> [ # # To log the request via syslog specify a filepath of "syslog" # access_log /var/log/squid/access.log squid access_log /var/log/squid/access.log squid # TAG: cache_log # Cache logging file. This is where general information about # your cache's behavior goes. You can increase the amount of data # logged to this file with the "debug_options" tag below. # #Default: # cache_log /var/log/squid/cache.log cache_log /var/log/squid/cache.log # TAG: cache_store_log # Logs the activities of the storage manager. Shows which # objects are ejected from the cache, and which objects are # saved and for how long. To disable, enter "none". There are # not really utilities to analyze this data, so you can safely # disable it. # #Default: # cache_store_log /var/log/squid/store.log cache_store_log none # OPTIONS FOR EXTERNAL SUPPORT PROGRAMS # ----------------------------------------------------------------------------- # TAG: ftp_user # If you want the anonymous login password to be more informative # (and enable the use of picky ftp servers), set this to something # reasonable for your domain, like wwwuser@somewhere.net # # The reason why this is domainless by default is the # request can be made on the behalf of a user in any domain, # depending on how the cache is used. # Some ftp server also validate the email address is valid # (for example perl.com). # #Default: # ftp_user Squid@ ftp_user diresa@diresa.gob.pe # TAG: ftp_passive # If your firewall does not allow Squid to use passive # connections, turn off this option. # #Default: # ftp_passive on ftp_passive on # TAG: negative_ttl time-units # Time-to-Live (TTL) for failed requests. Certain types of # failures (such as "connection refused" and "404 Not Found" ![]() # negatively-cached for a configurable amount of time. The # default is 5 minutes. Note that this is different from # negative caching of DNS lookups. # #Default: # negative_ttl 5 minutes negative_ttl 15 minutes # ACCESS CONTROLS # ----------------------------------------------------------------------------- # TAG: acl #Recommended minimum configuration: acl all src 0.0.0.0/0.0.0.0 acl manager proto cache_object acl localhost src 127.0.0.1/255.255.255.255 acl to_localhost dst 127.0.0.0/8 acl permitidos src "/etc/squid/ippermitidos" acl restringidos src "/etc/squid/iprestringidos" acl conmsn src "/etc/squid/conmsn" acl sinmsn src "/etc/squid/sinmsn" acl pwrestringidos src "/etc/squid/pwrestringidos" acl SSL_ports port 443 563 acl Safe_ports port 80 # http acl Safe_ports port 21 # ftp acl Safe_ports port 443 563 # https acl Safe_ports port 70 # gopher acl Safe_ports port 210 # wais acl Safe_ports port 1025-65535 # unregistered ports acl Safe_ports port 280 # http-mgmt acl Safe_ports port 488 # gss-http acl Safe_ports port 591 # filemaker acl Safe_ports port 777 # multiling http acl CONNECT method CONNECT # TAG: http_access # Allowing or Denying access based on defined access lists # # #Default: # http_access deny all # #Recommended minimum configuration: # # Only allow cachemgr access from localhost http_access allow manager localhost http_access deny manager # Deny requests to unknown ports http_access deny !Safe_ports # Deny CONNECT to other than SSL ports http_access deny CONNECT !SSL_ports # # We strongly recommend the following be uncommented to protect innocent # web applications running on the proxy server who think the only # one who can access services on "localhost" is a local user #http_access deny to_localhost # # INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS # Example rule allowing access from your local networks. Adapt # to list your (internal) IP networks from where browsing should # be allowed #acl our_networks src 192.168.1.0/24 192.168.2.0/24 #http_access allow our_networks # And finally deny all other access to this proxy http_access allow localhost http_access allow permitidos http_access deny restringidos http_access allow conmsn http_access deny sinmsn http_access deny pwrestringidos http_access deny all # ADMINISTRATIVE PARAMETERS # ----------------------------------------------------------------------------- # TAG: cache_mgr # Email-address of local cache manager who will receive # mail if the cache dies. The default is "root". # #Default: # cache_mgr root cache_mgr root cpolohe@gmail.com # TAG: visible_hostname # If you want to present a special hostname in error messages, etc, # define this. Otherwise, the return value of gethostname() # will be used. If you have multiple caches in a cluster and # get errors about IP-forwarding you must set them to have individual # names with this setting. # #Default: # none visible_hostname diresa.gob.pe # HTTPD-ACCELERATOR OPTIONS # ----------------------------------------------------------------------------- # TAG: httpd_accel_no_pmtu_disc on|off # In many setups of transparently intercepting proxies Path-MTU # discovery can not work on traffic towards the clients. This is # the case when the intercepting device does not fully track # connections and fails to forward ICMP must fragment messages # to the cache server. # # If you have such setup and experience that certain clients # sporadically hang or never complete requests set this to on. # #Default: # httpd_accel_no_pmtu_disc off ######## OJO ######## PROBE ESTAS LINEAS PERO ME SALEN ERROR CUANDO CORRO EL SQUID # hhtp_accel_host virtual # hhtp_accel_port 80 # httpd_accel_with_proxy on # httpd_accel_uses_host_header on # MISCELLANEOUS # ----------------------------------------------------------------------------- # TAG: pipeline_prefetch # To boost the performance of pipelined requests to closer # match that of a non-proxied environment Squid can try to fetch # up to two requests in parallel from a pipeline. # # Defaults to off for bandwidth management and access logging # reasons. # #Default: # pipeline_prefetch off pipeline_prefetch on # TAG: ie_refresh on|off # Microsoft Internet Explorer up until version 5.5 Service # Pack 1 has an issue with transparent proxies, wherein it # is impossible to force a refresh. Turning this on provides # a partial fix to the problem, by causing all IMS-REFRESH # requests from older IE versions to check the origin server # for fresh content. This reduces hit ratio by some amount # (~10% in my experience), but allows users to actually get # fresh content when they want it. Note that because Squid # cannot tell if the user is using 5.5 or 5.5SP1, the behavior # of 5.5 is unchanged from old versions of Squid (i.e. a # forced refresh is impossible). Newer versions of IE will, # hopefully, continue to have the new behavior and will be # handled based on that assumption. This option defaults to # the old Squid behavior, which is better for hit ratios but # worse for clients using IE, if they need to be able to # force fresh content. # #Default: # ie_refresh off ie_refresh on |
|||||||
|
||||||||
ilidan |
|
|||||||
![]() ![]() ![]() ![]() ![]() Participa mucho ![]() Estado: desconectado ![]() Identificado: 05/06/08 Mensajes: 41 Localización:Ecuador |
Mira al parecer en la declaración de las reglas:
http_access allow localhost http_access allow permitidos http_access deny restringidos http_access allow conmsn http_access deny sinmsn http_access deny pwrestringidos http_access deny all Estás denegando ips redundantemente, prueba lo siguiente: http_access allow localhost http_access allow permitidos conmsn !restringidos !sinmsn !pwrestringidos http_access deny all Debes tener en cuenta que los rangos de ips que estableces en cada archivo, no se debe repetir porque como digo estarías redundando al momento de establecer las reglas. Y las líneas que mencionas: # hhtp_accel_host virtual # hhtp_accel_port 80 # httpd_accel_with_proxy on # httpd_accel_uses_host_header on Sólo funcionaban en versiones anteriores del SQUID, así que borralas. \../_ Metal por sobre todas las cosas _\../ |
|||||||
|
||||||||
Cesar A. Polo Hernandez |
|
|||||||
![]() ![]() ![]() ![]() ![]() Participa poco Estado: desconectado ![]() Identificado: 12/09/08 Mensajes: 33 |
estoy haciendo todo lo que me dices pero igual, sigo con la misma falla
[root@diresa ~]# service squid start Iniciando squid: .. [ OK ] [root@diresa ~]# service squid status Se está ejecutando squid (pid 5033)... 2008/09/17 13:15:14| aclParseAclLine: WARNING: empty ACL: acl restringidos src "/etc/squid/iprestringidos" 2008/09/17 13:15:14| aclParseAclLine: WARNING: empty ACL: acl sinmsn src "/etc/squid/sinmsn" [root@diresa ~]# las otras lineas ya los eliminé sigo a la espera de tu ayuda |
|||||||
|
||||||||
ilidan |
|
|||||||
![]() ![]() ![]() ![]() ![]() Participa mucho ![]() Estado: desconectado ![]() Identificado: 05/06/08 Mensajes: 41 Localización:Ecuador |
Bueno pues agotando ya las pocas soluciones que restan, te puedo sugerir mandar a reiniciar el squid:
service squid restart Otra posible solución es que al parecer en algún parámetro del archivo squid está faltando algo o los archivos que contienen las ips para los servicios que estás configurando tengan algún error, te pongo un ejemplo de mis configuraciones, espero te ayuden: ÉSTA ES LA CONFIGURACIÓN DE MI SQUID: ###---INICIO http_port 8080 transparent hierarchy_stoplist cgi-bin ? acl QUERY urlpath_regex cgi-bin \? cache deny QUERY acl apache rep_header Server ^Apache broken_vary_encoding allow apache cache_mem 64 MB cache_dir ufs /var/spool/squid 700 16 256 access_log /var/log/squid/access.log squid refresh_pattern ^ftp: 1440 20% 10080 refresh_pattern ^gopher: 1440 0% 1440 refresh_pattern . 0 20% 4320 ###---Reglas de acceso acl all src 0.0.0.0/0.0.0.0 acl manager proto cache_object acl localhost src 127.0.0.1/255.255.255.255 acl redlocal src "/etc/squid/ipsallowed" acl redlocal1 src "/etc/squid/ipsdeny" acl sites_deny url_regex "/etc/squid/sitnegados" acl list_extensions urlpath_regex "/etc/squid/filextensions" acl to_localhost dst 127.0.0.0/8 acl SSL_ports port 443 563 acl CONNECT method CONNECT http_access allow manager localhost http_access deny manager http_access deny !Safe_ports http_access deny CONNECT !SSL_ports http_access allow localhost http_access allow redlocal !redlocal1 !sites_deny !list_extensions http_access deny all http_reply_access allow all icp_access allow all visible_hostname mydomain.com ###---FIN ÉSTOS SON LOS ARCHIVOS QUE DESCRIBO EN MIS acl Contenido: /etc/squid/ipsallowed ---> acl redlocal src "/etc/squid/ipsallowed" ###---Rango de IPs con acceso al internet 192.168.3.200 ###---INICIO ' ' 192.168.3.240 ###--- FIN Contenido: /etc/squid/ipsdeny ---> acl redlocal1 src "/etc/squid/ipsdeny" ###---Rango de IPs con acceso nulo al internet 192.168.3.2 ###---INICIO ' ' ###---Aquí omito el rango de IPs con acceso permitido, de lo contrario estaría redundando. ' ' 192.168.3.254 ###--- FIN Contenido: /etc/squid/sitnegados ---> acl sites_deny src "/etc/squid/sitnegados" ###---Direcciones y nombres a los que los usuarios tienen bloqueado el acceso ###---INICIO www.xxx.com www.youtube.com xxx sex music mp3 hi5 ' ' etc... ###---FIN Contenido: /etc/squid/filextensions ---> acl list_extensions src "/etc/squid/filextensions" ###---Extensiones de archivos que no quiero que vean y descarguen mis usuarios. ###---INICIO \.wav$ \.mp3$ \.exe$ \.flv$ \.mp4$ ' ' etc... ###---FIN Y listo esa es la configuración básica que puedo mostrarte de un squid que tengo montado en una LAN pequeña, hay muchas configuraciones más, pero estas líneas son las más básicas y te pueden guiar para tu propósito amigo. Otra cosa, te recomiendo verificar insitentemente en tus archivos de configuración y los archivos que creaste en la carpeta del squid, pueda que algún espacio o algún caracter especial interfiera en el arranque del squid. \../_ Metal por sobre todas las cosas _\../ |
|||||||
|
||||||||
Page navigation |
Contenido generado en: 0.41 segundos |
![]() ![]() |
Todas las horas son CST. Hora actual 07:28 . |
|
|