Linux 版 (精华区)

发信人: AA (生活多么美好), 信区: Linux
标  题: [合集]# 请教斑竹: 我的IpTables + Squid 除了什么毛病 ?
发信站: 哈工大紫丁香 (2002年12月24日19:57:57 星期二), 站内信件


────────────────────────────────────────
 ACDSee (Version 4)                   于 2002年09月14日16:10:38 星期六 说道:

我有一个很实际的原因要使用IpTables + Squid做透明的防火墙,
Squid只提供代理http服务. 在一台客户机上使用时, 发现根本登
录不上去任何网站. 请问是哪里出了问题?
我的Linux: Rh7.3
# #########################
# Firewall:
# #########################
#=====  Complete stateful firewall script. Maintained by Li Guangzhe
#!/bin/bash
#=====  Some varities
UPLINK="eth0"
UPIP="a.b.c.d"
NAT="a.b.c.d"
INTERFACES="lo eth0 eth1"
SERVICES="http ftp smtp telnet"
#=====  Display information that we start the firewall service
echo "Starting firewall..."
#=====  Refresh all chains
/sbin/iptables -F
/sbin/iptables -F -t nat
#=====  Refuse Access From Internet
#iptables -P INPUT DROP
#iptables -A INPUT -i ! ${UPLINK} -j ACCEPT
#iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
#=====  Enable some services that comes from outside
for x in ${SERVICES}
do
/sbin/iptables -A INPUT -p tcp --dport ${x} -m state --state NEW -j ACCEPT
done
#=====  If there are some attackers, cheat them
/sbin/iptables -A INPUT -p tcp -i ${UPLINK} -j REJECT --reject-with tcp-rese
t
/sbin/iptables -A INPUT -p udp -i ${UPLINK} -j REJECT --reject-with icmp-por
t-un
#=====  Explicitly disable ECN
if [ -e /proc/sys/net/ipv4/tcp_ecn ]
then
echo 0 > /proc/sys/net/ipv4/tcp_ecn
fi
#=====  Disable spoofing on all interfaces
for x in ${INTERFACES}
do
echo 1 > /proc/sys/net/ipv4/conf/${x}/rp_filter
done
#=====  Load Necessary Module
echo 1 > /proc/sys/net/ipv4/ip_forward
/sbin/modprobe ip_tables
/sbin/modprobe ip_nat_ftp
/sbin/modprobe ip_conntrack_ftp
/sbin/iptables -t nat -A POSTROUTING -o ${UPLINK} -j SNAT --to ${UPIP}
#=====  Enbale LAN access The Internet
/sbin/iptables -A FORWARD -s 192.168.0.0/24 -j ACCEPT
/sbin/iptables -t nat -A POSTROUTING -o eth0 -s 192.168.0.0/24 -j MASQUERADE
#=====  Use Squid Proxy Offer HTTP Service, Only To 192.168.0.78
/sbin/iptables -t nat -A PREROUTING -p tcp -s 192.168.0.78 --dport 80 -j  DN
AT --to 192.168.0.1:8080
#=====  Tell Firewall builded
echo    "Firewall established successfully!"
# #########################
# squid.conf:
# #########################
visible_hostname mpc
http_port 8080
cache_mem 32 MB
cache_swap_low 90
cache_swap_high 95
maximum_object_size 4096 KB
cache_dir ufs /var/cache/squid 100 16 256
cache_access_log /var/log/squid/access.log
cache_log /var/log/squid/cache.log
cache_store_log /var/log/squid/store.log
#cache_dns_program /usr/lib/squid/dnsserver
#dns_nameservers 192.168.0.1
dns_nameservers 202.118.224.101
unlinkd_program /usr/lib/squid/unlinkd
acl all src 0.0.0.0/0.0.0.0
acl allow_ip src 192.168.0.0/24
acl manager proto cache_object
acl localhost src 192.168.0.1/255.255.255.255
acl SSL_ports port 443 563
acl Safe_ports port 80 21 443 563 70 210 1025-65535
acl CONNECT method CONNECT
http_access allow allow_ip
httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on
httpd_accel_single_host off

────────────────────────────────────────
 peer (保护好胸口的那根肋骨)          于 2002年09月14日16:29:59 星期六 说道:

    你先让iptables可以做透明网关,然后再逐步加入各种防火墙规则
【 在 ACDSee (Version 4) 的大作中提到: 】
: 我有一个很实际的原因要使用IpTables + Squid做透明的防火墙,
: Squid只提供代理http服务. 在一台客户机上使用时, 发现根本登
: 录不上去任何网站. 请问是哪里出了问题?
: 我的Linux: Rh7.3
: # #########################
: # Firewall:
: # #########################
: #=====  Complete stateful firewall script. Maintained by Li Guangzhe
: #!/bin/bash
: #=====  Some varities

────────────────────────────────────────
 vtah (kYLiX)                         于 2002年09月14日16:46:57 星期六 说道:

做透明防火墙
前者足够
后者多余
还费资源
【 在 ACDSee (Version 4) 的大作中提到: 】
: 我有一个很实际的原因要使用IpTables + Squid做透明的防火墙,
: Squid只提供代理http服务. 在一台客户机上使用时, 发现根本登
: 录不上去任何网站. 请问是哪里出了问题?
: 我的Linux: Rh7.3
: # #########################
: # Firewall:
: # #########################
: #=====  Complete stateful firewall script. Maintained by Li Guangzhe
: #!/bin/bash
: #=====  Some varities

────────────────────────────────────────
 peer (保护好胸口的那根肋骨)          于 2002年09月14日16:58:04 星期六 说道:

    iptables肯定可以胜任了。不过,squid也有它专门的特色,比如cache管理
就不知道对他们有没有意义了,呵呵
【 在 vtah (kYLiX) 的大作中提到: 】
: 做透明防火墙
: 前者足够
: 后者多余
: 还费资源
: 【 在 ACDSee (Version 4) 的大作中提到: 】
: : 我有一个很实际的原因要使用IpTables + Squid做透明的防火墙,
: : Squid只提供代理http服务. 在一台客户机上使用时, 发现根本登
: : 录不上去任何网站. 请问是哪里出了问题?
: : 我的Linux: Rh7.3
: : # #########################
: : # Firewall:

────────────────────────────────────────
 emacs (digging in the hole)          于 2002年09月14日18:01:06 星期六 说道:

94
一定要用squid吗?
【 在 vtah (kYLiX) 的大作中提到: 】
: 做透明防火墙
: 前者足够
: 后者多余
: 还费资源
: 【 在 ACDSee (Version 4) 的大作中提到: 】
: : 我有一个很实际的原因要使用IpTables + Squid做透明的防火墙,
: : Squid只提供代理http服务. 在一台客户机上使用时, 发现根本登
: : 录不上去任何网站. 请问是哪里出了问题?
: : 我的Linux: Rh7.3
: : # #########################
: : # Firewall:

────────────────────────────────────────
 ACDSee (Version 4)                   于 2002年09月15日10:24:58 星期天 说道:

以前: 我们一直在用ipchains/iptables做包过滤的防火墙, 速度很快/很稳定
但是: 老板每次只交200大洋的网费, 每次网费超过100元就......  0_0
网费: 国内的费用全是Zero, 所有的费用显示都是国外的, 但我已经和实验室的
      人员反复重申不要上国外的网站, 而且大家也很自觉. 但网费......
老板: 把上网的情况记录下来!
我Wm: 要让防火墙实现日志纪录功能.
方案: 1. iptables -j LOG
         每秒钟只纪录一个包的话, 数据量都会很大, 不太可行 :(
      2. iptables + squid
         让iptables把80的包转发给squid, sq只提供提供http服务
         这样, squid就可以做缓存和日志了.
      3. iptables + string补丁
         让iptables更具字符串根据包的一些信息纪录到日志中, 减少数据量
另外, 服务器的配置:     ( 如有雷同, 纯属巧合 )
CPU: AMD 133
MEM: 64M
HD : 6.4G
OS : RH7.3
【 在 emacs (digging in the hole) 的大作中提到: 】
: 94
: 一定要用squid吗?
: 【 在 vtah (kYLiX) 的大作中提到: 】
: : 做透明防火墙
: : 前者足够
: : 后者多余
: : 还费资源

────────────────────────────────────────
 emacs (digging in the hole)          于 2002年09月15日10:51:10 星期天 说道:

你只要在防火墙上限制一下,不让访问非免费的ip不就不会产生网费了吗?
iptables的日志也足够用了吧。如果限制了非免费的ip不就不用记录日志了吗。
呵呵,如果你需要设置限制的访问的iptables脚本,我这里还有,前几天刚刚完成的。
【 在 ACDSee (Version 4) 的大作中提到: 】
: 以前: 我们一直在用ipchains/iptables做包过滤的防火墙, 速度很快/很稳定
: 但是: 老板每次只交200大洋的网费, 每次网费超过100元就......  0_0
: 网费: 国内的费用全是Zero, 所有的费用显示都是国外的, 但我已经和实验室的
:       人员反复重申不要上国外的网站, 而且大家也很自觉. 但网费......
: 老板: 把上网的情况记录下来!
: 我Wm: 要让防火墙实现日志纪录功能.
: 方案: 1. iptables -j LOG
:          每秒钟只纪录一个包的话, 数据量都会很大, 不太可行 :(
:       2. iptables + squid
:          让iptables把80的包转发给squid, sq只提供提供http服务
:          这样, squid就可以做缓存和日志了.

────────────────────────────────────────
 vtah (kYLiX)                         于 2002年09月15日11:25:32 星期天 说道:

ipchains/iptables用一个就行
用了这些做限制也不表示就一点收费流量都没有
跟你们老板说明白了,这些流量是不可避免的
一般是一年200元左右。作为老板这么小家子气,就没什么意思了
【 在 ACDSee (Version 4) 的大作中提到: 】
: 以前: 我们一直在用ipchains/iptables做包过滤的防火墙, 速度很快/很稳定
: 但是: 老板每次只交200大洋的网费, 每次网费超过100元就......  0_0
: 网费: 国内的费用全是Zero, 所有的费用显示都是国外的, 但我已经和实验室的
:       人员反复重申不要上国外的网站, 而且大家也很自觉. 但网费......
: 老板: 把上网的情况记录下来!
: 我Wm: 要让防火墙实现日志纪录功能.
: 方案: 1. iptables -j LOG
:          每秒钟只纪录一个包的话, 数据量都会很大, 不太可行 :(
:       2. iptables + squid
:          让iptables把80的包转发给squid, sq只提供提供http服务
:          这样, squid就可以做缓存和日志了.

────────────────────────────────────────
 vtah (kYLiX)                         于 2002年09月15日11:26:08 星期天 说道:

你把你得iptables的脚本贴上来,借我看看谢谢
【 在 emacs (digging in the hole) 的大作中提到: 】
: 你只要在防火墙上限制一下,不让访问非免费的ip不就不会产生网费了吗?
: iptables的日志也足够用了吧。如果限制了非免费的ip不就不用记录日志了吗。
: 呵呵,如果你需要设置限制的访问的iptables脚本,我这里还有,前几天刚刚完成的。
: 【 在 ACDSee (Version 4) 的大作中提到: 】
: : 以前: 我们一直在用ipchains/iptables做包过滤的防火墙, 速度很快/很稳定
: : 但是: 老板每次只交200大洋的网费, 每次网费超过100元就......  0_0
: : 网费: 国内的费用全是Zero, 所有的费用显示都是国外的, 但我已经和实验室的
: :       人员反复重申不要上国外的网站, 而且大家也很自觉. 但网费......
: : 老板: 把上网的情况记录下来!
: : 我Wm: 要让防火墙实现日志纪录功能.

────────────────────────────────────────
 ACDSee (Version 4)                   于 2002年09月15日11:31:29 星期天 说道:

怎么联系?
My E-Mail: IDErngyLee@yahoo.com.cn
3x
【 在 emacs (digging in the hole) 的大作中提到: 】
: 你只要在防火墙上限制一下,不让访问非免费的ip不就不会产生网费了吗?
: iptables的日志也足够用了吧。如果限制了非免费的ip不就不用记录日志了吗。
: 呵呵,如果你需要设置限制的访问的iptables脚本,我这里还有,前几天刚刚完成的。
: 【 在 ACDSee (Version 4) 的大作中提到: 】
: : 以前: 我们一直在用ipchains/iptables做包过滤的防火墙, 速度很快/很稳定
: : 但是: 老板每次只交200大洋的网费, 每次网费超过100元就......  0_0
: : 网费: 国内的费用全是Zero, 所有的费用显示都是国外的, 但我已经和实验室的
: :       人员反复重申不要上国外的网站, 而且大家也很自觉. 但网费......
: : 老板: 把上网的情况记录下来!
: : 我Wm: 要让防火墙实现日志纪录功能.

────────────────────────────────────────
 ACDSee (Version 4)                   于 2002年09月15日11:33:05 星期天 说道:

不过IpTables+Squid很有意思, 我挺想学学, 谁能教教我?
# squid.conf
visible_hostname        mpc
http_port               8080
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_uses_host_header    on
为什么总说: no running copy?
【 在 emacs (digging in the hole) 的大作中提到: 】
: 你只要在防火墙上限制一下,不让访问非免费的ip不就不会产生网费了吗?
: iptables的日志也足够用了吧。如果限制了非免费的ip不就不用记录日志了吗。
: 呵呵,如果你需要设置限制的访问的iptables脚本,我这里还有,前几天刚刚完成的。
: 【 在 ACDSee (Version 4) 的大作中提到: 】
: : 以前: 我们一直在用ipchains/iptables做包过滤的防火墙, 速度很快/很稳定
: : 但是: 老板每次只交200大洋的网费, 每次网费超过100元就......  0_0
: : 网费: 国内的费用全是Zero, 所有的费用显示都是国外的, 但我已经和实验室的
: :       人员反复重申不要上国外的网站, 而且大家也很自觉. 但网费......
: : 老板: 把上网的情况记录下来!
: : 我Wm: 要让防火墙实现日志纪录功能.

────────────────────────────────────────
 emacs (digging in the hole)          于 2002年09月15日14:05:06 星期天 说道:

我只是试着写,不知道安全性有多高,不过限制非免费ip的访问应该有效。
需要两个列表文件,一个是free ip列表(freeiplist),
一个是允许访问本地服务器的ip列表(accessokiplist)。
//我直接贴上的,有的行被bbs自动折行了。
----- freeiplist 格式 -----
24.244.192.0/255.255.240.0
...
218.245.0.0/255.255.0.0
----- accessokiplist 格式 -----
202.118.224.0/255.255.224.0
...
----- rc.firewall -----
#!/bin/bash
# -*- Shell-script -*-
# $Id: rc.firewall,v 1.18 2002/09/08 09:24:40 spr Exp $ 
#
# Iptables netfilter and nat script by Chunyu <dddkk@sina.com>
# This script is for my lab serverb(???.hit.edu.cn). Because this
# server is the gateway of our internal LAN througe CERNET(edu.cn),
# our server only can free access parts of the Internet (free IPs are
# listed in www.nic.edu.cn).
# This file needs two extra files: 
#     1) Free IP List file, host can only access these network.
#        Its format as the following('Network/Mask' each line):
#          $cat freeiplist
#          24.244.192.0/255.255.240.0
#          47.153.128.0/255.255.192.0
#          .....
#          218.245.0.0/255.255.0.0
#          219.216.0.0/255.254.0.0
#     2) Accessed IP List file, host can be accessed by these network. 
#        Its format is the same:
#          $cat accessiplist
#          202.118.0.0/255.255.0.0
#          ...
# internal network eth0 192.168.1.1
# external network eth1 202.118.my.ip
IPTABLES=/sbin/iptables
MODPROBE=/sbin/modprobe
PERL=/usr/bin/perl
ExtIp=202.118.my.ip
IntIp=192.168.1.1
LocalAddr=192.168.1.0/24
EXT=eth1
INT=eth0
AcesIPList=/root/accessokiplist
FreeIpList=/root/freeiplist
IPTABLES_CONFIG=/root/iptables-config
start () {
    if ! [ -f $AcesIPList ] || ! [ -f $FreeIpList ]; then
    echo Not Found necessory files: $AcesIPList and/or $FreeIpList
    echo iptables firewall not be set!
    exit 1
    fi
# Load modules for iptables (netfilter, nat, etc.)
    Modules="ip_tables ip_nat_ftp ip_conntrack_ftp"
    echo "load iptables modules: $Modules"
    for i in $Modules ; do
    $MODPROBE $i
    done
    echo "flush standard tables: default nat mangle"
    $IPTABLES -F 
    $IPTABLES -F -t nat
    $IPTABLES -F -t mangle
    echo "builtin chains policy: default nat mangle"
    $IPTABLES -P INPUT   DROP
    $IPTABLES -P OUTPUT  DROP
    $IPTABLES -P FORWARD DROP
    $IPTABLES -t nat    -P POSTROUTING DROP
    $IPTABLES -t nat    -P PREROUTING  DROP
    $IPTABLES -t nat    -P OUTPUT      ACCEPT
    $IPTABLES -t mangle -P PREROUTING  ACCEPT
    $IPTABLES -t mangle -P OUTPUT      ACCEPT
    CHAINS=`$IPTABLES -n -L |$PERL -n -e '/Chain\s+(\S+)/ && !($1 =~
/^(INPUT|FORWARD|OUTPUT)$/) && print "$1 "'`
    echo "remove defined chains: $CHAINS"
    for c in $CHAINS; do
    iptables -F $c
    done
# 2nd step cause of dependencies
    for c in $CHAINS; do
    iptables -X $c
    done
######   new chain freeip     #############
#   A new chain for free ip list  in file $FreeIpList('Network/Mask' each 
line)
    $IPTABLES -N freeip
    FreeIPMaskList=`cat $FreeIpList | grep -e "^[[:space:]]*\
\(\([0-9]\{1,3\}\)\.\)\{3\}\([0-9]\{1,3\}\)/\
\(\(\([0-9]\{1,3\}\)\.\)\{3\}\([0-9]\{1,3\}\)\|[0-9]\{1,2\}\)\
[[:space:]]*$"`
    for i in $FreeIPMaskList ; do
    $IPTABLES -A freeip -d $i  -j ACCEPT
    done
######   new chain accessok   #############
#   A new chain for ip list than can access our host.
    $IPTABLES -N accessok
    AcesIPMaskList=`cat $AcesIPList | grep -e "^[[:space:]]*\
\(\([0-9]\{1,3\}\)\.\)\{3\}\([0-9]\{1,3\}\)/\
\(\(\([0-9]\{1,3\}\)\.\)\{3\}\([0-9]\{1,3\}\)\|[0-9]\{1,2\}\)\
[[:space:]]*$"`
    for i in $AcesIPMaskList; do
    $IPTABLES -A accessok -s $i -j ACCEPT
    echo "  service available for $i"
    done
    echo "set filter rules for INPUT OUTPUT FORWARD"
######   INPUT  chain         #############
    $IPTABLES -A INPUT -i lo   -j ACCEPT
    $IPTABLES -A INPUT -i $INT -j ACCEPT
    $IPTABLES -A INPUT -i $EXT -m state --state ESTABLISHED,RELATED -j 
ACCEPT
    $IPTABLES -A INPUT -i $EXT -m state --state NEW -j accessok
######   OUTPUT   chain       #############
    $IPTABLES -A OUTPUT -o lo   -j ACCEPT
    $IPTABLES -A OUTPUT -o $INT -j ACCEPT
    $IPTABLES -A OUTPUT -o $EXT -j freeip
######   FORWARD    chain     #############
    echo 1 > /proc/sys/net/ipv4/ip_forward
    $IPTABLES -A FORWARD -i $INT -s $LocalAddr -j freeip
    $IPTABLES -A FORWARD -i $EXT -m state --state ESTABLISHED,RELATED -j 
ACCEPT
    $IPTABLES -A FORWARD -i $EXT -m state --state NEW -j accessok
    echo "set nat rules for POSTROUTING PREROUTING OUTPUT"
######   nat POSTROUTING      #############
    $IPTABLES -t nat -A POSTROUTING -s $ExtIp     -j ACCEPT
    $IPTABLES -t nat -A POSTROUTING -s $IntIp     -j ACCEPT
    $IPTABLES -t nat -A POSTROUTING -s 127.0.0.1  -j ACCEPT
    $IPTABLES -t nat -A POSTROUTING -s $LocalAddr -o $EXT -j SNAT --to 
$ExtIp
######   nat PREROUTING       #############
    $IPTABLES -t nat -A PREROUTING -i $INT -s $LocalAddr -j ACCEPT
    $IPTABLES -t nat -A PREROUTING -i $EXT -d $ExtIp     -j ACCEPT
    $IPTABLES -t nat -A PREROUTING -i lo -j ACCEPT
######   nat OUTPUT           #############
# nothing.
    touch /var/lock/subsys/iptables
    echo "iptables firewall setup finished."
}
case "$1" in
    start)
    start
    ;;
    stop)
    /etc/rc.d/init.d/iptables stop
    ;;
    restart)
        start
        ;;
    status)
    echo $"Table: filter"
    $IPTABLES --list -n
    echo $"Table: nat"
    $IPTABLES -t nat --list -n
    echo $"Table: mangle"
    $IPTABLES -t mangle --list -n
    ;;
    panic)
    /etc/rc.d/init.d/iptables panic
        ;;
    save)
    echo -n $"Saving current rules to $IPTABLES_CONFIG. "
    touch $IPTABLES_CONFIG
    chmod 600 $IPTABLES_CONFIG
    echo "# -*- iptables-save -*- " > $IPTABLES_CONFIG
    /sbin/iptables-save -c >> $IPTABLES_CONFIG
    echo
    ;;
    *)
    echo $"Usage: $0 {start|stop|restart|status|panic|save}"
    exit 1
esac
exit 0

────────────────────────────────────────
 emacs (digging in the hole)          于 2002年09月15日14:06:15 星期天 说道:

站内信件,或者干脆这里多好:)
【 在 ACDSee (Version 4) 的大作中提到: 】
: 怎么联系?
: My E-Mail: IDErngyLee@yahoo.com.cn
: 3x
: 【 在 emacs (digging in the hole) 的大作中提到: 】
: : 你只要在防火墙上限制一下,不让访问非免费的ip不就不会产生网费了吗?
: : iptables的日志也足够用了吧。如果限制了非免费的ip不就不用记录日志了吗。
: : 呵呵,如果你需要设置限制的访问的iptables脚本,我这里还有,前几天刚刚完成的。

────────────────────────────────────────
 ACDSee (Version 4)                   于 2002年09月15日14:14:28 星期天 说道:

回去慢慢研究 -_-o
【 在 emacs (digging in the hole) 的大作中提到: 】
: 我只是试着写,不知道安全性有多高,不过限制非免费ip的访问应该有效。
: 需要两个列表文件,一个是free ip列表(freeiplist),
: 一个是允许访问本地服务器的ip列表(accessokiplist)。
: //我直接贴上的,有的行被bbs自动折行了。
: ----- freeiplist 格式 -----
: 24.244.192.0/255.255.240.0
: ...
: 218.245.0.0/255.255.0.0
: ----- accessokiplist 格式 -----
: 202.118.224.0/255.255.224.0

────────────────────────────────────────
 ACDSee (Version 4)                   于 2002年09月15日14:15:12 星期天 说道:

服务器: 192.168.0.1 & RH7.3
# firewall
#加上这一句, 我的客户机是192.168.0.78
/sbin/iptables -t nat -A PREROUTING -p tcp -s 192.168.0.78 --dport 80
-j DNAT --to 192.168.0.1:8080
# squid.conf
visible_hostname        mpc.hit.edu.cn
http_port               8080
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_uses_host_header    on
结果是:
[root@mpc lgz]# /etc/init.d/squid start
Starting squid:                                            [  OK  ]
[root@mpc lgz]# /etc/init.d/squid status
squid (pid 3369 3345) is running...
squid: ERROR: No running copy
为什么总说: no running copy?
【 在 ACDSee (Version 4) 的大作中提到: 】
: 不过IpTables+Squid很有意思, 我挺想学学, 谁能教教我?
: # squid.conf
: visible_hostname        mpc
: http_port               8080
: 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_uses_host_header    on

────────────────────────────────────────
 emacs (digging in the hole)          于 2002年09月15日14:25:35 星期天 说道:

【 在 ACDSee (Version 4) 的大作中提到: 】
: 服务器: 192.168.0.1 & RH7.3
: # firewall
: #加上这一句, 我的客户机是192.168.0.78
: /sbin/iptables -t nat -A PREROUTING -p tcp -s 192.168.0.78 --dport 80
: -j DNAT --to 192.168.0.1:8080
这句是做什么用的?
: # squid.conf
squid的conf就这么几行?我怎么觉着有好多呢。我配置了一下,只配置了http代理
就好多行。
btw squid 基本不会。

