legalnet
(usa KUbuntu)
Enviado em 06/10/2011 - 13:41h
Ok. Mas entao eu devo conectar o roteador na eth0 entao ne.
No caso eu preciso fazes com que a internet passe pelo squid.
Aqui estao meus arquivos.
Interfaces
auto lo
iface lo inet loopback
auto eth1
iface eth1 inet dhcp
auto eth0 inet static
address 192.168.10.2
netmask 255.255.255.0
metwork 192.168.10.0
broadcast 192.168.10.255
gateway 192.168.10.1
Squid
http_port 192.168.10.1:3128 transparent
cache_mem 256 MB
cache_dir ufs /var/spool/squid 2048 16 256
cache_access_log /var/log/squid/access.log
cache_log /var/log/squid/cache.log
cache_store_log /var/log/squid/store.log
pid_filename /var/run/squid.pid
error_directory /usr/share/squid/errors/Portuguese
emulate_httpd_log on
visible_hostname Proxy
maximum_object_size_in_memory 1024 KB
maximum_object_size 700 MB
minimum_object_size 1 KB
cache_swap_low 90
cache_swap_high 95
refresh_pattern ^ftp: 15 20% 2280
refresh_pattern ^gopher: 15 0% 2280
refresh_pattern . 15 20% 2280
acl all src 0.0.0.0/0.0.0.0
acl redelocal src 192.168.0.0/32
acl blockedsites url_regex -i "/etc/squid/block.txt"
acl unblockedsites url_regex "/etc/squid/unblock.txt"
acl noite time 19:00-07:59
acl manha time 08:00-11:59
acl almoco time 12:00-12:59
acl tarde time 13:00-18:59
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl SSL_ports port 443 563
acl Safe_ports port 21 80 443 563 70 210 280 488 59 777 901 1025-65535
acl ip_liberado src "/etc/squid/ip_liberado.txt"
acl trava_msn_orkut url_regex -i "/etc/squid/trava_msn_orkut.txt"
acl purge method PURGE
acl CONNECT method CONNECT
http_access allow localhost
http_access allow manha
http_access allow almoco
http_access allow tarde
http_access allow noite
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access allow ip_liberado
http_access deny trava_msn_orkut
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access allow redelocal
http_access deny blockedsites !unblockedsites
http_access allow all
rc.local em /etc/init.d
#! /bin/sh
### BEGIN INIT INFO
# Provides: rc.local
# Required-Start: $remote_fs $syslog $all
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Run /etc/rc.local if it exist
### END INIT INFO
PATH=/sbin:/usr/sbin:/bin:/usr/bin
. /lib/init/vars.sh
. /lib/lsb/init-functions
do_start() {
if [ -x /etc/rc.local ]; then
[ "$VERBOSE" != no ] && log_begin_msg "Running local boot scripts (/etc/rc.local)"
/etc/rc.local
ES=$?
[ "$VERBOSE" != no ] && log_end_msg $ES
return $ES
fi
}
case "$1" in
start)
do_start
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac
#LIMPA TODAS AS TABELAS ANTERIORES DO IPTABLES.
iptables -F
iptables -t nat -F
iptables -t mangle -F
#ATIVA O COMPARTILHAMENTO DE INTERNET DA ETH0 PARA ETH1 PASSANDO PELO SQUID NA PORTA 145.
echo 1 | sudo tee > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
#INTERNA=eth1 # placa ligada àede interna
#CAIXA=200.201.174.0/24 # IP da CAIXA a ser liberado para toda a rede.
iptables -t nat -A PREROUTING -i $INTERNA -d 200.201.174.0/24 -j ACCEPT
iptables -t filter -A FORWARD -i $INTERNA -d 200.201.174.0/24 -j ACCEPT
iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 145
#iptables -t nat -A POSTROUTING -s 192.168.0.1 -p tcp --dport 1863 -j MASQUERADE
iptables -A FORWARD -s 192.168.0.0/24 -p tcp --dport 1863 -j DROP
#iptables -A FORWARD -s 192.168.0.0/24 -p tcp --dport 3128 -j DROP
#REDIRECIONAMENTOS DE PORTA. "quando a ETH0 é primaria"
iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 4899 -j DNAT --to-destination 192.168.0.10:4899
iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 3389 -j DNAT --to-destination 192.168.0.10:3389
Quais sao os pontos errados.
Sao esses arquivos e configuracoes que eu preciso para compartilhar minha fazer meu proxy passando pelo squid..
Grato