Em 31/05/2011, às 20:32, Wenderson Souza escreveu: > Boa noite Galera, > > Venho acompanhando a lista há algum tempo pelos "arquivos" e há pouco > tempo como assinante. > > Migrei um servidor linux-centos-5.2 para FreeBSD 8.2 Release, nunca > tinha mexido com FreeBSD mas já tinha lido muito sobre o sistema. > > De cara adorei o FreeBSD pela sua facilidade de compilação/instalação > do kernel (coisa que ainda é meio chata em linux) e gostei mais ainda > dos ports. > > Consegui configurar os meus serviços mais necessários como: BIND, HTTP > (com vhosts), ftp, squid etc. > > Com 1 fornecedor de internet apenas, consegui fazer o squid funcionar > normalmente. > > Mas quando adiciono o outro fornecedor e tento utilizar o > tcp_outgoing_address do squid para definir por onde devem sair alguns > sites, não funciona. > > > Vamos a explicação. > > Tenho uma RB-44GB (4 interfaces de rede identificadas como vge0, vge1, > vge2 e vge3) > > > Meu kernel está configurado assim: > > options IPFIREWALL > options IPFIREWALL_VERBOSE > options IPFIREWALL_VERBOSE_LIMIT=100 > options IPFIREWALL_DEFAULT_TO_ACCEPT > options IPFIREWALL_FORWARD > options IPFIREWALL_NAT > options LIBALIAS > options IPDIVERT > options DUMMYNET > options HZ=1000 > options ROUTETABLES=10 > > > # ee /etc/rc.conf > # interfaces > #------------------------------------------------------------------ > ifconfig_vge0="inet 189.x.x.2 netmask 255.255.255.240" # link1 - rota default > ifconfig_vge0_alias0="inet 189.x.x.5 netmask 255.255.255.240" # http > ifconfig_vge0_alias1="inet 189.x.x.8 netmask 255.255.255.240" # smtp > ifconfig_vge0_alias2="inet 189.x.x.10 netmask 255.255.255.240" # ns1 > ifconfig_vge0_alias3="inet 189.x.x.11 netmask 255.255.255.240" # ns2 > ifconfig_vge1="inet 201.x.x.130 netmask 255.255.255.248" # link2 > ifconfig_vge2="inet 192.168.253.1 netmask 255.255.255.0" # link3 - > adsl para jogar lixo > ifconfig_vge3="inet 177.x.x.5 netmask 255.255.255.252" # /30 válido > rede internet (pppoe server roteado) > > # rotas > #----------------------------------------------------------------- > defaultrouter="189.x.x.1" # link1 - vge0 > gateway_enable="YES" > hostname="bgp.xxx.com.br" > route add 10.10.0.0/16 177.x.x0.6 # rota rede estatica interna > route add 177.x.x1.0/23 177.x.x0.6 # rota clientes pppoe > > # servicos > ... > > # firewall > #----------------------------------------------------------------- > firewall_enable="YES" > firewall_type="/etc/rc.fw" > > # fim ee /etc/rc.conf > > > > # ee /etc/rc.fw > #!/bin/sh > # rc.fw - firewall personalizado > #-------------------------------------------------------------------- > > .. flush > > # firewall statefull > ipfw add 1 check-state > > ... > > # nat > #------------------------------------------------------------------ > > setfib 1 route delete default > setfib 1 route add default 192.168.253.254 > ipfw table 1 add 192.168.253.1 > ipfw nat 1 config if vge2 > ipfw add 5000 nat 1 all from 192.168.253.1 to any > ipfw add 5001 setfib 1 all from 192.168.253.1 to any > ipfw add 5002 setfib 1 all from any to 192.168.253.1 > > setfib 2 route delete default > setfib 2 route add default 201.x.x.129 > ipfw table 2 add 201.x.x.130 > ipfw nat 2 config if vge1 > ipfw add 6000 nat 2 all from 201.x.x.130 to any > ipfw add 6001 setfib 2 all from 201.x.x.130 to any > ipfw add 6002 setfib 2 all from any to 201.x.x.130 > > setfib 3 route delete default > setfib 3 route add default 189.x.x.1 > ipfw table 3 add 189.x.x.2 > ipfw nat 3 config if vge0 > ipfw add 7000 nat 3 all from 189.x.x.2 to any > ipfw add 7001 setfib 3 all from 189.x.x.2 to any > ipfw add 7002 setfib 3 all from any to 189.x.x.2 > > # negar tudo > #------------------------------------------------------------------- > ipfw add 65533 deny log all from any to any > ipfw add 65534 deny all from any to any > > # fim ee /etc/rc.fw > > > > > no squid tenho no tcp_outgoing_address configurado assim: > > # squid > http_port 3128 transparent > > # link adsl > acl linkadsl url_regex -i "/usr/local/etc/squid/sites.linkadsl" > tcp_outgoing_address 192.168.253.1 linkadsl > > > # link2 > acl link2 url_regex -i "/usr/local/etc/squid/sites.link2" > tcp_outgoing_address 201.x.x.130 link2.sites > > > # link1 > tcp_outgoing_address 189.x.x.2 # ip da interface vge0 rota padrão do rc.conf
Wenderson, Bem-vindo ao grupo. O fib so funciona no roteamento (quando a tabela FIB é processada). Pro seu cenário use fwd: ipfw add fwd <gateway_2> tcp from <meu_ip_do_segundo_link_ to any out ok? -- Patrick Tracanelli FreeBSD Brasil LTDA. Tel.: (31) 3516-0800 316...@sip.freebsdbrasil.com.br http://www.freebsdbrasil.com.br "Long live Hanin Elias, Kim Deal!" ------------------------- Histórico: http://www.fug.com.br/historico/html/freebsd/ Sair da lista: https://www.fug.com.br/mailman/listinfo/freebsd