新客网WWW.XKER.COM:致力做中国最专业的网络学院!
学院: 操作系统 - 网络应用 - 服务器 - 网络安全 - 工具软件 - 办公软件 - Web开发 - 数据库 - 网页设计 - 图形图像 - 媒体动画 - 硬件学堂 - 存储频道 - QQ专区
您的位置:首页 > 网络学院 > 操作系统 > Unix系统 > FreeBSD教程 > 正文:FREEBSD升级及优化全攻略(上)

FREEBSD升级及优化全攻略(上)

新客网 XKER.COM 2008-01-19 来源:新客网编辑整理 佚名 收藏本文

  重新编译内核

  到/sys/i386/conf里面,cp GENERIC onlinecq,再vi onlinecq优化内核,注重加入下面的内容
  #disable ctrl alt delete
  options SC_DISABLE_REBOOT

  #quota limit
  options QUOTA

  #ipfw support
  options IPFIREWALL
  options DUMMYNET
  options HZ=3000
  options IPDIVERT
  options IPFIREWALL_VERBOSE
  options IPFIREWALL_VERBOSE_LIMIT=100
  options IPSTEALTH
  options TCP_DROP_SYNFIN
  options IPFIREWALL_DEFAULT_TO_ACCEPT
  options ICMP_BANDLIM

  options ACCEPT_FILTER_DATA
  options ACCEPT_FILTER_HTTP

  #ipfilter support
  #options IPFILTER
  #options IPFILTER_LOG
  #options IPFILTER_DEFAULT_BLOCK

  再执行:

  /usr/sbin/config onlinecq
  cd ../../compile/onlinecq
  make depend
  make
  make install
  重新启动服务器

  到此为止,服务器操作系统及内核升级成功
  reboot

  优化FREEBSD

  检查升级情况
  使用ssh进入系统,使用uname –a 可以查到是否升级成功﹔

  打开防火墙

  更新rc.conf里面的设置,加上:
  #enable_quotas="YES"
  #check_quotas="YES"
  firewall_enable="YES"
  firewall_script="/etc/rc.firewall"
  firewall_type="/etc/ipfw.rules" #create it!
  firewall_quiet="NO"
  firewall_logging_enable="YES"
  log_in_vain="NO"
  tcp_drop_synfin="NO"
  tcp_restrict_rst="YES"
  icmp_drop_redirect="YES"
  优化内核参数

  修改系统内核参数,实现微调:vi /etc/sysctl.conf
  kern.ipc.somaxconn=8192
  kern.ipc.maxsockbuf=2097152
  kern.maxfilesperproc=32768
  kern.maxfiles=65536
  kern.securelevel=-1
  net.inet.tcp.sendspace=65536
  net.inet.tcp.recvspace=32768
  net.inet.udp.maxdgram=57344
  net.inet.icmp.drop_redirect=1
  net.inet.icmp.log_redirect=0
  net.inet.ip.redirect=0
  net.inet6.ip6.redirect=0
  net.inet.icmp.icmplim=100
  net.inet.tcp.always_keepalive=0
  net.inet.tcp.delayed_ack=0
  net.inet.tcp.log_in_vain=0
  net.inet.udp.log_in_vain=0
  net.inet.tcp.blackhole=2
  net.inet.udp.blackhole=1
  net.local.stream.sendspace=65535
  net.local.stream.recvspace=32768
  net.inet.ip.fastforwarding=1
  vfs.vmiodirenable=1

  安装防火墙

  防火墙在上面已经编译入了内核,并且在上面的rc.conf里面已经打开了,所以在此只要设置一下即可!
  答应所有IP通过,免得把自己给挡在外面了。
  ipfw add all from any to any

  其它规则根据实际情况来做,假如您想系统每次启动都使用上一次的规则,可以把这些内容加到:
  vi /etc/ipfw.rules
  里面,语法规则同ipfw。

共2页: 上一页 [1] [2] 下一页
收藏】 【评论】 【推荐】 【投稿】 【打印】 【关闭
发表评论
要记得去论坛讨论,点击注册新会员匿名评论
评论内容:不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
阅读排行
随机推荐
实用信息推荐