4 November: The FreeBSD 7.0 release process proceeds and as a consequence the 7.0-BETA2 ISO images for Tier-1 architectures are now available for download on most FreeBSD mirror sites. We ask our users to report any outstanding bugs, as this will presumably be the last BETA release before the first RC release.
Archive for the 'FreeBSD' Category
Page 2 of 3
二级上网代理服务器,用的很少,不过有时你想控制局域网中一小部分的机器的上网,就用的上。前两天架设了一台二级代理,写个笔记。
如下图, 一级和二级代理服务器都使用FreeBSD6.2Release+Squid2.6,一级代理直接和外网线路连接,用户通过设置相应的网段IP和代理服务器(IE上设置)进行上网。一级代理服务器后面的交换上的用户直接设置21段的IP再加上在IE上设置192.168.21.254及端口3128进行上网;二级代理后面的用户就要设置11段的IP加上192.168.11.254及端口3128进行上网。

============================================
一、一级代理服务器的架设
说明:
操作系统:FreeBSD6.2Release
代理软件:Squid2.6STABLE16
外网卡:em0 -> 218.90.159.xxx (默认网关为上一级ISP提供)
内网卡:em1 -> 192.168.21.254
1、FreeBSD的安装及优化
(1)最小化安装FreeBSD6.2RELEASE
(2)配置rc.conf
hostname="one.www.com"
defaultrouter="218.90.159.xxx"
ifconfig_em0="inet 218.90.159.xxx netmask 255.255.255.xxx" //外网IP
ifconfig_em1="inet 192.168.21.254 netmask 255.255.255.0" //内网IP
sendmail_enable="NONE"
inetd_enable="YES"
linux_enable="YES"
sshd_enable="YES"
usbd_enable="YES"
(3)配置内核:
newproxy# cd /usr/src/sys/i386/conf
newproxy# cp GENERIC funpower
newproxy# ee funpower
修改内核配置文件,将不需要的选项(如网卡)之类的前面打#,然后按esc并按a保存退出,再执行:
newproxy# /usr/sbin/config funpower
newproxy# cd ../compile/funpower
newproxy# make cleandepend
newproxy# make depend
newproxy# make
newproxy# make install
2、squid的安装
(1)安装perl
newproxy# cd /usr/ports/lang/perl5
newproxy# make install
(2)下载并安装squid
从http://www.squid-cache.org/Versions/v2/2.6/下载squid-2.6.STABLE16.tar.gz并通过FTP放置服务器目录中/home/funpower,然后开始解压安装:
newproxy# cd /home/funpower
newproxy# tar zxvf squid-2.6.STABLE16.tar.gz
newproxy# cd squid-2.6.STABLE16
newproxy# ./configure –prefix=/usr/local/squid
newproxy# make
newproxy# make install
(3)配置squid.conf
newproxy# cd /usr/local/squid/etc
newproxy# ee squid.conf
内容如下:
acl web src 192.168.21.0/24
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow web
http_access deny all
icp_access allow all
http_port 3128
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
cache deny QUERY
cache_mem 64 MB
cache_dir ufs /usr/local/squid/cache 7000 16 256
access_log /dev/null
cache_log /dev/null
cache_store_log none
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
cache_mgr webmaster@www.com
cache_effective_user squid
cache_effective_group squid
visible_hostname one.www.com
(4)创建用户及缓存等:
newproxy# pw groupadd squid
newproxy# pw adduser squid -g squid -s /nonexistent
newproxy# mkdir /usr/local/squid/cache
newproxy# chown -R squid /usr/local/squid/cache
newproxy# chgrp -R squid /usr/local/squid/cache
newproxy# chown -R squid /usr/local/squid/var/logs
newproxy# chgrp -R squid /usr/local/squid/var/logs
newproxy# /usr/local/squid/sbin/squid -z
newproxy# cd /usr/local/squid/sbin
newproxy# ./squid
newproxy# ee /etc/rc.local
加入如下一行:
/usr/local/squid/sbin/squid
保存退出。
这样一级代理就设置完成,按照下图设置后就能联网络了。

============================================
二、二级代理服务器的架设
下来架设本文的着重点——二级代理,所使用的软件都一样,也是FreeBSD6.2Release+Squid2.6,而且安装FreeBSD的步骤和一级代理的也一样(只有内、外网卡的IP及网关不一样),唯独在配置Squid时配置文件有些不同,具体如下:
说明:
操作系统:FreeBSD6.2Release
代理软件:Squid2.6STABLE16
外网卡:xl0 -> 192.168.21.250 (这里的默认网关就应该是一级代理服务器的内网卡地址,为192.168.21.254)
内网卡:xl1 -> 192.168.11.254
1、安装FreeBSD
安装的具体步骤和上面一级代理的方法一样,只是在配置rc.conf时的IP不一样,如下:
hostname="two.www.com"
defaultrouter="192.168.21.254" //一级代理的内网卡地址
ifconfig_xl0="inet 192.168.21.250 netmask 255.255.255.0" //外网IP
ifconfig_xl1="inet 192.168.11.254 netmask 255.255.255.0" //内网IP
sendmail_enable="NONE"
inetd_enable="YES"
linux_enable="YES"
sshd_enable="YES"
usbd_enable="YES"
2、安装Squid2.6
同样,安装方法和上面一级代理的一样,只是在配置squid的配置文件squid.conf不一样。增加了两行内容,如下:
acl web src 192.168.11.0/24
cache_peer 192.168.21.254 parent 3128 3130 proxy-only //定义父代理(也就是上一级代理)的IP及上网端口3128
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow web
never_direct allow all //所有请求转发至父代理上
http_access deny all
icp_access allow all
http_port 3128
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
cache deny QUERY
cache_mem 64 MB
cache_dir ufs /usr/local/squid/cache 7000 16 256
access_log /dev/null
cache_log /dev/null
cache_store_log none
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
cache_mgr webmaster@www.com
cache_effective_user squid
cache_effective_group squid
visible_hostname two.jscpu.com
这样二级代理也架设完成,按照如下的设置二级代理服务器后的用户应该就也可以上网了。

总结:架设二级代理时,个人感觉最重要的还是要搞清楚一、二级代理四块网卡的IP,至于架设方法,和一级代理没啥区别,最主要的是squid.conf中增加了二行内容 。
by funpower, 2007-10-31 23:42。
发表: delphij
时间: 2007/10/26 06:44:10由于操作失误,本月早些时候发布的7.0-BETA1实际上是一份8.0-CURRENT的快照版本。发布工程租的Ken Smith根据新的RELENG_7发布了7.0-BETA1.5。
1、FreeBSD 6.2-RELEASE支持时间延长四个月
发表: delphij
时间: 2007/10/22 14:16:48近日,FreeBSD安全长官Colin Percival宣布,将FreeBSD 6.2-RELEASE的支持时间延长4个月,即延长至2008年5月31日。此举的主要目的是为了给尚在观望FreeBSD 7.0-RELEASE及6.3-RELEASE的用户留出更多的时间来评估其潜在影响。
根据目前的开发进展情况,FreeBSD 6.3-RELEASE和7.0-RELEASE均会在今年年底发布。
2、FreeBSD 7.0-BETA1测试版本发布,及6.3-BETA1以及发行版发布计划
下载地址:ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/ISO-IMAGES/7.0/
发表: delphij
时间: 2007/10/23 14:39:53FreeBSD发布工程组今天发布了FreeBSD 7.0-BETA1。为了尽可能减少发布过程所需的ports冻结的影响,本次7.0-RELEASE将与6.3-RELEASE采取交叉的发布周期。
目前,我们的计划是将7.0和6.3版本的BETA/RC交叉发布,大致日期如下:
7.0-BETA1、BETA2、RC1、RC2、RELEASE:10月17日、10月31日、11月14日、11月28日、12月12日。
6.3-BETA1、BETA2、RC1、RC2、RELEASE:10月24日、11月7日、11月21日、12月5日、12月19日。明天的RELENG_6将被命名为6.3-PRERELEASE,以体现6.3-RELEASE发布工程周期的开始。
与先前的FreeBSD版本类似,这个日程表只是初步的时间规划。目前,RELENG_6已经十分成熟,因此日期可能会比较准确;而作为新分支的7.0则有很可能会存在延期的现象。
7.0-BETA1版本目前已经可以从一些 FreeBSD 镜像站点下载。您也可以源代码方式升级。关于使用 FreeBSD Update将现有的 FreeBSD 6.x 系统升级至 7.0-BETA1 的方法,将在稍后发表在 freebsd-stable 邮件列表。
说明:最近发现几台squid代理在高负载下的性能不是很好,有时甚至造成网络时断时续,所以这次特意重新架设,在架设过程中注重“优化”,这里当然包括操作系统FreeBSD本身的一些优化和代理软件squid的优化。本文只是初步先将代理架设完成,还没完,我将继续对squid进行优化。另外,这次在安装squid的最新稳定版squid-2.6.STABLE16时,发现配置文件中squid.conf中acl那一段放在了最前面,作者应该是考虑到那是必配项,方面使用者配置:)。
=======================================================
一、FreeBSD的安装及优化
1、最小化安装FreeBSD6.2RELEASE
2、配置内核:
newproxy# cd /usr/src/sys/i386/conf
newproxy# cp GENERIC funpower
newproxy# ee funpower
修改内核配置文件,将不需要的选项(如网卡)之类的前面打#,然后按esc并按a保存退出,再执行:
newproxy# /usr/sbin/config funpower
newproxy# cd ../compile/funpower
newproxy# make cleandepend
newproxy# make depend
newproxy# make
newproxy# make install
3、调整“Mbuf Clusters”
FreeBSD6.2RELEASE默认的Mbuf Clusters的默认值为25600,