────────────────────────────────────────
 ACDSee (Version 4)                   于 2002年09月15日15:02:42 星期天 说道:

【 在 ACDSee (Version 4) 的大作中提到: 】
: 服务器: 192.168.0.1 & RH7.3
: # firewall
: #加上这一句, 我的客户机是192.168.0.78
: /sbin/iptables -t nat -A PREROUTING -p tcp -s 192.168.0.78 --dport 80
: -j DNAT --to 192.168.0.1:8080
: # squid.conf
: visible_hostname        mpc.hit.edu.cn
: http_port               8080
dns_nameservers 202.118.224.101 #加了这句之后, 就好用了: 不
#再出现"no running copy"了
但客户机还上不了http
: acl     all     src     192.168.0.0/24

────────────────────────────────────────
 ACDSee (Version 4)                   于 2002年09月15日15:27:57 星期天 说道:

我想问题应该出在
dns_nameservers上
有这句, 就不会出现"No running copy"
注释掉这句, 马上就会出现"No running copy"
不管有没有, 客户机都上不去
【 在 ACDSee (Version 4) 的大作中提到: 】
: 不过IpTables+Squid很有意思, 我挺想学学, 谁能教教我?
: # squid.conf
: visible_hostname        mpc
: http_port               8080
: 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_uses_host_header    on

