- 论坛徽章:
- 0
|
http://bbs.chinaunix.net/thread-1044580-1-1.html
按照这个做好像还是有问题,不能实现。
解决方法:
在squid.conf 加入下面代码
[Copy to clipboard] [ - ]
CODE:
redirect_program /etc/pftable/red.pl
redirect_children 10
redirector_bypass on
/etc/pftable/red.pl 内容如下
[Copy to clipboard] [ - ]
CODE:
#!/usr/bin/perl -wl
#
use strict;
use DB_File;
$|=1;
use vars qw(%ip $uri);
my $db=tie %ip,"DB_File","/tmp/ip.db",O_CREAT|O_RDWR,0666;
while (<>){
my ($client,$ident,$method)=();
($uri,$client,$ident,$method)=split;
if (exists $ip{$client}){
next;
}else{
$ip{$client}=1;
$db->sync;
$uri="301:http://www.163.cn";
}
}continue{
print "$uri";
}
untie %ip; |
|