我有以下设置:
为了更好地理解: sub1.domain.tld-->WAN1--ROUTER1--net1--SERVER1 | SQUID | sub2.domain.tld-->WAN2--ROUTER2--net2--SERVER2 sub1.domain.tld-->WAN1--ROUTER1--net1--SERVER1 | SQUID | sub2.domain.tld-->WAN2--ROUTER2--net2--SERVER2
我的问题:
似乎从鱿鱼返回的数据包总是采取默认路线。
如何解决这个问题,使两个广域网路由工作?
我尝试使用tcp_outgoing_address,但没有成功:
tcp_outgoing_address 192.168.1.123 localnet1 tcp_outgoing_address 192.168.2.123 localnet2
同样明确地绑定到具体的IPS并没有帮助:
http_port 192.168.1.123:80 accel defaultsite=sub1.domain.tld https_port 192.168.1.123:443 accel cert=/etc/ssl/certs/domain.tld.crt key=/etc/ssl/private/domain.tld.key defaultsite=sub1.domain.tld http_port 192.168.2.123:80 accel defaultsite=sub2.domain.tld https_port 192.168.2.123:443 accel cert=/etc/ssl/certs/domain.tld.crt key=/etc/ssl/private/domain.tld.key defaultsite=sub2.domain.tld
谢谢你的帮助!
这里是相应的configuration:
鱿鱼服务器的/ etc / network / interfaces :
auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 192.168.1.123 netmask 255.255.255.0 gateway 192.168.1.1 dns-nameservers 192.168.1.1 auto eth1 iface eth1 inet static address 192.168.2.123 netmask 255.255.255.0 dns-nameservers 192.168.2.1
/etc/squid3/squid.conf
# define some ACL aliases acl localnet1 src 192.168.1.0/24 acl localnet2 src 192.168.2.0/24 acl allsrc src all acl safeports port 80 443 acl sslports port 443 acl purge method PURGE acl connect method CONNECT acl HTTP proto HTTP acl HTTPS proto HTTPS # restrict management options http_access allow manager localhost http_access deny manager http_access allow purge localhost http_access deny purge # block non-safe ports http_access deny !safeports http_access deny CONNECT !sslports # define ports and certs http_port 80 accel defaultsite=sub1.domain.tld https_port 443 accel cert=/etc/ssl/certs/domain.tld.crt key=/etc/ssl/private/domain.tld.key defaultsite=sub1.domain.tld # define peers cache_peer 192.168.1.234 parent 443 0 proxy-only no-query no-digest originserver login=PASSTHRU connection-auth=on ssl sslflags=DONT_VERIFY_PEER front-end-https=on name=server1 cache_peer 192.168.2.234 parent 443 0 proxy-only no-query no-digest originserver login=PASSTHRU connection-auth=on ssl sslflags=DONT_VERIFY_PEER front-end-https=on name=server2 # define uris acl server1_acl url_regex -i ^https://sub1.domain.tld/*$ acl server2_acl url_regex -i ^https://sub2.domain.tld/*$ # bind peers to acls and block direct access never_direct allow server1_acl http_access allow server1_acl cache_peer_access server1 allow server1_acl never_direct allow server2_acl http_access allow server2_acl cache_peer_access server2 allow server2_acl # handle unhandled connections deny_info TCP_RESET allsrc http_access allow localnet1 http_access allow localnet2 http_access deny allsrc
好的,发现问题:路由问题…
就像我以为所有传出的数据包都通过eth0发送。 这可以通过设置其他路线来解决:
添加新的路由表:
echo 1 rt2 >> >> /etc/iproute2/rt_tables
configuration新的路由:
ip route add 192.168.2.0/24 dev eth1 src 192.168.178.123 table rt2 ip route add default via 192.168.2.1 dev eth1 table rt2 ip rule add from 192.168.2.123/32 table rt2 ip rule add to 192.168.2.123/32 table rt2
为了使这个持久包含在eth1的/ etc / network / interfaces中
post-up ip route add 192.168.2.0/24 dev eth1 src 192.168.178.123 table rt2 post-up ip route add default via 192.168.2.1 dev eth1 table rt2 post-up ip rule add from 192.168.2.123/32 table rt2 post-up ip rule add to 192.168.2.123/32 table rt2
致: