#!/bin/bash
rm ./start.sh -rf
yum remove kernel-headers -y
rpm -ivh http://soft.shaobing.hk/CentOS/kernel/kernel-ml-headers-4.12.10-1.el6.elrepo.x86_64.rpm 
rpm -ivh http://soft.shaobing.hk/CentOS/kernel/kernel-ml-devel-4.12.10-1.el6.elrepo.x86_64.rpm
yum install -y make gcc
wget -O ./tcp_tsunami.c http://soft.shaobing.hk/CentOS/kernel/tcp_tsunami.c
echo "obj-m:=tcp_tsunami.o" > Makefile
make -C /lib/modules/$(uname -r)/build M=`pwd` modules CC=/usr/bin/gcc
chmod +x ./tcp_tsunami.ko
cp -rf ./tcp_tsunami.ko /lib/modules/$(uname -r)/kernel/net/ipv4
insmod tcp_tsunami.ko
depmod -a
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=tsunami" >> /etc/sysctl.conf
rm ./tcp_tsunami.c -rf
sysctl -p
reboot
