免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3588 | 回复: 4
打印 上一主题 下一主题

[proxy] iptables+squid的nat透明代理的qq语音 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-12-02 13:07 |只看该作者 |倒序浏览
麻烦你帮我看看这样的配置能否达到qq语音聊天和文件传输吗?

eth0 ip 192.168.0.1 mask 255.255.255.0

eht1 ip你外网的ip

gate你外网的gateip

rm /etc/squid/squid.conf

vi /etc/squid/squid.conf

http_port 3128

acl all src 192.168.0.0/24

http_access allow all

httpd_accel host virtual

httpd_accel_port 80

httpd_accel_with_proxy on

httpd_accel_user_host_header on

cache_mem 82 MB

cache_dir ufs /dev/shm 128 16 256

dns_nameservers xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx #你本地的dns服务器ip

cache_swap_low 90

cache_swap_high 100

maximum_object_size 1024 KB

cache_access_log /dev/null

cache_log /var/log/squid/cache.log

cache_store_log none

unlinkd_program /usr/lib/squid/unlinkd

cache_effective_user squid

cache_effective_group squid

visible_hostname localhost

然后squid -Z看看有无错误

vi /bin/firewall

echo "1" > /proc/sys/net/ipv4/ip_forward

iptables -t nat -A PREROUTING -s 192.168.0.200/32 -p tcp --dport 80 -j REDIRECT 3128

iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth1 -j MASQUERADE

论坛徽章:
0
2 [报告]
发表于 2005-12-02 21:21 |只看该作者
squid.conf应该没什么问题,你没做任何限制
iptables试试以下脚本:

  1. #! /bin/bash

  2. for table in filter nat mangle
  3. do
  4.     iptables -F $table
  5.     iptables -X $table
  6. done

  7. iptables -P INPUT ACCEPT
  8. iptables -P FORWARD ACCEPT
  9. iptables -P OUTPUT ACCEPT
  10. iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
  11. iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT

  12. echo "1" > /proc/sys/net/ipv4/ip_forward
  13. iptables -t nat -A PREROUTING -s 192.168.0.200/32 -p tcp --dport 80 -j REDIRECT 3128
  14. iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth1 -j MASQUERADE

复制代码

论坛徽章:
0
3 [报告]
发表于 2005-12-03 00:14 |只看该作者
那天,既然 INPUT 和 FORWARD 的默认规则都是 ACCPET,就没必要再写那两个 state 的规则了

论坛徽章:
0
4 [报告]
发表于 2005-12-03 10:39 |只看该作者
也是,写不写都无所谓了。
我是从我的脚本上直接复制过来的,为了方便,把INPUT 和 FORWARD 都ACCEPT了。

论坛徽章:
0
5 [报告]
发表于 2007-05-20 16:39 |只看该作者
个人觉得,为了安全还是应该将默认规则置为 DROP 好些,最起码 INPUT 就要用 DROP
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP