Tenho um servidor com dois gateways, o comando route da a seguinte situacao (mudei alguns numeros dos ips por seguranca)
ROUTE:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
200.171.29.64 * 255.255.255.192 U 0 0 0 eth2
200.245.116.128 * 255.255.255.192 U 0 0 0 eth0
10.0.0.0 * 255.255.0.0 U 0 0 0 eth1
loopback * 255.0.0.0 U 0 0 0 lo
default 200.245.116.129 0.0.0.0 UG 1 0 0 eth0
default 200-171-29-65.d 0.0.0.0 UG 2 0 0 eth2
ai dou os seguintes comandos:
ip route add table 11 default via 200.171.29.65
ip rule add pref 11 fwmark 11 table 11
iptables -t mangle -A PREROUTING -s 10.0.0.0/16 -p tcp -m tcp --dport 80 -j MARK --set-mark 11
Tudo maravilha!! Marco os pacotes com 11 e eles saem pela porta certa. O resto fica no gateway com metric 1 (200.245.116.129, no caso).
Entro no www.meuip.com.br, www.whatip.com e aparece como ip o 200.171.29.90
Meus ips:
eth0: 200.245.116.130
eth1: 10.0.0.1 servidor
eth2: 200.171.29.90
Até ai tudo um beleza, esta funcionando mil maravilhas!!
O problema surge qdo ligo o squid!! Aciono ele na porta 3128 e redireciono o meu browser para essa porta, SÓ QUE ELE NAO SAI MAIS PELO LINK 200.171.29.65, MAS PELO LINK DA ETH0!!!
Alguem sabe por quê?
Abaixo segue o meu squid.conf, Coloquei apenas as opcoes que diferem do dafault do squid.conf. O que nao esta ai é porque está no default.
Muito obrigado!
SQUID.CONF
acl QUERY urlpath_regex cgi-bin \?
no_cache deny QUERY
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
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 rede src 10.0.0.0/255.255.0.0
acl to_localhost dst 127.0.0.0/8
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, 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 CONNECT method CONNECT
http_access allow localhost
http_access allow rede
http_reply_access allow all
icp_access allow all
cache_effective_user dobert
cache_effective_group dobert
httpd_accel_port 80
httpd_accel_host virtual
httpd_accel_with_proxy on
httpd_accel_uses_host_header on
error_directory /usr/local/squid/share/errors/Portuguese