|
|

楼主 |
发表于 2006-8-2 15:07:49
|
显示全部楼层
这是我修改后的配置(主要是对iptables改动了,squid除了加上一个内网的定义,其他基本没动)
安装FC4,安装为服务器模式 选择软件包的时候把gnome squid打勾
安装配置网卡时防火墙时选择不使用,然后进入图形界面配置外网卡的ip,gateway还有dns以及内网ip地址,在终端下setup启用iptables
以下是我的具体步骤:
eth0外网固定ip 1.2.3.4 eth1 192.168.0.1/22
设置squid.conf
(其中其它默认的项目用#标没有改动)
http_port 192.168.1.201:3128
cache_mem 64 MB
cache_swap_low 85
cache_swap_high 90
maximum_object_size 8192 KB
maximum_object_size_in_memory 4096 KB
cache_dir ufs /var/squid/cache 20000 16 256
#限制bt下载的种子以及连接数
acl pass src 192.168.0.1-192.168.3.254/22
acl localhost src 127.0.0.1/255.255.255.255
acl btbt urlpath_regex \.torrent$
acl conncount maxconn 3
acl all src 0.0.0.0/0
http_access deny btbt
http_access allow localhost
http_access allow pass
http_access deny all
httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_user_host_header on
iptables的firewall脚本:
#!/bin/sh
echo "Enable IP Forwarding...."
echo "1">/proc/sys/net/ipv4/ip_forward
echo "Starting iptables rules..."
/sbin/modprobe iptable_filter
/sbin/modprobe ip_tables
/sbin/modprobe iptable_nat
#Refresh all chains
/sbin/iptables -F -t nat
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -o eth0 -s 192.168.0.0/22 -j ACCEPT
iptables -t nat -A PREROUTING -i eth1 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3128
iptables -t nat -A POSTROUTING -s 192.168.0.0/22 -o eth0 -j SNAT --to 1.2.3.4
rc.local的最后一行添加上了/etc/rc.d/firewall |
|