그래서 PF 및 Squid를 실행하는 FreeBSD 라우터가 있고 두 개의 네트워크 인터페이스가 있습니다. 두 개는 업스트림 공급자 (각각 em0
및 em1
)에 연결되어 있고 LAN (re0
) 서브. PF로 구성된 일부로드 균형 조정이 있습니다. 기본적으로 모든 트래픽을 하나의 인터페이스 (em0
)와 다른 모든 인터페이스 (em1
)를 통해 1-1024
포트로 라우팅합니다.PF,로드 밸런싱 된 게이트웨이 및 Squid
이제는 LAN상의 모든 HTTP 요청을 3128
127.0.0.1
에 투명하게 리디렉션하는 상자에서 Squid 프록시를 실행하고 있습니다. Squid는이 요청을 HTTP 외부로 리디렉션하므로 em0
을 통한로드 균형 조정 규칙을 따라야합니까? 문제는 우리가 그것을 테스트했을 때입니다 (LAN에있는 컴퓨터에서 http://whatismyip.com으로 검색하면 em1
인터페이스의 외부 IP를보고합니다!) Squid를 끈 경우 em0
의 외부 IP가 예상대로보고됩니다 ..
는 어떻게 오징어는 우리가 설정 한 부하 분산 규칙과 동작하도록 할 여기에 내가 가진 /etc/pf.conf
에서 관련 설정입니다
:
ext_if1="em1" # DSL
ext_if2="em0" # T1
int_if="re0"
ext_gw1="x.x.x.1"
ext_gw2="y.y.y.1"
int_addr="10.0.0.1"
int_net="10.0.0.0/16"
dsl_ports = "1024:65535"
t1_ports = "1:1023"
...
squid=3128
rdr on $int_if inet proto tcp from $int_net \
to any port 80 -> 127.0.0.1 port $squid
pass in quick on $int_if route-to lo0 inet proto tcp \
from $int_net to 127.0.0.1 port $squid keep state
...
# load balancing
pass in on $int_if route-to ($ext_if1 $ext_gw1) \
proto tcp from $int_net to any port $dsl_ports keep state
pass in on $int_if route-to ($ext_if1 $ext_gw1) \
proto udp from $int_net to any port $dsl_ports
pass in on $int_if route-to ($ext_if2 $ext_gw2) \
proto tcp from $int_net to any port $t1_ports keep state
pass in on $int_if route-to ($ext_if2 $ext_gw2) \
proto udp from $int_net to any port $t1_ports
pass out on $ext_if1 route-to ($ext_if2 $ext_gw2) from $ext_if2 to any
pass out on $ext_if2 route-to ($ext_if1 $ext_gw1) from $ext_if1 to any
나는 다음과 같은 규칙을 추가하는 시도가 있지만, 아무것도하지 않았다 :
pass in on $int_if route-to ($ext_if2 $ext_gw2) \
proto tcp from 127.0.0.1 to any port $t1_ports keep state
고마워요!
'그물'의 아카이브를 통해 수색 한 결과 가장 가까운 것은이 [미해결 토론] (http://www.mail-archive.com/[email protected]/msg05744.html)이었습니다. – Santa