서버 세부 사항
Squid Transparent Proxy Version: 3.3.8
OS: Ubuntu Server 14.04
Server IP: 192.168.1.3
오징어 구성 파일
(grep을 사용한 주석 제외)
root@ubuntu:~# grep -v '^$\|^\s*\#' /etc/squid3/squid.conf
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
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
acl mylocalnetwork src 192.168.1.0/24
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost manager
http_access allow mylocalnetwork
http_access deny manager
http_access allow localhost
http_access deny all
http_port 3128 transparent
cache_mem 8 MB
maximum_object_size_in_memory 32 KB
memory_replacement_policy heap GDSF
cache_replacement_policy heap LFUDA
cache_dir aufs /opt/squid/cache 10000 14 256
maximum_object_size 128000 KB
cache_swap_low 95
cache_swap_high 99
coredump_dir /var/spool/squid3
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern (Release|Packages(.gz)*)$ 0 20% 2880
refresh_pattern -i \.(gif|png|jp?g|ico|bmp|tiff?)$ 10080 95% 43200
refresh_pattern -i \.(rpm|cab|deb|exe|msi|msu|zip|tar|xz|bz|bz2|lzma|gz|tgz|rar|bin|7z|doc?|xls?|ppt?|pdf|nth|psd|sis)$ 10080 90% 43200
refresh_pattern -i \.(avi|iso|wav|mid|mp?|mpeg|mov|3gp|wm?|swf|flv|x-flv|axd)$ 43200 95% 432000
refresh_pattern -i \.(html|htm|css|js)$ 1440 75% 40320
refresh_pattern -i \.index.(html|htm)$ 0 75% 10080
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 1440 90% 10080
quick_abort_min 0 KB
quick_abort_max 0 KB
quick_abort_pct 100
store_avg_object_size 13 KB
visible_hostname localhost
오징어 통나무
-------------------------------------------------------------
-----------------------------------------------------------
----------------------------------------------------------
2014/07/03 22:11:57| ERROR: No forward-proxy ports configured.
2014/07/03 22:11:57| ERROR: No forward-proxy ports configured.
2014/07/03 22:11:57| ERROR: No forward-proxy ports configured.
2014/07/03 22:11:57| ERROR: No forward-proxy ports configured.
2014/07/03 22:11:57| ERROR: No forward-proxy ports configured.
2014/07/03 22:11:57| ERROR: No forward-proxy ports configured.
2014/07/03 22:11:57| ERROR: No forward-proxy ports configured.
2014/07/03 22:11:57| ERROR: No forward-proxy ports configured.
2014/07/03 22:11:57| ERROR: No forward-proxy ports configured.
2014/07/03 22:11:57| ERROR: No forward-proxy ports configured.
2014/07/03 22:11:57| ERROR: No forward-proxy ports configured.
2014/07/03 22:11:57| ERROR: No forward-proxy ports configured.
2014/07/03 22:11:57| Loaded Icons.
2014/07/03 22:11:57| HTCP Disabled.
2014/07/03 22:11:57| Pinger socket opened on FD 13
2014/07/03 22:11:57| Squid plugin modules loaded: 0
2014/07/03 22:11:57| Adaptation support is off.
2014/07/03 22:11:57| Accepting NAT intercepted HTTP Socket connections at local=0.0.0.0:3128 remote=[::] FD 11 flags=41
2014/07/03 22:11:57| Done reading /opt/squid/cache swaplog (2 entries)
2014/07/03 22:11:57| Finished rebuilding storage from disk.
2014/07/03 22:11:57| 2 Entries scanned
2014/07/03 22:11:57| 0 Invalid entries.
2014/07/03 22:11:57| 0 With invalid flags.
2014/07/03 22:11:57| 2 Objects loaded.
2014/07/03 22:11:57| 0 Objects expired.
2014/07/03 22:11:57| 0 Objects cancelled.
2014/07/03 22:11:57| 0 Duplicate URLs purged.
2014/07/03 22:11:57| 0 Swapfile clashes avoided.
2014/07/03 22:11:57| Took 0.08 seconds ( 24.94 objects/sec).
2014/07/03 22:11:57| Beginning Validation Procedure
2014/07/03 22:11:57| Completed Validation Procedure
2014/07/03 22:11:57| Validated 2 Entries
2014/07/03 22:11:57| store_swap_size = 12.00 KB
2014/07/03 22:11:57| ERROR: No forward-proxy ports configured.
2014/07/03 22:11:57| pinger: Initialising ICMP pinger ...
2014/07/03 22:11:57| pinger: ICMP socket opened.
2014/07/03 22:11:57| pinger: ICMPv6 socket opened
2014/07/03 22:11:57| Pinger exiting.
2014/07/03 22:11:58| storeLateRelease: released 0 objects
IP 테이블 규칙
(당분간 단일 인터페이스 "eth0"사용)
iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.1.3:3128
iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3128
iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o eth0 -j MASQUERADE
클라이언트 구성
문제는 아래와 같이 Squid의 IP가 게이트웨이 및 기본 DNS 인 클라이언트 컴퓨터에서 인터넷에 액세스 할 수 없다는 것 입니다.
우분투 클라이언트에서
auto eth0
iface eth0 inet static
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.3
dns-nameservers 192.168.1.3
Windows 클라이언트에서
우분투 클라이언트의 DNS dns-nameservers 192.168.1.1
와 Windows 클라이언트의 DNS를 192.168.1.1
오징어 ip (192.168.1.3) 대신 라우터의 동일한 IP로 변경하면 두 가지 모두에서 인터넷에 액세스 할 수 있습니다. 페이지가 라우터에서 직접 렌더링되고 캐시를 사용하는 오징어 서버가 아닐 수 있으므로 수행 할 수있는 방법이 아닐 수도 있습니다 (물론 /var/log/squid3/cache.log에서 로그가 생성되는 것을 볼 수 있습니다). 또한 이미 액세스 한 페이지에 대해 라우터가 깜박이는 것을 발견했습니다. 이는 오징어 캐시에서 가져 오는 대신 인터넷을 통해 요청을 보내는 것을 의미 할 수 있습니다.
나는 여전히 타협하지 않았습니다. 인터넷이 종료 된 캐시에서 클라이언트 컴퓨터의 방문한 페이지에 계속 액세스 할 수 있으면 만족할 것입니다.
Squid Transparent Proxy에 대해 클라이언트를 구성하는 절차는 무엇입니까?
업데이트 1
root@ubuntu:~# iptables -t nat -L -n -v
Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 DNAT tcp -- eth0 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 to:192.168.1.3:3128
0 0 REDIRECT tcp -- eth0 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 redir ports 3128
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 MASQUERADE all -- * eth0 192.168.1.0/24 0.0.0.0/0
업데이트 2
그것은 작동하고 이전 버전에 Ubuntu 10.04(lucid)
오징어 버전으로 Squid Cache: Version 2.7.STABLE7
아래, 그리고 것은 오징어 설정 파일이 근무하고 클라이언트의 게이트웨이 및 DNS가 명쾌한의 IP로 설정되어 때 클라이언트 컴퓨터에서 인터넷에 액세스 할 수 있습니다 :
root@lucid:~# grep -v '^$\|^\s*\#' /etc/squid/squid.conf
acl all src all
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32
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 mynet src 192.168.1.0/24 # RFC1918 possible internal network
acl SSL_ports port 443 # https
acl SSL_ports port 563 # snews
acl SSL_ports port 873 # rsync
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
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 Safe_ports port 631 # cups
acl Safe_ports port 873 # rsync
acl Safe_ports port 901 # SWAT
acl purge method PURGE
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access allow mynet
http_access deny all
icp_access allow localnet
icp_access deny all
http_port 3128 transparent
hierarchy_stoplist cgi-bin ?
cache_mem 8 MB
maximum_object_size_in_memory 32 KB
cache_dir ufs /var/spool/squid 2000 16 256
access_log /var/log/squid/access.log squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern (Release|Package(.gz)*)$ 0 20% 2880
refresh_pattern . 0 20% 4320
acl shoutcast rep_header X-HTTP09-First-Line ^ICY.[0-9]
upgrade_http0.9 deny shoutcast
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
extension_methods REPORT MERGE MKACTIVITY CHECKOUT
hosts_file /etc/hosts
offline_mode on
coredump_dir /var/spool/squid
왜 Ubuntu 14.04
Squid 버전 에서 작동하지 않는지 잘 모르겠습니다 Squid Cache: Version 3.3.8
. 새로운 버전의 오징어 또는 새로운 destro!에서 일부 설정이 누락되었습니다.
squid3 -k parse
. 모두 깨끗합니다.