────────────────────────────────────────
 ACDSee (Version 4)                   于 2002年09月15日18:07:51 星期天 说道:

哪位高人用的是Iptables+Squid?
麻烦请帖一份完整的 firewall & squid.conf!
谢谢! bow!
【 在 ACDSee (Version 4) 的大作中提到: 】
: 我想问题应该出在
: dns_nameservers上
: 有这句, 就不会出现"No running copy"
: 注释掉这句, 马上就会出现"No running copy"
: 不管有没有, 客户机都上不去
: 【 在 ACDSee (Version 4) 的大作中提到: 】
: : 不过IpTables+Squid很有意思, 我挺想学学, 谁能教教我?
: : # squid.conf
: : visible_hostname        mpc
: : http_port               8080

────────────────────────────────────────
 ACDSee (Version 4)                   于 2002年09月15日18:10:47 星期天 说道:

举个例子:
The requested URL could not be retrieved
----------------------------------------------------------------------------
While trying to retrieve the URL: http://xinglight.8u8.com/mtv/mtvshangxi.ht
m
The following error was encountered:
Unable to determine IP address from host name for xinglight.8u8.com
The dnsserver returned:
No DNS records
This means that:
 The cache was not able to resolve the hostname presented in the URL.
 Check if the address is correct.
Your cache administrator is root.
----------------------------------------------------------------------------
Generated Sun, 15 Sep 2002 10:14:27 GMT by mpc.hit.edu.cn (Squid/2.4.STABLE6
)
【 在 ACDSee (Version 4) 的大作中提到: 】
: 我想问题应该出在
: dns_nameservers上
: 有这句, 就不会出现"No running copy"
: 注释掉这句, 马上就会出现"No running copy"
: 不管有没有, 客户机都上不去
: 【 在 ACDSee (Version 4) 的大作中提到: 】
: : 不过IpTables+Squid很有意思, 我挺想学学, 谁能教教我?
: : # squid.conf
: : visible_hostname        mpc
: : http_port               8080

