购买云主机
开放所有tcp端口
配置云主机
powershell
https://mirrors.tuna.tsinghua.edu.cn/elrepo/kernel/el8/x86_64/
选择清华镜像源
[root@iZbp141m9g3iwgwsmh7pvzZ yum.repos.d]# cat >> /etc/yum.repos.d/elrepo.repo << q
[elrepo]
name=elrepo
gpgcheck=0
baseurl=https://mirrors.tuna.tsinghua.edu.cn/elrepo/kernel/el8/x86_64/
enabled=1
q
[root@iZbp141m9g3iwgwsmh7pvzZ yum.repos.d]# yum --disablerepo="*" --enablerepo="elrepo" list available
显示列表里出现kernel-ml则成功
[root@iZbp141m9g3iwgwsmh7pvzZ yum.repos.d]# yum --enablerepo=elrepo install -y kernel-ml
kernel-ml 提供最新的内核特性、硬件支持和性能优化,适合需要最新技术或硬件的用户。它还包含最新的安全修复,但在生产环境使用时需谨慎评估稳定性。
配置刚下载的内核为自启动内核
powershell
vim /etc/default/grub
#打开并编辑 /etc/default/grub 并设置 GRUB_DEFAULT=0。
grub2-mkconfig -o /boot/grub2/grub.cfg
查看内核是否成功更新
powershell
[root@iZbp141m9g3iwgwsmh7pvzZ yum.repos.d]# uname -ra
Linux iZbp141m9g3iwgwsmh7pvzZ 4.18.0-193.28.1.el8_2.x86_64 #1 SMP Thu Oct 22 00:20:22 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
[root@iZbp141m9g3iwgwsmh7pvzZ yum.repos.d]# reboot
Connection closing...Socket close.
Connection closed by foreign host.
Disconnected from remote host(121.40.22.65:22) at 15:45:19.
Type `help' to learn how to use Xshell prompt.
[C:\~]$
Connecting to 121.40.22.65:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
WARNING! The remote SSH server rejected X11 forwarding request.
Welcome to Alibaba Cloud Elastic Compute Service !
Activate the web console with: systemctl enable --now cockpit.socket
Last login: Sat Oct 12 15:36:53 2024 from 27.19.125.208
[root@iZbp141m9g3iwgwsmh7pvzZ ~]# uname -ra
Linux iZbp141m9g3iwgwsmh7pvzZ 6.11.3-1.el8.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Oct 10 16:17:06 EDT 2024 x86_64 x86_64 x86_64 GNU/Linux
[root@iZbp141m9g3iwgwsmh7pvzZ ~]#
设置bbr加速
powershell
[root@iZbp141m9g3iwgwsmh7pvzZ ~]# echo "net.core.default_qdisc = fq">>/etc/sysctl.conf
[root@iZbp141m9g3iwgwsmh7pvzZ ~]# echo "net.ipv4.tcp_congestion_control = bbr">>/etc/sysctl.conf
[root@iZbp141m9g3iwgwsmh7pvzZ ~]# sysctl -p
vm.swappiness = 0
kernel.sysrq = 1
net.ipv4.neigh.default.gc_stale_time = 120
net.ipv4.conf.all.rp_filter = 0
net.ipv4.conf.default.rp_filter = 0
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf.lo.arp_announce = 2
net.ipv4.conf.all.arp_announce = 2
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_syn_backlog = 1024
net.ipv4.tcp_synack_retries = 2
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr
[root@iZbp141m9g3iwgwsmh7pvzZ ~]# lsmod | grep bbr
tcp_bbr 20480 1
[root@iZbp141m9g3iwgwsmh7pvzZ ~]#
启用 BBR 对代理转发场景通常能带来带宽利用率和延迟方面的优化,整体传输性能会有所提升。
安装gost
powershell
wget -c https://github.com/ginuerzh/gost/releases/download/v2.11.4/gost-linux-amd64-2.11.4.gz
gzip -d gost-linux-amd64-2.11.4.gz
chmod +x gost-linux-amd64-2.11.4
mv gost-linux-amd64-2.11.4 /usr/bin/gost
配置gost开机自启动
powershell
vim /etc/init.d/gost
#add for chkconfig
#chkconfig: 2345 70 30
#description: the description of the shell
#processname: usergost
su usa001a -c "nohup gost -L=usa001a:Wdx9527.xx@172.16.162.226:20001?ttl=60s &>/dev/null &"
#增加账号
useradd usa001a -u 1010 -M
编辑开机启动相关文件,增加以下行
vim /etc/rc.local
#设置Gost开机自启动
/etc/init.d/gost
#保存退出
chmod a+x /etc/rc.local
#重启后使用ps查看进程是否自启动
ps -aux | grep gost
usa001a 945 1.1 1.3 732300 25708 ? Sl 15:59 0:00 gost -L=usa001a:Wdx9527.xx@172.16.162.226:20001?ttl=60s
root 1035 0.0 0.1 12112 2124 pts/0 S+ 15:59 0:00 grep --color=auto gost
[root@iZbp141m9g3iwgwsmh7pvzZ ~]#
启动或停止gost
/etc/init.d/gost 启动gost中继程序
kill `pidof gost` 停止gost中继程序
powershell
应用类型 来源 协议 端口 策略
ALL 0.0.0.0/0 ALL ALL 允许
配置proxifier
否 - 否
添加代理规则
成功