论坛风格切换切换到宽版
  • 837阅读
  • 3回复

[问题求助]急!!!诚意向高手求教squid和iptables配置透明代理问题!! [复制链接]

上一主题 下一主题
离线pchhh.
 
发帖
1960
C币
-235489
威望
365
贡献值
1
银元
0
铜钱
4343
人人网人气币
0
只看楼主 倒序阅读 使用道具 楼主  发表于: 2009-05-01
小弟有台linux redhat 6.0 现局.域网内的机子希.望通过这台机子做透明代理,进行web访问.电影
现在squid经配置后,在客户端用ie设置后能够.通过312.8端口进行访问...
但无.法利用iptabl.es进行透明访问,配置文件如下:<性病>

#!/bin/sh
modprobe .ip_tables.
modprobe i.p_nat_ftp健康
modprobe ip._conntrack           鲜花
modprobe ip_conntrack._ftp.
echo "Enabling IP .Forwarding...."电脑
echo .1 >; ./proc/sys/net/ipv4/ip_forward             汽车
ec.ho "Startin.g iptables rules".
#Refersh all cha.ins             汽车
/s.bin/iptables -F -t nat学习
iptables -t nat -A PREROUTIN.G -i et.h0 -p tcp --dport 80 -j REDIRECT --TO-PORTS. 3128           女人
IPTABLES -T NAT -A POSTROUT.ING -.s 192.168.0.0/24 -o eth1 -j S.NAT --to 192.168.77.77.
iptables -A FORWARD. -m state --state ESTABLISHED,RELATED -j A.CCEPT教育

现我内部网关地址为ech0 192.168.0..1服务器
      出.口地址为    ech1 192.168.77.7.7.

使用透明代理服务,进行web访问时出现如下问题.:投资
######.##################.##################           女人
ERROR
The reque.sted URL co.uld not be retrieved             汽车

-----.----------------------------------------------.--------------.---------------            杀毒

While t..rying to retrieve the URL: / .

The foll.owing error was enco.untered: (        游戏          )

Invalid URL
Some .aspec.t of the requested URL is incorrect. Possible problems: 教育

Missing or incorrect access protocol (should be `http://'' or similar)     外汇
M.issing hostname             杀毒
Ille.gal. double-escape in the URL-Path            建材
Illegal character in hostname; un.derscores a.re not allowed .
Your cache administrat.or is root..              电子



-------.----------------.--------------------------------------------------.-------.
Generated W.ed, 21 Apr 2004 11:51:59. GMT by localhost..localdomain (Squid/2.4.STABLE7)               乙肝
#################.########################.#.
看来现.象好象是把我请求的网址过滤掉了.服务器
如果我请求http://www.chinaunix.net/jh/38/107156.html,则提示如下:--------------彩票

ERROR
The requested URL could. not be retri.eved外贸

----------.----------.--------------------------------------.----------------------<性病>

While trying. to retri.eve the URL: /jh/38/107156.html.

The following error w.as. encountered: 投资

Invalid URL
Some aspect of the requested URL is incorre.ct. Poss.ible problems:            鲜花

Missing or incorrect access protocol (should be `http://'' or similar)             杀毒
Missin.g hostname 学习
Illegal double-e.scape in the URL-Pat.h .
Ille.gal chara.cter in hostname; underscores are not allowed 电影
Yo.ur cache admini.strator is root. .



-.-------------------------------.------------.------------------------------------    健康
Generated Wed, 21 Apr 20.04 11.:51:59 GMT by localhost.localdomain (Squid/2.4.STABLE7.)            建材

求高手赐教!!

评价一下你浏览此帖子的感受

精彩

感动

搞笑

开心

愤怒

无聊

灌水
离线涵冰.
发帖
2063
C币
-235248
威望
379
贡献值
1
银元
-1
铜钱
4644
人人网人气币
0
只看该作者 沙发  发表于: 2010-04-13
应该是
iptables -A PREROUTING -t nat -i eth0 -s 192.168.0.0/24 -d ! 192.168.0.0/24 --dport 80 -j DNAT --to 192.168.0.1:3128

另外,你的SQUID是否允许用户了,你要确认一下(默认是拒绝的)

离线haliao8.
发帖
2227
C币
-60440
威望
385
贡献值
1
银元
-2
铜钱
4841
人人网人气币
0
只看该作者 板凳  发表于: 2010-04-13


QUOTE:原帖由 "platinum" 发表:
应该是
iptables -A PREROUTING -t nat -i eth0 -s 192.168.0.0/24 -d ! 192.168.0.0/24 --dport 80 -j DNAT --to 192.168.0.1:3128

另外,你的SQUID是否允许用户了,你要确认一下(默认是拒绝的)



请问这个默认该怎么改啊??急!!

离线yingouqlj.
发帖
2158
C币
-139181
威望
397
贡献值
1
银元
0
铜钱
4718
人人网人气币
0
只看该作者 地板  发表于: 2010-04-13


QUOTE:原帖由 "platinum" 发表:
应该是
iptables -A PREROUTING -t nat -i eth0 -s 192.168.0.0/24 -d ! 192.168.0.0/24 --dport 80 -j DNAT --to 192.168.0.1:3128

另外,你的SQUID是否允许用户了,你要确认一下(默认是拒绝的)

谢谢,platinum..按照你的设置完后,可以全透明上网,不过好象没有用到squid???还有不知道能不能把这条新命令详细解释一下是什么意思,跟原来的那条有什么不同??谢谢!!!
原来的:
iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3128
新的:
iptables -A PREROUTING -t nat -i eth0 -s 192.168.0.0/24 -d ! 192.168.0.0/24 --dport 80 -j DNAT --to 192.168.0.1:3128
现配置如下,麻烦帮看看有没有问题:
############################################
#!/bin/sh
modprobe ip_tables
modprobe ip_nat_ftp
modprobe ip_conntrack
modprobe ip_conntrack_ftp
echo "Enabling IP Forwarding..."
echo 1 >; /proc/sys/net/ipv4/ip_forward
echo "Starting iptables rules"
#Refersh all chains
/sbin/iptables -F -t nat
iptables -A PREROUTING -t nat -i eth0 -s 192.168.0.0/24 -d ! 192.168.0.0/24 --dport 80 -j DNAT --to 192.168.0.1:3128
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth1 -j SNAT --to 192.168.77.77
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
快速回复
限100 字节
如果您提交过一次失败了,可以用”恢复数据”来恢复帖子内容
 
上一个 下一个