这是一个魔法文章

这是魔法的力量

1.环境准备

一个好用的脑子,一台有网的电脑,一个云服务器(ecs),远程连接工具(CRT、Xshell)

2.连接服务器

在云计算产品控制台中,找到公网IP地址,使用远程连接工具进行连接

3.环境准备

安装需要的软件包

1
[root@lee ~]# yum install zip unzip wget -y

拿到安装脚本

1
[root@lee ~]# wget https://install.direct/go.sh

上传加速插件bbr的脚本

1

赋予执行权限

1
[root@lee ~]# chmod u+x go.sh bbr.sh

4.开始安装

执行安装脚本go.sh

1
[root@lee ~]# ./root/go.sh

保存执行结果

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[root@lee ~]# ./root/go.sh
Installing V2Ray v4.23.1 on x86_64
Downloading V2Ray: https://github.com/v2ray/v2ray-core/releases/download/v4.23.1/v2ray-linux-64.zip
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 629 100 629 0 0 651 0 --:--:-- --:--:-- --:--:-- 651
100 11.6M 100 11.6M 0 0 2563k 0 0:00:04 0:00:04 --:--:-- 4281k
Archive: /tmp/v2ray/v2ray.zip
inflating: /usr/bin/v2ray/geoip.dat
inflating: /usr/bin/v2ray/geosite.dat
inflating: /usr/bin/v2ray/v2ctl
inflating: /usr/bin/v2ray/v2ray
PORT:xxxxx #连接的端口
UUIDxxxxx-xxxxx-xxxx-xxxx-xxxx #连接的用户ID
Archive: /tmp/v2ray/v2ray.zip
inflating: /etc/systemd/system/v2ray.service
Created symlink from /etc/systemd/system/multi-user.target.wants/v2ray.service to /etc/systemd/system/v2ray.service.
V2Ray v4.23.1 is installed.

5.安装加速插件

执行安装脚本bbr

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[root@lee ~]# ./root/bbr.sh
---------- System Information ----------
OS : CentOS 7.6.1810
Arch : x86_64 (64 Bit)
Kernel : 5.6.13-1.el7.elrepo.x86_64
----------------------------------------
Auto install latest kernel for TCP BBR

URL: https://teddysun.com/489.html
----------------------------------------

Press any key to start...or Press Ctrl+C to cancel #按回车继续

...
...
...

执行完需要重启

6.启动服务

1
[root@lee ~]# systemctl start v2ray
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[root@lee ~]# systemctl status v2ray 
● v2ray.service - V2Ray - A unified platform for anti-censorship
Loaded: loaded (/etc/systemd/system/v2ray.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2020-05-19 21:34:53 CST; 1 day 22h ago
Docs: https://v2ray.com
https://guide.v2fly.org
Main PID: 938 (v2ray)
CGroup: /system.slice/v2ray.service
└─938 /usr/bin/v2ray/v2ray -config /etc/v2ray/config.json

May 19 21:34:53 lee systemd[1]: Started V2Ray - A unified platform for anti-censorship.
May 19 21:34:53 lee v2ray[938]: V2Ray 4.23.1 (V2Fly, a community-driven edition of V2Ray.) Custo...md64)
May 19 21:34:53 lee v2ray[938]: A unified platform for anti-censorship.
May 19 21:34:54 lee v2ray[938]: 2020/05/19 21:34:54 [Info] v2ray.com/core/common/platform/ctlcmd...sage>
May 19 21:34:54 lee v2ray[938]: v2ctl> Read config: /etc/v2ray/config.json
May 19 21:34:54 lee v2ray[938]: 2020/05/19 21:34:54 [Warning] v2ray.com/core: V2Ray 4.23.1 started
Hint: Some lines were ellipsized, use -l to show in full.

查看端口是否运行

1
2
[root@lee ~]# netstat -ntlp |grep v2ray 
tcp6 0 0 :::xxxxx(此处会显示运行的端口) :::* LISTEN 938/v2ray

查看bbr是否运行

1
2
[root@lee ~]# lsmod | grep bbr 
tcp_bbr 20480 7 #有显示带bbr字样的内容则成功安装

7.安全组设置

华为云示例:

设置安全组,点击ecs名称

BP

选择安全组

BP

点开安全组,选择更改规则

BP

在入口方向进行设置

BP

选择一键放通

BP

再添加一条手动规则

BP

在出口方向也一键放通

BP

9.连接V2ray

使用v2rayN-Core连接服务器

点击服务器,然后选择添加VMess服务器

BP

填写相关参数

BP

例:

BP

在电脑任务栏中找到v2ray的图标右键选择服务器,选择自己的服务器节点,在httpd代理中选择开启PAC,即可体验魔法的力量

PAC是智能代理,国内流量走本地网络,国内访问不到的网络自动走服务器网络

开启http代理(全局),是全部流量都走服务器

更多

相关信息可以在/etc/v2ray/config.json中查看

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{
"inbounds": [{
"port": xxxxx, #端口号
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "xxx-xxx-xxx-xxx-xxx", #UUID,就是用户ID
"level": 1,
"alterId": 64 #额外ID
}
]
}
}],
"outbounds": [{
"protocol": "freedom",
"settings": {}
},{
"protocol": "blackhole",
"settings": {},
"tag": "blocked"
}],
"routing": {
"rules": [
{
"type": "field",
"ip": ["geoip:private"],
"outboundTag": "blocked"
}
]
}
}

可以在该配置文件中配置多用户多端口,实现多人连接。但是要注意语法,错误会导致服务起不了,修改之前做好备份。