sivs147 发表于 2012-5-24 17:26:30

DIY 100M 路由器 pfsense+panabit

硬體
我的比較特殊一點是用工業電腦組起來
機殼+底板:愛訊 ATX6022/14G
CPU卡:NuPRO-760
         P3 1.1GHz1.25GB
網卡:3COM 905B-TX *5

軟體:pfsense 2.0.1
       panabit12.04

我把ipeinstall與/bin/ipectrl改過
並新增一個SCRIPT檔用以開機啟動Panabit
須注意,如pfsense的網頁要以HPPTS加密方式瀏覽
要修改通訊埠改為非433

修改如下
1.(ipeinstall)將連線數優化修改關掉,因為我發現pfsense的數值較高
o tune your system(y/n): "
read answer
[ "${answer}" = "" ] && answer="y"
if [ "${answer}" = "y" -o "${answer}" = "Y" ]; then
      #Disable nmbclusters setting
       #new_nmbclusters=10240
      tmpfile=/var/loader.tmp
      [ -f ${tmpfile} ] && rm -f ${tmpfile}
      touch ${tmpfile}

      if [ -f /boot/loader.conf ]; then
                cat /boot/loader.conf | while read line; do
                        varname=`echo "${lineecho ""
echo "To make your system more sutiable for panabit running, it's"
echo "recomended of tuning your system according your system memory"
echo "size and cpu frequence."
echo -n "Do you want t}" | cut -d'=' -f1`
                        #
                        #Disabled nmbclusters setting
                        #if [ "${varname}" = "kern.ipc.nmbclusters" ]; then
                        #      echo "kern.ipc.nmbclusters=${new_nmbclusters}" >> ${tmpfile}
                        #el
                        if [ "${varname}" = "kern.maxdsiz" ]; then
                              echo "kern.maxdsiz=1600000000" >> ${tmpfile}
                        elif [ "${varname}" = "vm.pmap.pg_ps_enabled" ]; then
                              echo "vm.pmap.pg_ps_enabled=1" >> ${tmpfile}
                        elif [ "${varname}" = "kern.hz" ]; then
                              echo "kern.hz=1000" >> ${tmpfile}
                        else
                              echo "${line}" >> ${tmpfile}
                        fi
                done
      fi
      #
      #Disable nmbclusters setting
       #if [ "`cat ${tmpfile} | grep "kern.ipc.nmbclusters"`" = "" ]; then
      #      echo "kern.ipc.nmbclusters=${new_nmbclusters}" >> ${tmpfile}
      #fi
2.(ipeinstall)關閉網路閘道設定
此設定會導致pfsense的閘道設定覆蓋,使使用PPPOE無法正常上網
gateway=""
echo -n "Please input default gateway: "
read gateway
#
# Disable gateway auto setting
# if [ "${gateway}" = "" ]; then
#      gateway=`netstat -rn | grep "^default" | awk '{print $2}' 2>/dev/null`
# fi
3.(ipeinstall)新增開機啟動panabit選項
此選項須新增panabit_start.sh於安裝檔內 /etc
#Add run on Startup
echo -n "Do you want to run Panabit on Startup(y/n): "
read answer
[ "${answer}" = "" ] && answer="y"
if [ "${answer}" = "y" -o "${answer}" = "Y" ]; then
      cp -f ${PGPATH}/etc/panabit_start.sh /usr/local/etc/rc.d/panabit_start.sh
fi

echo "Panabit will run on Startup"
#
4.(ipeinstall)panabit_start.sh內容如下
#Start Panabit Service

/usr/panabit/bin/ipectrl start

#Delay ACK to try and piggyback it onto a data packet <=加速Panabit網頁瀏覽速度

sysctl net.inet.tcp.delayed_ack=1
5.ipectl修改,,關閉網路閘道自動取得
# Setup gateway.
      #gateway=`netstat -rn | grep "^default" | awk '{print $2}' 2>/dev/null`
      #if [ "${gateway}" != "${GATEWAY}" ]; then
      #      ermsg=`route delete default 2>&1`
      #      route add default ${GATEWAY} >/dev/null
      #      echo "Set default gateway to ${GATEWAY}"
      #fi


以ipert效能測試
有開啟Panabit時,區網轉發效率為40Mbps~50Mbps
無開啟Panabit時,區網轉發效率為80Mbps~95Mbps

個人猜測是因為CPU太差,因
有開啟Panabit時,CPU使用率50%~70%
無開啟Panabit時,CPU使用率1%~15%
页: [1]
查看完整版本: DIY 100M 路由器 pfsense+panabit