Debian/Ubuntu/CentOS VPS安装net-speeder并优化

  • 25
  • 37,150 views
  • A+
所属分类:Linux

以前介绍过VPS上安装锐速对VPS的加速效果,但是这货对 Linux 内核有要求,一般就只能在XEN或者KVM的机子上安装。不过还好锐速有一个免费的代替品:net-speeder,所以这里介绍一下 Debian/Ubuntu 上安装 net-speeder 并对 net-speeder 的夸张带宽占用做一些优化。

软件 Github 地址:net-speeder

安装过程:

CentOS安装

wget --no-check-certificate https://gist.github.com/LazyZhu/dc3f2f84c336a08fd6a5/raw/d8aa4bcf955409e28a262ccf52921a65fe49da99/net_speeder_lazyinstall.sh
sh net_speeder_lazyinstall.sh

安装完毕后再敲入:
nohup /usr/local/net_speeder/net_speeder venet0 "ip" >/dev/null 2>&1 &
注意这里引号中的IP不需要动,有的地方说需要改成自己的IP地址,其实不用改!

关闭net_speeder:

killall net_speeder

Debian/Ubuntu 一键包

wget --no-check-certificate https://raw.githubusercontent.com/tennfy/debian_netspeeder_tennfy/master/debian_netspeeder_tennfy.sh
chmod a+x debian_netspeeder_tennfy.sh
bash debian_netspeeder_tennfy.sh

来自 Tennfy

查看 net-speeder 是否运行
ps aux|grep net_speeder|grep -v grep
停止net-speeder
killall net_speeder
启动net-speeder(OPENVZ环境)
nohup /root/net_speeder venet0 "ip" >/dev/null 2>&1 &

注:CentOS 下安装需要使用额外的 EPEL源 较麻烦,Github 上有教程,大家可以参看
1. 安装运行及编译的依赖库
apt-get install libnet1;apt-get install libpcap0.8;apt-get install libnet1-dev;apt-get install libpcap0.8-dev
2. 下载源码到 服务器
cd /var;wget https://github.com/snooda/net-speeder/raw/master/net_speeder.c;wget https://github.com/snooda/net-speeder/raw/master/build.s
3. 编译
chmod +x build.sh;./build.sh -DCOOKED
4. 运行并加入开机启动
nohup /var/net_speeder eth0 "ip";echo "nohup /var/net_speeder eth0 "ip" >/dev/null 2>&1 &" >> /etc/rc.local

优化

由于双倍发包,比较吃流量,也对网络资源造成了高占用,所以我们可以只在高峰拥堵时段开启 net-speeder ,在正常时段关闭它。

1.设置时区(一般 LNMP 等一键包环境默认已经设置好了的)
echo "Asia/Shanghai" >/etc/timezone
2、设置定时开关

echo '0 13 * * * root nohup /root/net_speeder venet0 "ip" >/dev/null 2>&1 &' >>/etc/crontab
echo "0 2 * * * root killall net_speeder" >>/etc/crontab
/etc/init.d/cron restart

注:根据我经验,一天中当美帝时间过了 24 点后国内访问延时就是飙升,所以我们这里设置是 13点 开启,午夜 2点 关闭。

注意事项

以下几种情况不适合使用net-speeder:

  1. 小流量 VPS,因为使用 net-speeder 会消耗双倍流量。
  2. 主要提供网页、图片等小文件访问。net-speeder 对于下载大文件、代理访问视频网站等效果比较好,而对小文件加速效果不明显。
  3. 需要使用 pptpd 等不支持双倍发包的网络软件。net-speeder 会造成这些软件无法正常使用。
  4. 如果线路本身很好,不存在延迟较大情况,使用 net-speeder 效果会适得其反。

本文引用自https://www.vobe.io/archives/42

weinxin
我的微信公众号
我的微信公众号扫一扫

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

