【发布时间】:2011-01-30 05:48:29
【问题描述】:
过去两天我们一直在尝试让 squid 2.7 与 ubuntu 9.10 一起工作。运行 ubuntu 的计算机有两个网络接口:eth0 和 eth1,dhcp 在 eth1 上运行。两个接口都有静态 IP,eth0 连接到 Internet,eth1 连接到我们的 LAN。
我们确实遵循了几十个不同的教程,但都没有成功。这里的教程是我们做的最后一个实际上给我们带来了某种结果的教程:http://www.basicconfig.com/linuxnetwork/setup_ubuntu_squid_proxy_server_beginner_guide。
当我们尝试从 LAN 访问像 Seriouswheels.com 这样的网站时,我们会在客户端计算机上收到以下消息:
错误
无法检索到请求的 URL
尝试处理请求时遇到无效请求错误:
GET / HTTP/1.1
主持人:www.seriouswheels.com
连接:保持活动
用户代理:Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/532.9 (KHTML, like Gecko) Chrome/5.0.307.11 Safari/532.9
缓存控制:max-age=0
接受:application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,/;q=0.5
接受编码:gzip、deflate、sdch
Cookie:__utmz=88947353.1269218405.1.1.utmccn=(直接)|utmcsr=(直接)|utmcmd=(无); __qca=P0-1052556952-1269218405250; __utma=88947353.1027590811.1269218405.1269218405.1269218405.1; __qseg=Q_D
接受语言:en-US,en;q=0.8
接受字符集:ISO-8859-1,utf-8;q=0.7,*;q=0.3
一些可能的问题是:
缺少或未知的请求方法。
缺少网址。
缺少 HTTP 标识符 (HTTP/1.0)。
请求过大。
POST 或 PUT 请求缺少内容长度。
主机名中的非法字符;不允许使用下划线。
您的缓存管理员是网站管理员。
以下是所有配置文件:/etc/squid/squid.conf、/etc/network/if-up.d/00-firewall、/etc/network/interfaces、/var/log/squid/access。日志。某处有问题,但我们无法弄清楚在哪里。
我们所有这一切的最终目标是将内容叠加到客户端在 LAN 上请求的每个页面上。我们被告知 squid 是执行此操作的方法,但在游戏的这一点上,我们只是尝试正确设置 squid 作为我们的代理。
提前致谢。
squid.conf
acl 全部 src 全部
acl 管理器原型缓存对象
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8
acl localnet src 192.168.0.0/24
acl SSL_ports 端口 443 # https
acl SSL_ports 端口 563 # 新闻
acl SSL_ports 端口 873 # rsync
acl Safe_ports 端口 80 # http
acl Safe_ports 端口 21 # ftp
acl Safe_ports 端口 443 # https
acl Safe_ports 端口 70 # gopher
acl Safe_ports 端口 210 # wais
acl Safe_ports 端口 1025-65535 # 未注册的端口
acl Safe_ports 端口 280 # http-mgmt
acl Safe_ports 端口 488 # gss-http
acl Safe_ports 端口 591 # filemaker
acl Safe_ports 端口 777 # 多重 http
acl Safe_ports 端口 631 # 杯子
acl Safe_ports 端口 873 # rsync
acl Safe_ports 端口 901 # 特警
acl 吹扫方法 PURGE
acl CONNECT 方法 CONNECT
http_access 允许管理器本地主机
http_access 拒绝管理器
http_access 允许清除本地主机
http_access 拒绝清除
http_access 拒绝!Safe_ports
http_access 拒绝 CONNECT !SSL_ports
http_access 允许本地主机
http_access 允许本地网
http_access 全部拒绝
icp_access 允许本地网
icp_access 全部拒绝
http_port 3128
hierarchy_stoplist cgi-bin ?
cache_dir ufs /var/spool/squid/cache1 1000 16 256
access_log /var/log/squid/access.log 鱿鱼
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
刷新模式。 0 20% 4320
acl 广播 rep_header X-HTTP09-First-Line ^ICY.[0-9]
upgrade_http0.9 拒绝直播
acl apache rep_header 服务器 ^Apache
broken_vary_encoding 允许 apache
extension_methods 报告合并 MKACTIVITY 结帐
cache_mgr 网站管理员
缓存有效用户代理
缓存有效组代理
主机文件 /etc/hosts
coredump_dir /var/spool/squid
access.log
1269243042.740 0 192.168.1.11 TCP_DENIED/400 2576 GET NONE:// - NONE/- text/html
00-防火墙
iptables -F iptables -t nat -F iptables -t mangle -F iptables -X
回声 1 | tee /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -j MASQUERADE
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 3128
网络
自动驾驶
iface lo inet 环回
自动 eth0
iface eth0 inet 静态
地址 142.104.109.179
网络掩码 255.255.224.0
网关 142.104.127.254
自动 eth1
iface eth1 inet 静态
地址 192.168.1.100
网络掩码 255.255.255.0
【问题讨论】:
-
这个问题显然属于 serverfault.com
-
感谢您的建议。我已经这样做了。
标签: proxy ubuntu-9.10 squid dhcp