将它修改成51200,执行如下:
newproxy# cd /boot/defaults
newproxy# ee loader.conf
找到#kern.ipc.nmbclusters=”",将其改为kern.ipc.nmbclusters=”51200″,注意将前面的#要去掉,保存退出。
4、调整“临时端口”范围
当squid要与另一台服务器建立连接,内核就要分配一个临时端口来建立连接,这些临时端口在FreeBSD6.2RELEASE有一个范围,默认为49152–>65535,显然,对于繁忙的服务器,性能将会受到影响。因为一些TCP连接会被它们关闭并进入TIME_WAIT状态,而且当这些连接进入TIME_WAIT状态时,如下图:

所以对于负载大的服务器(比如每秒有上百个连接)此端口范围应该扩大,将sysctl -w net.inet.ip.portrange.first=30000命令放入/etc/rc.local,就可以将临时端口范围修改为30000–>65535。当然,如果你想调整65535这个数值,就使用net.inet.ip.portrange.last命令。这里我只调整了net.inet.ip.portrange.first的数值。
5、重启机器。
二、squid的安装
1、安装perl
newproxy# cd /usr/ports/lang/perl5
newproxy# make install
2、下载并安装squid
从http://www.squid-cache.org/Versions/v2/2.6/下载squid-2.6.STABLE16.tar.gz并通过FTP放置服务器目录中/home/funpower,然后开始解压安装:
newproxy# cd /home/funpower
newproxy# tar zxvf squid-2.6.STABLE16.tar.gz
newproxy# cd squid-2.6.STABLE16
newproxy# ./configure –prefix=/usr/local/squid
newproxy# make
newproxy# make install
3、配置squid.conf
newproxy# cd /usr/local/squid/etc
newproxy# ee squid.conf
内容如下:
acl web src 192.168.60.0/24
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow web
http_access deny all
icp_access allow all
http_port 3128
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
cache deny QUERY
cache_mem 64 MB
cache_dir ufs /usr/local/squid/cache 7000 16 256
access_log /dev/null
cache_log /dev/null
cache_store_log none
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
cache_mgr webmaster@jscpu.com
cache_effective_user squid
cache_effective_group squid
visible_hostname jiulongproxynew.jscpu.com
4、创建用户及缓存等:
newproxy# pw groupadd squid
newproxy# pw adduser squid -g squid -s /nonexistent
newproxy# mkdir /usr/local/squid/cache
newproxy# chown -R squid /usr/local/squid/cache
newproxy# chgrp -R squid /usr/local/squid/cache
newproxy# chown -R squid /usr/local/squid/var/logs
newproxy# chgrp -R squid /usr/local/squid/var/logs
newproxy# /usr/local/squid/sbin/squid -z
newproxy# cd /usr/local/squid/sbin
newproxy# ./squid
newproxy# ee /etc/rc.local
加入如下一行:
/usr/local/squid/sbin/squid
保存退出。
5、优化squid
???
发表: delphij
时间: 2007/10/11 13:26:11作为 FreeBSD 7.0-RELEASE 之前的一项重要步骤,今天 FreeBSD 正式创建了 7-STABLE 分支 (RELENG_7)。
目前 CVS -HEAD 上的版本已正式改名为 8.0-CURRENT。依照惯例,从现在开始到最终发布7.0-RELEASE仍然需要至少8周的时间。
请注意,目前 7-STABLE 分支还不适合在生产环境大规模使用,在接下来的 Release Cycle 过程中我们将继续对其进行测试和排错工作。请有条件的同学开始测试 RELENG_7 分支,并提交错误报告(最好有patch
)
extman的首页能进了,登陆框中的验证码图片又不能显示了,/var/log/httpd-error.log中的错误信息:
[Wed Sep 12 14:20:40 2007] [error] [client 218.104.52.212] Can’t locate GD.pm in @INC (@INC contains: /usr/local/www/extman/libs /usr/local/lib/perl5/5.8.8/BSDPAN
/usr/local/lib/perl5/site_perl/5.8.8/mach /usr/local/lib/perl5/site_perl/5.8.8
/usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.8.8/mach
/usr/local/lib/perl5/5.8.8 .) at /usr/local/www/extman/libs/Ext/GD.pm line 14., referer: http://mail.funpower.cn/extman/cgi/index.cgi
[Wed Sep 12 14:20:40 2007] [error] [client 218.104.52.212] BEGIN failed–compilation aborted at /usr/local/www/extman/libs/Ext/GD.pm line 14., referer: http://mail.funpower.cn/extman/cgi/index.cgi
extman的bbs上也有人提出了此问题,原因是perl的GD模块没有正确安装,此GD模块不是PHPINFO中的GD模块,而是Perl上的GD模块,安装如下:
mail# cd /usr/ports/graphics/p5-GD
mail# make install
mail# reboot
重启后,再次登陆,验证图片就显示了,问题解决。
刚刚解决了Extmail登陆的问题,管理模块Extman又登陆不上,错误信息:
Can’t locate /en_US in @INC (@INC contains:
/usr/local/www/extman/libs
/usr/local/lib/perl5/5.8.8/BSDPAN
/usr/local/lib/perl5/site_perl/5.8.8/mach
/usr/local/lib/perl5/site_perl/5.8.8
/usr/local/lib/perl5/site_perl
/usr/local/lib/perl5/5.8.8/mach
/usr/local/lib/perl5/5.8.8 .) at
/usr/local/www/extman/libs/Ext/Lang.pm line 63.
Extmail blog上说是extman的配置文件extman.cf中的语言文件路径输入有错误,可我再三检查了,没问题。一时解决不了,后来想到看apache的错误日志文件,打开/var/log/httpd-error.log,找到了错误信息:
[Wed Sep 12 14:16:55 2007] [error] [client 218.104.52.xxx] /usr/local/www/extman//webman.cf not exists or not readable at /usr/local/www/extman/libs/Ext/Config.pm line 60., referer: http://mail.funpower.cn/extmail/cgi/index.cgi
从上看,路径应该没问题,倒是注意了“or not readable”这话,突然想到会不会是没有读取extman.cf的权限,配置时给这文件是用了chown 600的属性,于是马上将属性改成644:
mail# chown 644 /usr/local/www/extman/extman.cf
问题解决。
这两天在试验安装一下Extmail,在全部配置完后从IE中登陆Extmail时出现了如下的错误:
Unix::Syslog not found, please install it first! (in cleanup) Undefined subroutine &Ext::Logger::do_closelog called at /usr/local/www/extmail/libs/Ext/Logger.pm line 87
在Extmail bbs上找到了答案,如果是Linux系统,就是少装了“perl-Unix-Syslog-0.100-1hzq.i386.rpm”这个RPM包。
在FreeBSD中进行如下操作,安装此包(文件名:Unix-Syslog-0.100.tar.gz),重启后,可以正常登陆了。
mail# cd /usr/ports/sysutils/p5-Unix-Syslog
mail# make install
mail# reboot

















