├── README.md ├── bbr ├── centos6-centos.sh ├── centos6.sh ├── centos7-centos.sh ├── centos7.sh ├── ubuntu-centos.sh ├── ubuntu.sh ├── uml-centos.sh └── uml.sh ├── lkl └── install.sh └── uml.sh /README.md: -------------------------------------------------------------------------------- 1 | ## 3月16日更新的内容: 2 | 1. 随机启动的问题在 [@Jacky Bao](https://plus.google.com/u/0/108855478531549571757/posts/DabLxwHAwGH) 的分享下顺利解决 3 | 2. 进入uml的方式更简单,只要执行screen -x或者bash run.sh status即可 4 | 3. 在@allient neko的帮助下加入了母机和uml的文件交换目录,可以方便的互传文件 5 | 6 | 安装包还有问题可以回帖告知,感谢大家的测试反馈~ 7 | 8 | 9 | 只是测试版,欢迎测试。 10 | 1. 随机启动的问题在 [@Jacky Bao](https://plus.google.com/u/0/108855478531549571757/posts/DabLxwHAwGH) 的分享下顺利解决 11 | 2. 使用alpine linux,启动只需64M内存,已在我自己的128M内存的小鸡上测试通过 12 | 3. 已自带SSR,相关的SSR说明在后面。感谢@allient neko加入了ssr功能 13 | 4. 感谢 [@Jacky Bao](https://plus.google.com/u/0/108855478531549571757/posts/DabLxwHAwGH) 提供的原包,方便小内存运行 14 | 5. 建议大家看手动安装的文章,加深理解。[文章点我](https://www.91yun.org/archives/4996) 15 | 6. UML毕竟不是系统,甚至不是虚拟机,不要抱太大指望,不要有太多想法。能运行起来SSR我感觉已经很不错啦 16 | 17 | 18 | # 前置准备 19 | 请选择安装`64bit`的操作系统,目前还没做32bit的包 20 | VPS必须支持并开启TUN/TAP 21 | 22 | # 一键运行脚本 23 | ``` 24 | wget -N --no-check-certificate https://raw.githubusercontent.com/91yun/uml/master/bbr/uml.sh && bash uml.sh 25 | ``` 26 | 装完ssr和bbr就已经运行了,如果你不想改密码和端口的话就可以直接用。。默认配置在下面。。 27 | # UML相关说明 28 | ## 如何进入uml 29 | `screen -x`或者在目录下运行`bash run.sh status` 30 | 用户名:`root` , 密码:`root` 31 | ## 如何退出uml 32 | 在uml模式里,通过按快捷键`ctrl+a+d`来退出screen 33 | ## 删除uml进程 34 | ``` 35 | bash run.sh stop 36 | ``` 37 | ## 启动uml 38 | ``` 39 | bash run.sh start 40 | ``` 41 | ## 如何把文件传入UML 42 | 我已经在root目录下新建了个umlshare目录(`/root/umlshare`),在uml里也做了挂载,位置同样是`/root/umlshare`,只要把文件放进去就可以了 43 | # SSR相关说明 44 | ## 默认配置 45 | ``` 46 | 端口:9191 47 | 密码:www.91yun.org 48 | 加密:RC4-MD5 49 | 协议:auth_sha1_v4 50 | 混淆:tls1.2_ticket_auth 51 | ``` 52 | ## 如何修改SSR配置 53 | ### 第一步 54 | 根据上面的教程进入uml 55 | ### 第二步 56 | 修改mudb.json文件 57 | ``` 58 | vi /root/shadowsocksr/mudb.json 59 | ``` 60 | 把相关的配置改成你自己需要的就可以了。需要说明的是,因为没有编译相关的依赖库,不支持chacha20的加密方法 61 | ### 第三步 62 | 重启SSR程序 63 | ``` 64 | bash /root/shadowsocksr/run.sh 65 | ``` 66 | ### 最后一步 67 | 在母机的安装目录下打开run.sh找到下面的代码,把9191改成你自己刚才修改的端口 68 | ``` 69 | iptables -t nat -A PREROUTING -i venet0 -p tcp --dport 9191 -j DNAT --to-destination 10.0.0.2 70 | iptables -t nat -A PREROUTING -i venet0 -p udp --dport 9191 -j DNAT --to-destination 10.0.0.2 71 | ``` 72 | 然后重启即可 73 | 74 | ## SSR添加多用户 75 | ``` 76 | python mujson_mgr.py -a -p 端口 -k 密码 -m 加密方式 -O 协议 -o 混淆 77 | ``` 78 | 加完记得在母机增加iptables端口转发相关的代码 79 | -------------------------------------------------------------------------------- /bbr/centos6-centos.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin 3 | export PATH 4 | #=================================================================# 5 | # System Required: CentOS 6 # 6 | # Description: One click Install UML for bbr+ssr # 7 | # Author: 91yun # 8 | # Thanks: @allient neko @Jacky Bao # 9 | # Intro: https://www.91yun.org # 10 | #=================================================================# 11 | 12 | 13 | 14 | 15 | yum install -y tunctl uml-utilities screen 16 | 17 | 18 | wget http://soft.91yun.org/uml/91yun/uml-centos-64.tar.gz 19 | tar zfvx uml-centos-64.tar.gz 20 | cd uml-centos-64 21 | cur_dir=`pwd` 22 | cat > run.sh<<-EOF 23 | #!/bin/sh 24 | export HOME=/root 25 | start(){ 26 | tunctl -t tap1 27 | ifconfig tap1 10.0.0.1 28 | ifconfig tap1 up 29 | echo 1 > /proc/sys/net/ipv4/ip_forward 30 | iptables -P FORWARD ACCEPT 31 | iptables -t nat -A POSTROUTING -o venet0 -j MASQUERADE 32 | iptables -I FORWARD -i tap1 -j ACCEPT 33 | iptables -I FORWARD -o tap1 -j ACCEPT 34 | iptables -t nat -A PREROUTING -i venet0 -p tcp --dport 9191 -j DNAT --to-destination 10.0.0.2 35 | iptables -t nat -A PREROUTING -i venet0 -p udp --dport 9191 -j DNAT --to-destination 10.0.0.2 36 | screen -dmS uml ${cur_dir}/vmlinux ubda=${cur_dir}/CentOS64_fs eth0=tuntap,tap1 mem=256m 37 | ps aux | grep vmlinux 38 | } 39 | 40 | stop(){ 41 | kill \$( ps aux | grep vmlinux ) 42 | ifconfig tap1 down 43 | } 44 | 45 | status(){ 46 | 47 | screen -r \$(screen -list | grep uml | awk 'NR==1{print \$1}') 48 | 49 | } 50 | action=\$1 51 | #[ -z \$1 ] && action=status 52 | case "\$action" in 53 | 'start') 54 | start 55 | ;; 56 | 'stop') 57 | stop 58 | ;; 59 | 'status') 60 | status 61 | ;; 62 | 'restart') 63 | stop 64 | start 65 | ;; 66 | *) 67 | echo "Usage: \$0 { start | stop | restart | status }" 68 | ;; 69 | esac 70 | exit 71 | EOF 72 | 73 | #创建和uml的共享目录 74 | mkdir -p /root/umlshare 75 | 76 | chmod +x run.sh 77 | bash run.sh start 78 | 79 | echo "/bin/bash ${cur_dir}/run.sh start" >> /etc/rc.d/rc.local 80 | sed -i "s/exit 0/ /ig" /etc/rc.local 81 | 82 | chmod +x /etc/rc.d/rc.local 83 | umlstatus=$(ps aux | grep vmlinux) 84 | if [ "$umlstatus" == "" ]; then 85 | echo "some thing error!" 86 | else 87 | echo "uml install success!" 88 | fi -------------------------------------------------------------------------------- /bbr/centos6.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin 3 | export PATH 4 | #=================================================================# 5 | # System Required: CentOS 6 # 6 | # Description: One click Install UML for bbr+ssr # 7 | # Author: 91yun # 8 | # Thanks: @allient neko @Jacky Bao # 9 | # Intro: https://www.91yun.org # 10 | #=================================================================# 11 | 12 | 13 | 14 | 15 | yum install -y tunctl uml-utilities screen 16 | 17 | 18 | wget http://soft.91yun.org/uml/91yun/uml-ssr-64.tar.gz 19 | tar zfvx uml-ssr-64.tar.gz 20 | cd uml-ssr-64 21 | cur_dir=`pwd` 22 | cat > run.sh<<-EOF 23 | #!/bin/sh 24 | export HOME=/root 25 | start(){ 26 | tunctl -t tap1 27 | ifconfig tap1 10.0.0.1 28 | ifconfig tap1 up 29 | echo 1 > /proc/sys/net/ipv4/ip_forward 30 | iptables -P FORWARD ACCEPT 31 | iptables -t nat -A POSTROUTING -o venet0 -j MASQUERADE 32 | iptables -I FORWARD -i tap1 -j ACCEPT 33 | iptables -I FORWARD -o tap1 -j ACCEPT 34 | iptables -t nat -A PREROUTING -i venet0 -p tcp --dport 9191 -j DNAT --to-destination 10.0.0.2 35 | iptables -t nat -A PREROUTING -i venet0 -p udp --dport 9191 -j DNAT --to-destination 10.0.0.2 36 | screen -dmS uml ${cur_dir}/vmlinux ubda=${cur_dir}/alpine-x64 eth0=tuntap,tap1 mem=64m con=pts con1=fd:0,fd:1 37 | ps aux | grep vmlinux 38 | } 39 | 40 | stop(){ 41 | kill \$( ps aux | grep vmlinux ) 42 | ifconfig tap1 down 43 | } 44 | 45 | status(){ 46 | 47 | screen -r \$(screen -list | grep uml | awk 'NR==1{print \$1}') 48 | 49 | } 50 | action=\$1 51 | #[ -z \$1 ] && action=status 52 | case "\$action" in 53 | 'start') 54 | start 55 | ;; 56 | 'stop') 57 | stop 58 | ;; 59 | 'status') 60 | status 61 | ;; 62 | 'restart') 63 | stop 64 | start 65 | ;; 66 | *) 67 | echo "Usage: \$0 { start | stop | restart | status }" 68 | ;; 69 | esac 70 | exit 71 | EOF 72 | 73 | #创建和uml的共享目录 74 | mkdir -p /root/umlshare 75 | 76 | chmod +x run.sh 77 | bash run.sh start 78 | 79 | echo "/bin/bash ${cur_dir}/run.sh start" >> /etc/rc.d/rc.local 80 | sed -i "s/exit 0/ /ig" /etc/rc.local 81 | 82 | chmod +x /etc/rc.d/rc.local 83 | umlstatus=$(ps aux | grep vmlinux) 84 | if [ "$umlstatus" == "" ]; then 85 | echo "some thing error!" 86 | else 87 | echo "uml install success!" 88 | fi -------------------------------------------------------------------------------- /bbr/centos7-centos.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin 3 | export PATH 4 | #=================================================================# 5 | # System Required: CentOS 7 # 6 | # Description: One click Install UML for bbr+ssr # 7 | # Author: 91yun # 8 | # Thanks: @allient neko @Jacky Bao # 9 | # Intro: https://www.91yun.org # 10 | #=================================================================# 11 | 12 | 13 | 14 | 15 | yum install -y tunctl uml-utilities screen 16 | 17 | 18 | wget http://soft.91yun.org/uml/91yun/uml-centos-64.tar.gz 19 | tar zfvx uml-centos-64.tar.gz 20 | cd uml-centos-64 21 | cur_dir=`pwd` 22 | cat > run.sh<<-EOF 23 | #!/bin/sh 24 | export HOME=/root 25 | start(){ 26 | ip tuntap add tap1 mode tap 27 | ip addr add 10.0.0.1/24 dev tap1 28 | ip link set tap1 up 29 | echo 1 > /proc/sys/net/ipv4/ip_forward 30 | iptables -P FORWARD ACCEPT 31 | iptables -t nat -A POSTROUTING -o venet0 -j MASQUERADE 32 | iptables -I FORWARD -i tap1 -j ACCEPT 33 | iptables -I FORWARD -o tap1 -j ACCEPT 34 | iptables -t nat -A PREROUTING -i venet0 -p tcp --dport 9191 -j DNAT --to-destination 10.0.0.2 35 | iptables -t nat -A PREROUTING -i venet0 -p udp --dport 9191 -j DNAT --to-destination 10.0.0.2 36 | screen -dmS uml ${cur_dir}/vmlinux ubda=${cur_dir}/CentOS64_fs eth0=tuntap,tap1 mem=256m 37 | ps aux | grep vmlinux 38 | } 39 | 40 | stop(){ 41 | kill \$( ps aux | grep vmlinux ) 42 | ifconfig tap1 down 43 | } 44 | 45 | status(){ 46 | 47 | screen -r \$(screen -list | grep uml | awk 'NR==1{print \$1}') 48 | 49 | } 50 | action=\$1 51 | #[ -z \$1 ] && action=status 52 | case "\$action" in 53 | 'start') 54 | start 55 | ;; 56 | 'stop') 57 | stop 58 | ;; 59 | 'status') 60 | status 61 | ;; 62 | 'restart') 63 | stop 64 | start 65 | ;; 66 | *) 67 | echo "Usage: \$0 { start | stop | restart | status }" 68 | ;; 69 | esac 70 | exit 71 | EOF 72 | 73 | #创建和uml的共享目录 74 | mkdir -p /root/umlshare 75 | 76 | 77 | chmod +x run.sh 78 | bash run.sh start 79 | 80 | echo "/bin/bash ${cur_dir}/run.sh start" >> /etc/rc.d/rc.local 81 | sed -i "s/exit 0/ /ig" /etc/rc.local 82 | 83 | chmod +x /etc/rc.d/rc.local 84 | umlstatus=$(ps aux | grep vmlinux) 85 | if [ "$umlstatus" == "" ]; then 86 | echo "some thing error!" 87 | else 88 | echo "uml install success!" 89 | fi -------------------------------------------------------------------------------- /bbr/centos7.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin 3 | export PATH 4 | #=================================================================# 5 | # System Required: CentOS 7 # 6 | # Description: One click Install UML for bbr+ssr # 7 | # Author: 91yun # 8 | # Thanks: @allient neko @Jacky Bao # 9 | # Intro: https://www.91yun.org # 10 | #=================================================================# 11 | 12 | 13 | 14 | 15 | yum install -y tunctl uml-utilities screen 16 | 17 | 18 | wget http://soft.91yun.org/uml/91yun/uml-ssr-64.tar.gz 19 | tar zfvx uml-ssr-64.tar.gz 20 | cd uml-ssr-64 21 | cur_dir=`pwd` 22 | cat > run.sh<<-EOF 23 | #!/bin/sh 24 | export HOME=/root 25 | start(){ 26 | ip tuntap add tap1 mode tap 27 | ip addr add 10.0.0.1/24 dev tap1 28 | ip link set tap1 up 29 | echo 1 > /proc/sys/net/ipv4/ip_forward 30 | iptables -P FORWARD ACCEPT 31 | iptables -t nat -A POSTROUTING -o venet0 -j MASQUERADE 32 | iptables -I FORWARD -i tap1 -j ACCEPT 33 | iptables -I FORWARD -o tap1 -j ACCEPT 34 | iptables -t nat -A PREROUTING -i venet0 -p tcp --dport 9191 -j DNAT --to-destination 10.0.0.2 35 | iptables -t nat -A PREROUTING -i venet0 -p udp --dport 9191 -j DNAT --to-destination 10.0.0.2 36 | screen -dmS uml ${cur_dir}/vmlinux ubda=${cur_dir}/alpine-x64 eth0=tuntap,tap1 mem=64m con=pts con1=fd:0,fd:1 37 | ps aux | grep vmlinux 38 | } 39 | 40 | stop(){ 41 | kill \$( ps aux | grep vmlinux ) 42 | ifconfig tap1 down 43 | } 44 | 45 | status(){ 46 | 47 | screen -r \$(screen -list | grep uml | awk 'NR==1{print \$1}') 48 | 49 | } 50 | action=\$1 51 | #[ -z \$1 ] && action=status 52 | case "\$action" in 53 | 'start') 54 | start 55 | ;; 56 | 'stop') 57 | stop 58 | ;; 59 | 'status') 60 | status 61 | ;; 62 | 'restart') 63 | stop 64 | start 65 | ;; 66 | *) 67 | echo "Usage: \$0 { start | stop | restart | status }" 68 | ;; 69 | esac 70 | exit 71 | EOF 72 | 73 | #创建和uml的共享目录 74 | mkdir -p /root/umlshare 75 | 76 | 77 | chmod +x run.sh 78 | bash run.sh start 79 | 80 | echo "/bin/bash ${cur_dir}/run.sh start" >> /etc/rc.d/rc.local 81 | sed -i "s/exit 0/ /ig" /etc/rc.local 82 | 83 | chmod +x /etc/rc.d/rc.local 84 | umlstatus=$(ps aux | grep vmlinux) 85 | if [ "$umlstatus" == "" ]; then 86 | echo "some thing error!" 87 | else 88 | echo "uml install success!" 89 | fi 90 | 91 | -------------------------------------------------------------------------------- /bbr/ubuntu-centos.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin 3 | export PATH 4 | #=================================================================# 5 | # System Required: ubuntu & debian # 6 | # Description: One click Install UML for bbr+ssr # 7 | # Author: 91yun # 8 | # Thanks: @allient neko @Jacky Bao # 9 | # Intro: https://www.91yun.org # 10 | #=================================================================# 11 | 12 | 13 | 14 | apt-get update 15 | apt-get install -y tunctl uml-utilities screen 16 | 17 | 18 | wget http://soft.91yun.org/uml/91yun/uml-centos-64.tar.gz 19 | tar zfvx uml-centos-64.tar.gz 20 | cd uml-centos-64 21 | cur_dir=`pwd` 22 | cat > run.sh<<-EOF 23 | #!/bin/sh 24 | export HOME=/root 25 | start(){ 26 | ip tuntap add tap1 mode tap 27 | ip addr add 10.0.0.1/24 dev tap1 28 | ip link set tap1 up 29 | echo 1 > /proc/sys/net/ipv4/ip_forward 30 | iptables -P FORWARD ACCEPT 31 | iptables -t nat -A POSTROUTING -o venet0 -j MASQUERADE 32 | iptables -I FORWARD -i tap1 -j ACCEPT 33 | iptables -I FORWARD -o tap1 -j ACCEPT 34 | iptables -t nat -A PREROUTING -i venet0 -p tcp --dport 9191 -j DNAT --to-destination 10.0.0.2 35 | iptables -t nat -A PREROUTING -i venet0 -p udp --dport 9191 -j DNAT --to-destination 10.0.0.2 36 | screen -dmS uml ${cur_dir}/vmlinux ubda=${cur_dir}/CentOS64_fs eth0=tuntap,tap1 mem=256m 37 | ps aux | grep vmlinux 38 | } 39 | 40 | stop(){ 41 | kill \$( ps aux | grep vmlinux ) 42 | ifconfig tap1 down 43 | } 44 | 45 | status(){ 46 | 47 | screen -r \$(screen -list | grep uml | awk 'NR==1{print \$1}') 48 | 49 | } 50 | action=\$1 51 | #[ -z \$1 ] && action=status 52 | case "\$action" in 53 | 'start') 54 | start 55 | ;; 56 | 'stop') 57 | stop 58 | ;; 59 | 'status') 60 | status 61 | ;; 62 | 'restart') 63 | stop 64 | start 65 | ;; 66 | *) 67 | echo "Usage: \$0 { start | stop | restart | status }" 68 | ;; 69 | esac 70 | exit 71 | EOF 72 | 73 | #创建和uml的共享目录 74 | mkdir -p /root/umlshare 75 | 76 | chmod +x run.sh 77 | bash run.sh start 78 | 79 | echo "/bin/bash ${cur_dir}/run.sh start" >> /etc/rc.local 80 | sed -i "s/exit 0/ /ig" /etc/rc.local 81 | 82 | chmod +x /etc/rc.local 83 | umlstatus=$(ps aux | grep vmlinux) 84 | if [ "$umlstatus" == "" ]; then 85 | echo "some thing error!" 86 | else 87 | echo "uml install success!" 88 | fi -------------------------------------------------------------------------------- /bbr/ubuntu.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin 3 | export PATH 4 | #=================================================================# 5 | # System Required: ubuntu & debian # 6 | # Description: One click Install UML for bbr+ssr # 7 | # Author: 91yun # 8 | # Thanks: @allient neko @Jacky Bao # 9 | # Intro: https://www.91yun.org # 10 | #=================================================================# 11 | 12 | 13 | 14 | apt-get update 15 | apt-get install -y tunctl uml-utilities screen 16 | 17 | 18 | wget http://soft.91yun.org/uml/91yun/uml-ssr-64.tar.gz 19 | tar zfvx uml-ssr-64.tar.gz 20 | cd uml-ssr-64 21 | cur_dir=`pwd` 22 | cat > run.sh<<-EOF 23 | #!/bin/sh 24 | export HOME=/root 25 | start(){ 26 | ip tuntap add tap1 mode tap 27 | ip addr add 10.0.0.1/24 dev tap1 28 | ip link set tap1 up 29 | echo 1 > /proc/sys/net/ipv4/ip_forward 30 | iptables -P FORWARD ACCEPT 31 | iptables -t nat -A POSTROUTING -o venet0 -j MASQUERADE 32 | iptables -I FORWARD -i tap1 -j ACCEPT 33 | iptables -I FORWARD -o tap1 -j ACCEPT 34 | iptables -t nat -A PREROUTING -i venet0 -p tcp --dport 9191 -j DNAT --to-destination 10.0.0.2 35 | iptables -t nat -A PREROUTING -i venet0 -p udp --dport 9191 -j DNAT --to-destination 10.0.0.2 36 | screen -dmS uml ${cur_dir}/vmlinux ubda=${cur_dir}/alpine-x64 eth0=tuntap,tap1 mem=64m con=pts con1=fd:0,fd:1 37 | ps aux | grep vmlinux 38 | } 39 | 40 | stop(){ 41 | kill \$( ps aux | grep vmlinux ) 42 | ifconfig tap1 down 43 | } 44 | 45 | status(){ 46 | 47 | screen -r \$(screen -list | grep uml | awk 'NR==1{print \$1}') 48 | 49 | } 50 | action=\$1 51 | #[ -z \$1 ] && action=status 52 | case "\$action" in 53 | 'start') 54 | start 55 | ;; 56 | 'stop') 57 | stop 58 | ;; 59 | 'status') 60 | status 61 | ;; 62 | 'restart') 63 | stop 64 | start 65 | ;; 66 | *) 67 | echo "Usage: \$0 { start | stop | restart | status }" 68 | ;; 69 | esac 70 | exit 71 | EOF 72 | 73 | #创建和uml的共享目录 74 | mkdir -p /root/umlshare 75 | 76 | chmod +x run.sh 77 | bash run.sh start 78 | 79 | echo "/bin/bash ${cur_dir}/run.sh start" >> /etc/rc.local 80 | sed -i "s/exit 0/ /ig" /etc/rc.local 81 | 82 | chmod +x /etc/rc.local 83 | umlstatus=$(ps aux | grep vmlinux) 84 | if [ "$umlstatus" == "" ]; then 85 | echo "some thing error!" 86 | else 87 | echo "uml install success!" 88 | fi 89 | 90 | -------------------------------------------------------------------------------- /bbr/uml-centos.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin 3 | export PATH 4 | #=================================================================# 5 | # System Required: CentOS 6,7, Debian, Ubuntu # 6 | # Description: One click Install UML for bbr+ssr # 7 | # Author: 91yun # 8 | # Thanks: @allient # 9 | # Intro: https://www.91yun.org/archives/2079 # 10 | #=================================================================# 11 | 12 | 13 | 14 | # Make sure only root can run our script 15 | if [[ $EUID -ne 0 ]]; then 16 | echo "Error:This script must be run as root!" 1>&2 17 | exit 1 18 | fi 19 | 20 | 21 | if [ -f /etc/redhat-release ]; then 22 | release="centos" 23 | elif cat /etc/issue | grep -Eqi "debian"; then 24 | release="debian" 25 | elif cat /etc/issue | grep -Eqi "ubuntu"; then 26 | release="ubuntu" 27 | elif cat /etc/issue | grep -Eqi "centos|red hat|redhat"; then 28 | release="centos" 29 | elif cat /proc/version | grep -Eqi "debian"; then 30 | release="debian" 31 | elif cat /proc/version | grep -Eqi "ubuntu"; then 32 | release="ubuntu" 33 | elif cat /proc/version | grep -Eqi "centos|red hat|redhat"; then 34 | release="centos" 35 | else 36 | echo "Not support OS, Please reinstall OS and retry!" 37 | exit 1 38 | fi 39 | 40 | function getversion(){ 41 | if [[ -s /etc/redhat-release ]];then 42 | grep -oE "[0-9.]+" /etc/redhat-release 43 | else 44 | grep -oE "[0-9.]+" /etc/issue 45 | fi 46 | } 47 | ver="" 48 | centosversion() { 49 | if [ "${release}" == "centos" ]; then 50 | local version="$(getversion)" 51 | local main_ver=${version%%.*} 52 | ver=$main_ver 53 | else 54 | return 1 55 | fi 56 | } 57 | centosversion 58 | if [[ "$release" = "centos" && "$ver" = "6" ]]; then 59 | wget -N --no-check-certificate https://raw.githubusercontent.com/91yun/uml/master/bbr/centos6-centos.sh && bash centos6-centos.sh 60 | elif [[ "$release" = "centos" && "$ver" = "7" ]]; then 61 | wget -N --no-check-certificate https://raw.githubusercontent.com/91yun/uml/master/bbr/centos7-centos.sh && bash centos7-centos.sh 62 | elif [[ "$release" = "ubuntu" ]]; then 63 | wget -N --no-check-certificate https://raw.githubusercontent.com/91yun/uml/master/bbr/ubuntu-centos.sh && bash ubuntu-centos.sh 64 | elif [[ "$release" = "debian" ]]; then 65 | wget -N --no-check-certificate https://raw.githubusercontent.com/91yun/uml/master/bbr/ubuntu-centos.sh && bash ubuntu-centos.sh 66 | fi -------------------------------------------------------------------------------- /bbr/uml.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin 3 | export PATH 4 | #=================================================================# 5 | # System Required: CentOS 6,7, Debian, Ubuntu # 6 | # Description: One click Install UML for bbr+ssr # 7 | # Author: 91yun # 8 | # Thanks: @allient # 9 | # Intro: https://www.91yun.org/archives/2079 # 10 | #=================================================================# 11 | 12 | 13 | 14 | # Make sure only root can run our script 15 | if [[ $EUID -ne 0 ]]; then 16 | echo "Error:This script must be run as root!" 1>&2 17 | exit 1 18 | fi 19 | 20 | 21 | if [ -f /etc/redhat-release ]; then 22 | release="centos" 23 | elif cat /etc/issue | grep -Eqi "debian"; then 24 | release="debian" 25 | elif cat /etc/issue | grep -Eqi "ubuntu"; then 26 | release="ubuntu" 27 | elif cat /etc/issue | grep -Eqi "centos|red hat|redhat"; then 28 | release="centos" 29 | elif cat /proc/version | grep -Eqi "debian"; then 30 | release="debian" 31 | elif cat /proc/version | grep -Eqi "ubuntu"; then 32 | release="ubuntu" 33 | elif cat /proc/version | grep -Eqi "centos|red hat|redhat"; then 34 | release="centos" 35 | else 36 | echo "Not support OS, Please reinstall OS and retry!" 37 | exit 1 38 | fi 39 | 40 | function getversion(){ 41 | if [[ -s /etc/redhat-release ]];then 42 | grep -oE "[0-9.]+" /etc/redhat-release 43 | else 44 | grep -oE "[0-9.]+" /etc/issue 45 | fi 46 | } 47 | ver="" 48 | centosversion() { 49 | if [ "${release}" == "centos" ]; then 50 | local version="$(getversion)" 51 | local main_ver=${version%%.*} 52 | ver=$main_ver 53 | else 54 | return 1 55 | fi 56 | } 57 | centosversion 58 | if [[ "$release" = "centos" && "$ver" = "6" ]]; then 59 | wget -N --no-check-certificate https://raw.githubusercontent.com/91yun/uml/master/bbr/centos6.sh && bash centos6.sh 60 | elif [[ "$release" = "centos" && "$ver" = "7" ]]; then 61 | wget -N --no-check-certificate https://raw.githubusercontent.com/91yun/uml/master/bbr/centos7.sh && bash centos7.sh 62 | elif [[ "$release" = "ubuntu" ]]; then 63 | wget -N --no-check-certificate https://raw.githubusercontent.com/91yun/uml/master/bbr/ubuntu.sh && bash ubuntu.sh 64 | elif [[ "$release" = "debian" ]]; then 65 | wget -N --no-check-certificate https://raw.githubusercontent.com/91yun/uml/master/bbr/ubuntu.sh && bash ubuntu.sh 66 | fi 67 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /lkl/install.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin 3 | export PATH 4 | #=================================================================# 5 | # System Required: CentOS ubuntu Debian # 6 | # Description: One click Install lkl # 7 | # Author: 91yun # 8 | # Thanks: @allient neko # 9 | # Intro: https://www.91yun.org # 10 | #=================================================================# 11 | 12 | if [[ $EUID -ne 0 ]]; then 13 | echo "Error:This script must be run as root!" 1>&2 14 | exit 1 15 | fi 16 | 17 | 18 | Get_Dist_Name() 19 | { 20 | if grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then 21 | release='CentOS' 22 | elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then 23 | release='Debian' 24 | elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then 25 | release='Ubuntu' 26 | else 27 | release='unknow' 28 | fi 29 | 30 | } 31 | Get_Dist_Name 32 | function getversion(){ 33 | if [[ -s /etc/redhat-release ]];then 34 | grep -oE "[0-9.]+" /etc/redhat-release 35 | else 36 | grep -oE "[0-9.]+" /etc/issue 37 | fi 38 | } 39 | ver="" 40 | CentOSversion() { 41 | if [ "${release}" == "CentOS" ]; then 42 | local version="$(getversion)" 43 | local main_ver=${version%%.*} 44 | ver=$main_ver 45 | else 46 | ver="$(getversion)" 47 | fi 48 | } 49 | CentOSversion 50 | Get_OS_Bit() 51 | { 52 | if [[ `getconf WORD_BIT` = '32' && `getconf LONG_BIT` = '64' ]] ; then 53 | bit='x64' 54 | else 55 | bit='x32' 56 | fi 57 | } 58 | Get_OS_Bit 59 | 60 | if [ "${release}" == "CentOS" ]; then 61 | yum install -y bc 62 | else 63 | apt-get update 64 | apt-get install -y bc 65 | fi 66 | 67 | iddver=`ldd --version | grep ldd | awk '{print $NF}'` 68 | dver=$(echo "$iddver < 2.14" | bc) 69 | if [ $dver -eq 1 ]; then 70 | ldd --version 71 | echo "idd的版本低于2.14,系统不支持。请尝试Centos7,Debian8,Ubuntu16" 72 | exit 1 73 | fi 74 | 75 | if [ "$bit" -ne "x64" ]; then 76 | echo "脚本目前只支持64bit系统" 77 | exit 1 78 | fi 79 | 80 | 81 | 82 | 83 | 84 | if [ "${release}" == "CentOS" ]; then 85 | yum install -y haproxy 86 | elif [[ "${release}" == "Debian" && "$ver" == "7" ]]; then 87 | echo "deb http://ftp.debian.org/debian wheezy-backports main" >> /etc/apt/sources.list 88 | apt-get install debian-archive-keyring 89 | apt-key update 90 | apt-get update 91 | apt-get install -y haproxy 92 | else 93 | apt-get update 94 | apt-get install -y haproxy 95 | fi 96 | 97 | mkdir /root/lkl 98 | cd /root/lkl 99 | cat > /root/lkl/haproxy.cfg<<-EOF 100 | global 101 | 102 | defaults 103 | log global 104 | mode tcp 105 | option dontlognull 106 | timeout connect 5000 107 | timeout client 50000 108 | timeout server 50000 109 | 110 | frontend proxy-in 111 | bind *:9000-9999 112 | default_backend proxy-out 113 | 114 | backend proxy-out 115 | server server1 10.0.0.1 maxconn 20480 116 | 117 | EOF 118 | 119 | wget --no-check-certificate http://soft.91yun.org/uml/lkl/liblkl-hijack.so 120 | 121 | cat > /root/lkl/lkl.sh<<-EOF 122 | LD_PRELOAD=/root/lkl/liblkl-hijack.so LKL_HIJACK_NET_QDISC="root|fq" LKL_HIJACK_SYSCTL="net.ipv4.tcp_congestion_control=bbr;net.ipv4.tcp_wmem=4096 16384 30000000" LKL_HIJACK_OFFLOAD="0x9983" LKL_HIJACK_NET_IFTYPE=tap LKL_HIJACK_NET_IFPARAMS=lkl-tap LKL_HIJACK_NET_IP=10.0.0.2 LKL_HIJACK_NET_NETMASK_LEN=24 LKL_HIJACK_NET_GATEWAY=10.0.0.1 haproxy -f /root/lkl/haproxy.cfg 123 | EOF 124 | 125 | 126 | 127 | cat > /root/lkl/run.sh<<-EOF 128 | ip tuntap add lkl-tap mode tap 129 | ip addr add 10.0.0.1/24 dev lkl-tap 130 | ip link set lkl-tap up 131 | sysctl -w net.ipv4.ip_forward=1 132 | iptables -P FORWARD ACCEPT 133 | iptables -t nat -A POSTROUTING -o venet0 -j MASQUERADE 134 | iptables -t nat -A PREROUTING -i venet0 -p tcp --dport 9000:9999 -j DNAT --to-destination 10.0.0.2 135 | 136 | nohup /root/lkl/lkl.sh & 137 | 138 | p=\`ping 10.0.0.2 -c 3 | grep ttl\` 139 | if [ \$? -ne 0 ]; then 140 | echo "success "\$(date '+%Y-%m-%d %H:%M:%S') > /root/lkl/log.log 141 | else 142 | echo "fail "\$(date '+%Y-%m-%d %H:%M:%S') > /root/lkl/log.log 143 | fi 144 | 145 | EOF 146 | 147 | 148 | chmod +x lkl.sh 149 | chmod +x run.sh 150 | 151 | #写入自动启动 152 | if [[ "$release" = "CentOS" && "$ver" = "7" ]]; then 153 | echo "/root/lkl/run.sh" >> /etc/rc.d/rc.local 154 | chmod +x /etc/rc.d/rc.local 155 | else 156 | sed -i "s/exit 0/ /ig" /etc/rc.local 157 | echo "/root/lkl/run.sh" >> /etc/rc.local 158 | fi 159 | 160 | 161 | ./run.sh 162 | 163 | #判断是否启动 164 | p=`ping 10.0.0.2 -c 3 | grep ttl` 165 | if [ "$p" == "" ]; then 166 | echo "fail" 167 | else 168 | echo "success" 169 | fi -------------------------------------------------------------------------------- /uml.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin 3 | export PATH 4 | #=================================================================# 5 | # System Required: CentOS 6,7, Debian, Ubuntu # 6 | # Description: One click Install UML for bbr+ssr # 7 | # Author: 91yun # 8 | # Thanks: @allient # 9 | # Intro: https://www.91yun.org/archives/2079 # 10 | #=================================================================# 11 | 12 | 13 | 14 | # Make sure only root can run our script 15 | if [[ $EUID -ne 0 ]]; then 16 | echo "Error:This script must be run as root!" 1>&2 17 | exit 1 18 | fi 19 | 20 | 21 | if [ -f /etc/redhat-release ]; then 22 | release="centos" 23 | elif cat /etc/issue | grep -Eqi "debian"; then 24 | release="debian" 25 | elif cat /etc/issue | grep -Eqi "ubuntu"; then 26 | release="ubuntu" 27 | elif cat /etc/issue | grep -Eqi "centos|red hat|redhat"; then 28 | release="centos" 29 | elif cat /proc/version | grep -Eqi "debian"; then 30 | release="debian" 31 | elif cat /proc/version | grep -Eqi "ubuntu"; then 32 | release="ubuntu" 33 | elif cat /proc/version | grep -Eqi "centos|red hat|redhat"; then 34 | release="centos" 35 | else 36 | echo "Not support OS, Please reinstall OS and retry!" 37 | exit 1 38 | fi 39 | 40 | function getversion(){ 41 | if [[ -s /etc/redhat-release ]];then 42 | grep -oE "[0-9.]+" /etc/redhat-release 43 | else 44 | grep -oE "[0-9.]+" /etc/issue 45 | fi 46 | } 47 | ver="" 48 | centosversion() { 49 | if [ "${release}" == "centos" ]; then 50 | local version="$(getversion)" 51 | local main_ver=${version%%.*} 52 | ver=$main_ver 53 | else 54 | return 1 55 | fi 56 | } 57 | centosversion 58 | if [[ "$release" = "centos" && "$ver" = "6" ]]; then 59 | wget -N --no-check-certificate https://raw.githubusercontent.com/91yun/uml/master/bbr/centos6.sh && bash centos6.sh 60 | fi 61 | 62 | 63 | 64 | 65 | 66 | 67 | --------------------------------------------------------------------------------