miguelmeyerc
(usa Debian)
Enviado em 24/02/2014 - 20:16h
Pessoal,
Estou configurando um gateway usando um Debian 7.
Nesse Debian já configurei minhas interfaces eth0 para ligar ao roteador e a eth1 para rede interna.
Já configurei o servidor de DHCP, Bind9 e squid (que funcionou antes de eu tentar usa-lo como proxy transparente).
As maquinas da rede conseguem receber configuração por dhcp e conseguem resolver nomes pelo bind9, mas não estou conseguindo compartilhar a internet usando o proxy.
Abaixo vai a minha configuração inicial do iptables para compartilhar a internet e direcionar para o squid.
#!/bin/bash
#
#
#inicia o processo
start(){
# redirecionando para squid
iptables -t nat -A PREROUTING -i eth1 -p TCP --dport 80 -j REDIRECT --to-port 3128
# compartilhando internet
iptables -t nat -A POSTROUTING -s 10.1.3.0/24 -o eth0 -j MASQUERADE
echo "1"> /proc/sys/net/ipv4/ip_forward
echo "Ativando configuracoes de firewall e compartilhamento de rede ..."
}
#mata o processo
stop(){
echo "Desativando configurações de firewall..."
# desativando as configurações de firewall
iptables -F
iptables -t nat -F
iptables -t mangle -F
modprobe iptable_nat
}
#reinicia o processo
restart(){
stop
sleep 1
start
}
case $1 in
start)
start
exit 0
;;
stop)
stop
exit 0
;;
restart)
restart
exit 0
;;
*)
echo -e "Use $0 start|stop|restart\n"
exit 1
;;
esac
#################################################################################
Segue configuração do squid
################################################################
#configuração do proxy transparente
http_port 3128 transparent
visible_hostname server
################################################################
#configurações do cache
#cache de memoria
cache_mem 64 MB
maximum_object_size_in_memory 96 KB
#cache de hd
cache_dir ufs /var/spool/squid 4096 16 256
maximum_object_size 120 MB
#uso do cache
cache_swap_low 90
cache_swap_high 95
#fim da configuração de cache
################################################################
#ativa o squidGuard
#url_rewrite_program /usr/bin/squidGuard -c /etc/squid/squidGuard.conf
#url_rewrite_children 6
# Regras de acesso
# acl - Recomendadas
#*******************
#
>>>>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 SSL_ports port 443 563 # https, snews
acl SSL_ports port 873 # rsync
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 563 # https, snews
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 Safe_ports port 631 # cups
acl Safe_ports port 873 # rsync
acl Safe_ports port 901 # SWAT
acl purge method PURGE
acl CONNECT method CONNECT
#
# acl - Personalizadas
# Define a rede interna (Intranet)
acl workgroup src 192.168.10.0/24
#
################################################################
#Define o acesso atraves das regras criadas anteriormente
# http_access - Recomendadas
#
http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
# http_access - Personalizadas
#*****************************
http_access allow localhost
>>>>http_access allow workgroup<<<<
#
#Nega tudo que não foi liberado ou negado
http_access deny all