如何使用鱿鱼使用多个外部IP?

时间:2018-07-16 10:13:11

标签: squid

我正试图让Squid(3.5)将流量转发到连接到互联网的ip(10.0.1.9和10.0.1.10)。我正在使用以下squid配置。此配置可以直接传递去往.9和.10的流量。

代理还在侦听10.0.1.7(其他计算机的内部IP)和127.0.0.1。当我在localhost或10.0.1.7上使用代理时,总是会遇到访问被拒绝的情况。在访问日志中,我确实看到了对10.0.1.10的转发,但是并没有转发。

我在做什么错?我不希望127.0.0.1和10.0.1.7直接进入互联网。我正在检查http://ip-api.com/json,看看是否最终使用了正确的IP。

acl localnet src 10.0.0.0/8     # RFC1918 possible internal network
acl localnet src 172.16.0.0/12  # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl localnet src fc00::/7       # RFC 4193 local private network range
acl localnet src fe80::/10      # RFC 4291 link-local (directly plugged) machines
acl localnet src 127.0.0.1

http_access allow localnet
http_access deny all

http_port 127.0.0.1:3128 name=toForward1
http_port 10.0.1.7:3128 name=toForward2
http_port 10.0.1.9:3128 name=ext1
http_port 10.0.1.10:3128 name=ext2

server_persistent_connections off

acl ext1 myportname ext1
acl ext2 myportname ext2

acl externalIp myportname ext1
acl externalIp myportname ext2

acl toForward myportname toForward1
acl toForward myportname toForward2

tcp_outgoing_address 10.0.1.9 ext1
tcp_outgoing_address 10.0.1.10 ext2

always_direct allow externalIp

cache_peer 10.0.1.9 parent 3128 0 default no-query no-delay no-digest no-netdb-exchange round-robin name=parent1
cache_peer 10.0.1.10 parent 3128 0 default no-query no-delay no-digest no-netdb-exchange round-robin name=parent2

cache_peer_access parent1 allow toForward
cache_peer_access parent2 allow toForward


never_direct allow toForward

日志显示如下:

1531741167.790      0 10.0.1.7 TCP_MISS/403 4039 GET http://ip-api.com/json - HIER_NONE/- text/html
1531741167.790      1 10.0.1.7 TCP_MISS/403 4165 GET http://ip-api.com/json - ROUNDROBIN_PARENT/10.0.1.10 text/html

0 个答案:

没有答案
相关问题