目前评论:25   其中:访客  0   博主  0

    • ivmm ivmm 0

      Warning: Use of undefined constant auto - assumed 'auto' (this will throw an Error in a future version of PHP) in /www/wwwroot/past.cmsky.org/wp-content/themes/begin5.2/inc/inc.php on line 911

      哦,以后多来我的网站看看

        • 厘米 厘米 9

          Warning: Use of undefined constant auto - assumed 'auto' (this will throw an Error in a future version of PHP) in /www/wwwroot/past.cmsky.org/wp-content/themes/begin5.2/inc/inc.php on line 911

          @ivmm 嗯,会常去逛逛的!

        • 暴博客 暴博客 0

          Warning: Use of undefined constant auto - assumed 'auto' (this will throw an Error in a future version of PHP) in /www/wwwroot/past.cmsky.org/wp-content/themes/begin5.2/inc/inc.php on line 911

          很棒,还有就是求互访

            • 厘米 厘米 9

              Warning: Use of undefined constant auto - assumed 'auto' (this will throw an Error in a future version of PHP) in /www/wwwroot/past.cmsky.org/wp-content/themes/begin5.2/inc/inc.php on line 911

              @暴博客 嘿嘿,已回访!

            • sumo sumo 1

              Warning: Use of undefined constant auto - assumed 'auto' (this will throw an Error in a future version of PHP) in /www/wwwroot/past.cmsky.org/wp-content/themes/begin5.2/inc/inc.php on line 911

              net_speeder优化中,设置时间启动最后一条运行不了 /etc/init.d/cron restart

              # /etc/init.d/cron restart
              /kiwivm_task_file_029067b4c985901bded9a741f7ba0b31dc1fe3f2: line 19: /etc/init.d/cron: No such file or directory
              Exit code: 127

              centos x86 mini

                • 厘米 厘米 9

                  Warning: Use of undefined constant auto - assumed 'auto' (this will throw an Error in a future version of PHP) in /www/wwwroot/past.cmsky.org/wp-content/themes/begin5.2/inc/inc.php on line 911

                  @sumo service crond restart试试!

                    • sumo sumo 1

                      Warning: Use of undefined constant auto - assumed 'auto' (this will throw an Error in a future version of PHP) in /www/wwwroot/past.cmsky.org/wp-content/themes/begin5.2/inc/inc.php on line 911

                      @厘米 # service crond restart

                      crond: unrecognized service

                      Exit code: 1

                      *** End of transmission ***

                      net_speeder可以启动,就是优化不能。有没有从头到尾的完整命令,用于搬瓦工的centos

                        • 厘米 厘米 9

                          Warning: Use of undefined constant auto - assumed 'auto' (this will throw an Error in a future version of PHP) in /www/wwwroot/past.cmsky.org/wp-content/themes/begin5.2/inc/inc.php on line 911

                          @sumo 我在搬瓦工装过可以的!

                    • 啊羽 啊羽 1

                      Warning: Use of undefined constant auto - assumed 'auto' (this will throw an Error in a future version of PHP) in /www/wwwroot/past.cmsky.org/wp-content/themes/begin5.2/inc/inc.php on line 911

                      请问一下老师。 这个命令可不可以直接复制到到操作界面里。。。我只会一个一个敲。。。。

                        • 厘米 厘米 9

                          Warning: Use of undefined constant auto - assumed 'auto' (this will throw an Error in a future version of PHP) in /www/wwwroot/past.cmsky.org/wp-content/themes/begin5.2/inc/inc.php on line 911

                          @啊羽 根据你的系统复制对应的命令,一条一条执行好些。我不是老师啦,只是个运维工作者。

                            • 阿语 阿语 1

                              Warning: Use of undefined constant auto - assumed 'auto' (this will throw an Error in a future version of PHP) in /www/wwwroot/past.cmsky.org/wp-content/themes/begin5.2/inc/inc.php on line 911

                              @厘米 可是要怎么复制呢,我是window7

                                • 厘米 厘米 9

                                  Warning: Use of undefined constant auto - assumed 'auto' (this will throw an Error in a future version of PHP) in /www/wwwroot/past.cmsky.org/wp-content/themes/begin5.2/inc/inc.php on line 911

                                  @阿语 用xshell等软件连接到vps上去操作!http://past.cmsky.org/xshell-5-beta/

                                    • 啊羽 啊羽 1

                                      Warning: Use of undefined constant auto - assumed 'auto' (this will throw an Error in a future version of PHP) in /www/wwwroot/past.cmsky.org/wp-content/themes/begin5.2/inc/inc.php on line 911

                                      @厘米 我是搬瓦工的默认系统 :CentOS 下安装需要使用额外的 EPEL源 较麻烦,Github 上有教程,大家可以参看
                                      1. 安装运行及编译的依赖库
                                      apt-get install libnet1;apt-get install libpcap0.8;apt-get install libnet1-dev;apt-get install libpcap0.8-dev
                                      这里第一步就执行失败了
                                      -bash: pt-get: command not found
                                      -bash: apt-get: command not found
                                      -bash: apt-get: command not found
                                      -bash: apt-get: command not found
                                      请问这是怎么回事

                                        • 厘米 厘米 9

                                          Warning: Use of undefined constant auto - assumed 'auto' (this will throw an Error in a future version of PHP) in /www/wwwroot/past.cmsky.org/wp-content/themes/begin5.2/inc/inc.php on line 911

                                          @啊羽 apt-get install是debian/ubuntu的命令,centos用yum install。

                                            • 啊羽 啊羽 1

                                              Warning: Use of undefined constant auto - assumed 'auto' (this will throw an Error in a future version of PHP) in /www/wwwroot/past.cmsky.org/wp-content/themes/begin5.2/inc/inc.php on line 911

                                              @厘米 谢谢您

                                  • 大大的小蜗牛 大大的小蜗牛 0

                                    Warning: Use of undefined constant auto - assumed 'auto' (this will throw an Error in a future version of PHP) in /www/wwwroot/past.cmsky.org/wp-content/themes/begin5.2/inc/inc.php on line 911

                                    可以的。

                                    • coderjin coderjin 0

                                      Warning: Use of undefined constant auto - assumed 'auto' (this will throw an Error in a future version of PHP) in /www/wwwroot/past.cmsky.org/wp-content/themes/begin5.2/inc/inc.php on line 911

                                      CentOS安装 提示找不到下载的地址可以用下面的

                                      wget –no-check-certificate https://gist.githubusercontent.com/CoderJin/e2f738d7bb7e781b0135b7fece817557/raw/f2aa73de1f2abd96185d5eb45e2bab507b8699b5/net_speeder_lazyinstall.sh
                                      sh net_speeder_lazyinstall.sh

                                        • wtks1 wtks1 4

                                          Warning: Use of undefined constant auto - assumed 'auto' (this will throw an Error in a future version of PHP) in /www/wwwroot/past.cmsky.org/wp-content/themes/begin5.2/inc/inc.php on line 911

                                          @coderjin 多谢了,网上找的基本都不能用,你这个测试成功,多谢了

                                        • TTP TTP 0

                                          Warning: Use of undefined constant auto - assumed 'auto' (this will throw an Error in a future version of PHP) in /www/wwwroot/past.cmsky.org/wp-content/themes/begin5.2/inc/inc.php on line 911

                                          你好~纯小白。好像下载不了这个软件
                                          **************************************************************
                                          KiwiVM Task File, executed: Thu, 29 Sep 2016 11:51:02 -0400
                                          **************************************************************
                                          # wget –no-check-certificate
                                          wget: missing URL
                                          Usage: wget [OPTION]… [URL]…

                                          Try `wget –help’ for more options.
                                          Exit code: 1
                                          # https://gist.github.com/LazyZhu/dc3f2f84c336a08fd6a5/raw/d8aa4bcf955409e28a262ccf52921a65fe49da99/net_speeder_lazyinstall.sh
                                          /kiwivm_task_file_7134feb81e5bb451b2398be427f55babbd9a0045: line 22: https://gist.github.com/LazyZhu/dc3f2f84c336a08fd6a5/raw/d8aa4bcf955409e28a262ccf52921a65fe49da99/net_speeder_lazyinstall.sh: No such file or directory
                                          Exit code: 127
                                          # sh net_speeder_lazyinstall.sh
                                          sh: net_speeder_lazyinstall.sh: No such file or directory
                                          Exit code: 127
                                          *** End of transmission ***

                                          • 年货 年货 0

                                            Warning: Use of undefined constant auto - assumed 'auto' (this will throw an Error in a future version of PHP) in /www/wwwroot/past.cmsky.org/wp-content/themes/begin5.2/inc/inc.php on line 911

                                            # sh net_speeder_lazyinstall.sh
                                            \033[31m Error: Unable to Determine OS Version. \033[0m出现这个错误怎么办

                                            • wtks1 wtks1 4

                                              Warning: Use of undefined constant auto - assumed 'auto' (this will throw an Error in a future version of PHP) in /www/wwwroot/past.cmsky.org/wp-content/themes/begin5.2/inc/inc.php on line 911

                                              openvz可以抛弃这个了!有大佬写出了openvz的UML+BBR+SSR一键包(测试),效果极佳,搬瓦工凤凰城的机子,原来即便开了netspeeder,在高峰时段也连720P都看不了,而用了这个之后,即便在晚上高峰时段,也能看1080P,地址在这里:https://www.91yun.org/archives/5345

                                                • 厘米 厘米 9

                                                  Warning: Use of undefined constant auto - assumed 'auto' (this will throw an Error in a future version of PHP) in /www/wwwroot/past.cmsky.org/wp-content/themes/begin5.2/inc/inc.php on line 911

                                                  @wtks1 不错,就在等这个,终于出了!

                                                • 粉丝 粉丝 1

                                                  Warning: Use of undefined constant auto - assumed 'auto' (this will throw an Error in a future version of PHP) in /www/wwwroot/past.cmsky.org/wp-content/themes/begin5.2/inc/inc.php on line 911

                                                  ,,为啥用DEBIAN那个安装包就能低到%1以下丢包。用CE的就死活都有5-10 ,太坑了。。用DEBIANVPN老断开啊。我不想用啊 可是CE的VPN不断开丢包还是高啊5-10 ,怎么办 求解

                                                    • 厘米 厘米 9

                                                      Warning: Use of undefined constant auto - assumed 'auto' (this will throw an Error in a future version of PHP) in /www/wwwroot/past.cmsky.org/wp-content/themes/begin5.2/inc/inc.php on line 911

                                                      @粉丝 丢包跟线路有关!

                                                    • 粉丝 粉丝 1

                                                      Warning: Use of undefined constant auto - assumed 'auto' (this will throw an Error in a future version of PHP) in /www/wwwroot/past.cmsky.org/wp-content/themes/begin5.2/inc/inc.php on line 911

                                                      请问还有别的能降低丢包的吗 这种多倍发包的 我不要什么加速 我只要丢包百分1以下 我VPN上游戏的 TCP加速没用 我要丢包低