Squid 2.7.STABLE3-4.1 作为 Ubuntu Server 9.04 上的透明代理

Squid 2.7.STABLE3-4.1 作为 Ubuntu Server 9.04 上的透明代理

根本无法让它工作!我试图让这个 Linux 机器充当透明代理,并在 DHCP 的帮助下,强制网络上的每个人都进入代理。

我有两个以太网连接,都连接到同一个交换机。我试图让 192.168.1.234 成为默认网关。
实际的 WAN 连接是到网关 192.168.1.1。eth0
是 192.168.1.234
eth1 是 192.168.1.2

实际上,我试图将 eth0 设为仅 LAN 接口,将 eth1 设为 WAN 接口。我是否应该将 eth1 的网关设置为指向 192.168.1.234

我的 squid.conf 文件在底部添加了以下指令: 仅在 /etc/network/interfaces 中设置 eth0 以具有网关地址 我不确定 http_port 3128 transparent acl lan src 192.168.1.0/24 acl lh src 127.0.0.1/255.255.255.0 http_access allow lan http_access allow lh

我添加了以下路由命令:

iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.1.2:3128
iptables -t nat -A PREROUTING -i eth1 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3128

我设置了一台 TCP 设置 192.168.1.234 的计算机作为网关,并打开了 google.com,但出现了请求错误。有什么想法为什么这不起作用吗? :( 一直在寻找解决方案,但无济于事。

----------------------------- 编辑 ------------------------------- 设法让它正确路由到 squid,这是我在浏览器中收到的错误:

ERROR
The requested URL could not be retrieved

While trying to process the request:

GET / HTTP/1.1
Host: www.google.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cache-Control: max-age=0



The following error was encountered:

    * Invalid Request 

Some aspect of the HTTP Request is invalid. Possible problems:

    * Missing or unknown request method
    * Missing URL
    * Missing HTTP Identifier (HTTP/1.0)
    * Request is too large
    * Content-Length missing for POST or PUT requests
    * Illegal character in hostname; underscores are not allowed 

Your cache administrator is webmaster.
Generated Mon, 26 Oct 2009 03:41:15 GMT by mjolnir.lloydharrington.local (squid/2.7.STABLE3)

答案1

确保您没有冲突的端口定义,Squid 无论如何都会监听 3128,因此您可能需要修改现有语句,而不是添加新的语句。

另外,请尝试手动将该框设置为代理,并确保它在使其透明之前能够正常工作。

答案2

相关内容