────────────────────────────────────────
 ACDSee (Version 4)                   于 2002年09月17日12:47:35 星期二 说道:

我的IpTables和Squid终于可以联合工作了. 以前我的firewall中的一些代码干扰了
Squid正常工作, 去掉就好用了.
贴出来供大家参考, 其实很多东西我也不是很清楚, 只管能用就行.
呵呵, 让高手见笑了 -_-o
##### *firewall
#=====  Complete stateful firewall script. Maintained by Li Guangzhe
#!/bin/bash
#=====  Some varities
UPLINK="eth0"
UPIP="202.118.228.MyIp"
NAT="202.118.228.MyIp"
INTERFACES="lo eth0 eth1"
#=====  Display information that we start the firewall service
echo "Starting firewall..."
#=====  Refresh all chains
/sbin/iptables -F
#=====  Explicitly disable ECN
if [ -e /proc/sys/net/ipv4/tcp_ecn ]
then
echo 0 > /proc/sys/net/ipv4/tcp_ecn
fi
#=====  Disable spoofing on all interfaces
for x in ${INTERFACES}
do
echo 1 > /proc/sys/net/ipv4/conf/${x}/rp_filter
done
#=====  Load Necessary Module
echo 1 > /proc/sys/net/ipv4/ip_forward
/sbin/modprobe ip_tables
/sbin/modprobe ip_nat_ftp
/sbin/modprobe ip_conntrack_ftp
/sbin/iptables -t nat -A POSTROUTING -o ${UPLINK} -j SNAT --to ${UPIP}
#=====  Use Squid Proxy HTTP Service
/sbin/iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to
192.168.0.1:8080
#=====  Tell Firewall builded
echo    "Firewall established successfully!"
##### Squid.conf
visible_hostname MyDomainName.hit.edu.cn
http_port 8080
dns_nameservers 202.118.224.101
cache_effective_user    squid   squid
cache_effective_group   squid
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_uses_host_header on

────────────────────────────────────────
 vtah (kYLiX)                         于 2002年09月17日16:03:12 星期二 说道:

固执的家伙
【 在 ACDSee (Version 4) 的大作中提到: 】
: 我的IpTables和Squid终于可以联合工作了. 以前我的firewall中的一些代码干扰了
: Squid正常工作, 去掉就好用了.
: 贴出来供大家参考, 其实很多东西我也不是很清楚, 只管能用就行.
: 呵呵, 让高手见笑了 -_-o
: ##### *firewall
: #=====  Complete stateful firewall script. Maintained by Li Guangzhe

────────────────────────────────────────
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:212.204毫秒