- Jennifer2018-04-19中级会员122650
6刀年付刚升级了1G网口
本想升级内核支持bbr。担心启动不成功,太折腾。改用南琴浪推荐的rinetd。
刚才用北京电信,测试油管 1080 测试结果:
(1)用brook 可以稳定在3-7Mbps。适合看1920X1080@24
(2)用v2ray+mkcp 速度抖动厉害,在几百kbps-4Mbps之间抖动。勉强看1920X1080@24root@nfp1:~/# mkdir Rinetd
root@nfp1:~/Rinetd# vi tcp_nanqinlang-rinetd-debian+ubuntu.sh
./tcp_nanqinlang-rinetd-debian+ubuntu.sh
文件内容是下面的脚本 只适用于debian和ubuntu,单个端口加速,我填写了brook的端口。
#!/bin/bash
Green_font="\033[32m" && Red_font="\033[31m" && Font_suffix="\033[0m"
Info="${Green_font}${Font_suffix}"
Error="${Red_font}${Font_suffix}"
echo -e "${Green_font}
#====================================================Project: tcp_nanqinlang
Description: --debian&ubuntu --rinetd --singleNIC
Version: based on linhua's origin
Origin: https://github.com/linhua55/lkl_study
Author: linhua && nanqinlang
Blog: https://sometimesnaive.org
Github: https://github.com/nanqinlang
#====================================================
${Font_suffix}"check_system(){
#sort
[[ -z "cat /etc/issue | grep -iE "debian"" && -z "cat /etc/issue | grep -iE "ubuntu"" ]] && echo -e "${Error} only support Debian !" && exit 1
#bit
[[ "uname -m" != "x86_64" ]] && echo -e "${Error} only support 64bit !" && exit 1
}check_root(){
[[ "id -u" != "0" ]] && echo -e "${Error} must be root user !" && exit 1
}check_ovz(){
apt-get update && apt-get install -y virt-what
[[ "virt-what" != "openvz" ]] && echo -e "${Error} only support OpenVZ !" && exit 1
}check_requirement(){
# check iptables
apt-get install -y iptables# check "iptables grep cut xargs ip awk"
for CMD in iptables grep cut xargs ip awk
do
if ! type -p ${CMD}; then
echo -e "${Error} requirements not found, please check !" && exit 1
fi
done
}directory(){
[[ ! -d /home/tcp_nanqinlang ]] && mkdir -p /home/tcp_nanqinlang
cd /home/tcp_nanqinlang
}download(){
wget https://raw.githubusercontent.co ... inetd/module/rinetd
chmod +x rinetd
}config-port(){
echo -e "${Info} Please input port to be accelerated"
read -p "(multi ports is diveded by space . not support port range. default port:8080):" portsif [[ -z "${ports}" ]]; then
echo -e "0.0.0.0 8080 0.0.0.0 8080\c" >> config-port.conf
else
for port in ${ports}
do
#can write config in new line
echo "0.0.0.0 ${port} 0.0.0.0 ${port}" >> config-port.conf
done
fi
}config-rinetd(){
# single NIC
IFACE=ip -4 addr | awk '{if ($1 ~ /inet/ && $NF ~ /^/) {a=$NF}} END{print a}'
echo -e "#!/bin/bash \ncd /home/tcp_nanqinlang \nnohup ./rinetd -f -c config-port.conf raw ${IFACE} &" >> config-rinetd.sh && chmod +x config-rinetd.sh
}self-start(){
sed -i "s/exit 0/ /ig" /etc/rc.local
echo -e "\n/home/tcp_nanqinlang/config-rinetd.sh\c" >> /etc/rc.local
chmod +x /etc/rc.local
}run-it-now(){
./config-rinetd.sh
}install(){
check_system
check_root
check_ovz
check_requirement
directory
download
config-port
config-rinetd
self-start
run-it-now
status
}status(){
if [[ ! -zps -A | grep rinetd]]; then
echo -e "${Info} tcp_nanqinlang is running !"
else echo -e "${Error} tcp_nanqinlang not running, please check !"
fi
}uninstall(){
check_root
kill -9ps -A | grep rinetd | awk '{print $1}'
rm -rf /home/tcp_nanqinlang
iptables -t raw -F
sed -i '/\/home\/tcp_nanqinlang\/config-rinetd.sh/d' /etc/rc.local
echo -e "${Info} uninstall finished."
}echo -e "${Info} Please select function"
echo -e "1.install rinetd-bbr\n2.Check rinetd-bbr running status\n3.uninstall rinetd-bbr"
read -p "input number(1-3):" functionwhile [[ ! "${function}" =~ ^[1-3]$ ]]
do
echo -e "${Error} invalid parameter"
echo -e "${Info} select again" && read -p "input number(1-3):" function
doneif [[ "${function}" == "1" ]]; then
install
elif [[ "${function}" == "2" ]]; then
status
else
uninstall
fi