站内留言 会员登陆 会员注册 站长推荐: 文字广告
站内搜索: 您的位置素材在线 > 互联网络 > 技术学院 > 服 务 器 > Fressbsd > 新闻内容

FreeBSD拨号网关的建立下

2008-8-28 18:11:00  来源:顶酷手机网  作者:本站整理 【 查看评论

    以下原因之一:

  磁盘上没有空间了。

  (对此我无能为力)

  没有建立/usr/local/squid/logs/目录。

  (手工建一个嘛)

  您的/usr/local/squid/logs/cache.log文件属于root。

  (可以用这条命令“chown nobody.nogroup /usr/local/squid/logs/cache.log”改一下,另外../log和../cache目录里的所有文件都要有此属性。)

  于是我查了一下这些目录中的文件,的确都属于root,所以我用了这两条命令:

  # chown nobody.nogroup /usr/local/squid/logs

  # chown nobody.nogroup /usr/local/squid/cache

  然后再试一下建立Cache目录:

  # /usr/local/sbin/squid -z

  2001/01/01 09:14:32| Creating Swap Directories

  这次运行顺利!

  测试

  在IE的选项->连接选项卡中设好代理服务器的地址和端口(3128),接着用squid的调试/测试模式进行试运行:

  # /usr/local/sbin/squid -NCd1

  09:30:54| Starting Squid Cache version 2.1 for i386--freebsd3.2...

  09:30:54| Process ID 1026

  09:30:54| With 1064 file descriptors available

  09:30:54| Performing DNS Tests...

  09:30:54| Successful DNS name lookup tests...

  09:30:54| helperOpenServers: Starting 5 'dnsserver' processes

  09:30:54| Unlinkd pipe opened on FD 13

  09:30:54| Swap maxSize 102400 KB, estimated 7876 objects

  09:30:54| Target number of buckets: 157

  09:30:54| Using 8192 Store buckets, replacement runs every 10 seconds

  09:30:54| Max Mem size: 8192 KB
09:30:54| Max Swap size: 102400 KB

  09:30:54| Rebuilding storage in Cache Dir #0 (DIRTY)

  09:30:54| Loaded Icons.

  09:30:54| Accepting HTTP connections on port 3128, FD 35.

  09:30:54| Accepting ICP messages on port 3130, FD 36.

  09:30:54| Ready to serve requests.

  09:30:54| storeRebuildFromDirectory: DIR #0 done!

  09:32:10| Finished rebuilding storage disk.

  09:32:10| 0 Entries read from previous logfile.

  09:32:10| 0 Entries scanned from swap files.

  09:32:10| 0 Invalid entries.

  09:32:10| 0 With invalid flags.

  09:32:10| 0 Objects loaded.

  09:32:10| 0 Objects expired.

  09:32:10| 0 Objects cancelled.

  09:32:10| 0 Duplicate URLs purged.

  09:32:10| 0 Swapfile clashes avoided.

  09:32:10| Took 76 seconds ( 0.0 objects/sec).

  09:32:10| Beginning Validation Procedure

  09:32:10| storeLateRelease: released 0 objects

  09:32:11| Completed Validation Procedure

  09:32:11| Validated 0 Entries

  09:32:11| store_swap_size = 21k

  09:32:31| parseHttpRequest: Unsupported method 'PROPFIND'

  09:32:31| clientReadRequest: FD 14 Invalid Request

  (用Ctl+C中止squid)

  09:33:44| Preparing for shutdown after 8 requests

  09:33:44| Waiting 0 seconds for active connections to finish

  09:33:44| FD 35 Closing HTTP connection

  09:33:45| Shutting down...

  09:33:45| FD 36 Closing ICP connection
09:33:45| Closing unlinkd pipe on FD 13

  09:33:45| storeDirWriteCleanLogs: Starting...

  09:33:45| Finished. Wrote 0 entries.

  09:33:45| Took 0 seconds ( 0.0 entries/sec).

  对/usr/local/etc/squid/squid.conf文件进行修改以允许适当的主机使用代理服务,为此加入以下三条:

  acl ourhosts src 192.168.0.0/255.255.255.0 #定义可以使用代理服务的主机地址范围及组名

  http_access allow ourhosts #允许此组访问http

  http_access deny all #禁止其它所有主机访问http

  重新启动squid,并用IE进行测试,结果很顺利:

  # /usr/local/sbin/squid -NCd1

  最后检查一下/usr/local/etc/rc.d目录中是否有它的启动脚本squid.sh,如没有可参照以下内容建一个:

  #!/bin/sh

  if [ -x /usr/local/sbin/RunCache -a -f /usr/local/etc/squid/squid.conf ]; then

  (cd /tmp; /usr/local/sbin/RunCache >/dev/null 2>&1 &) ; echo -n ' squid'

  fi

  防止用户绕过代理服务器

  好了,现在已经初步架好了squid(该服务器软件有非常之多的配置选项,可根据需要修改/usr/local/etc/squid/s quid.conf配置文件),紧接着的问题就是如何让用户只能通过代理服务器访问互联网,而不能绕过它,也就是说要阻塞端口80。为此可以在系统的防火墙规则中加入一些内容,假定ed0是网卡设备,规则添加如下:

  #/sbin/ipfw add 200 deny tcp from any to any 80 via ed0

  #/sbin/ipfw add 300 deny udp from any to any 80 via ed0

  当然,可以将这些规则放入系统的启动文件中,FreeBSD已经具有载入过滤规则的相应文件/etc/rc.firewall,要使用它只要在/etc/rc.conf文件中设置以下参
 firewall_enable=YES

  firewall_type="UNKNOWN"

  这时,除了把它们添加到已有的规则模板以适应少量修改之外,还可以把它们与其它一些您自定义的规则放入一个外部文件中,然后把firewall_type的值(默认的/etc/rc.firewall文件已定义了几种类型可作为此参数的值)改为此文件的全路径名,这样系统就会在启动时用ipfw自动执行这些规则。

  代收邮件

  通过安装并配置Fetchmail和Qpopper这两个软件可以为局域网中其它用户代收他们的外部电子邮件:

  #pkg_add qpopper-2.53.tgz

  #pkg_add fetchmail-5.2.0.tgz

  修改/etc/inetd.conf,去掉下面这条行首的#号:

  pop3 stream tcp nowait root /usr/local/libexec/popper popper

  然后用以下方法重启inetd以提供pop3服务:

  #ps -acx | grep inetd

  165 ? I 0.12 inetd

  #kill -HUP 165

  用户级PPP包含一个/etc/ppp/ppp.linkup这样的文件,用于在拨号成功之后运行一行东东,就象自动批处理文件一样,现在向这个文件中加入下面的内容:

  163:

  !bg sh -c "fetchmail -f /root/.fetchmailrc"

  这样就会在PPP拨号连接后自动后台运行Fetchmail收信了,至

[1] [2]  下一页

文字链接广告
(评论内容只代表网友观点,与本站立场无关!)[ 全部评论 ]

网友评论:

    用户名:

    评   分:100分 85分 70分 55分 40分 25分 10分 0分

    内 容:

                 (注“”为必填内容。) 验证码: 验证码,看不清楚?请点击刷新验证码

关于本站 - 网站帮助 - 广告服务 - 网站地图 - 下载声明 - 友情链接 -