学校不让拉宽带,校园网流量又贵,才出此下策

参考教程 零基础教程 | 拥抱IPv6,30分钟实现校园网免流量和翻墙

原理:校园网IPV4流量计费,IPV6不计费。

VPS准备

以下以Google cloud为例

创建子网

文档 https://cloud.google.com/vpc/docs/create-modify-vpc-networks?hl=zh-cn#subnet-enable-ipv6

双栈子网同时具有 IPv4 和 IPv6 地址范围。

  1. 在 Google Cloud 控制台中,进入 VPC 网络页面。

    进入 VPC 网络页面

  2. 点击某个 VPC 网络的名称以显示其 VPC 网络详情页面。

  3. 点击添加子网。在显示的面板中:

    1. 提供名称

    2. 选择区域

    3. 对于 IP 栈类型,请选择 IPv4 和 IPv6(双栈)

    4. 输入 IPv4 范围。这是子网的主要 IPv4 范围

      如果您选择的范围不是 RFC 1918 地址,请确认该范围与现有配置不冲突。如需了解详情,请参阅 IPv4 子网范围

    5. 选择 IPv6 访问权限类型内部外部

      如果您要将访问权限类型设置为内部,但内部选项不可用,请检查是否为网络分配了内部 IPv6 范围

    6. 点击添加

务必在防火墙规则设置中打开相应端口,比如ssh连接是tcp 端口22。

创建虚拟机

配置选最垃圾的也能用

主要是在高级选项-网络中选择之前创建的子网,IP 栈类型选择双栈。(子网的地域要和vps的地狱匹配)

image-20240731004233631

image-20240731004516715

配置防火墙

主要是端口号

https://cloud.google.com/firewall/docs/firewalls?hl=zh-cn

配置Xray

x-ui的端口不要和节点入站端口重了

安装x-ui

临时root 用户 sudo -i

1
2
# 中文版
bash <(curl -Ls https://raw.githubusercontent.com/FranzKafkaYu/x-ui/master/install.sh)
1
2
# for English users
bash <(curl -Ls https://raw.githubusercontent.com/FranzKafkaYu/x-ui/master/install_en.sh)

if the command doesn’t work try this break-up version instead.

1
2
3
4
5
6
7
8
# change the working directory
cd ~
# Download the script
curl -L https://raw.githubusercontent.com/FranzKafkaYu/x-ui/master/install.sh > install.sh
# add executive authority
sudo chmod +x install.sh
# run
sudo ./install.sh

If it goes properly, you may asked to set up a password and username, and then the x-ui interface is set.

To check the configuration of x-ui:

1
sudo x-ui

You will see:

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
  x-ui 面板管理脚本
0. 退出脚本
————————————————
1. 安装 x-ui
2. 更新 x-ui
3. 卸载 x-ui
————————————————
4. 重置用户名密码
5. 重置面板设置
6. 设置面板端口
7. 查看当前面板信息
————————————————
8. 启动 x-ui
9. 停止 x-ui
10. 重启 x-ui
11. 查看 x-ui 状态
12. 查看 x-ui 日志
————————————————
13. 设置 x-ui 开机自启
14. 取消 x-ui 开机自启
————————————————
15. 一键安装 bbr (最新内核)
16. 一键申请SSL证书(acme申请)
17. 配置x-ui定时任务

面板状态: 已运行
是否开机自启: 是
xray 状态: 运行
请输入选择 [0-17],查看面板登录信息请输入数字:

Type:

1
7

You will see:

1
2
3
4
5
6
[INF] 当前面板信息[current panel info]:
面板版本[version]: 0.3.4.4:20230717
用户名[username]: XXXXX #remember it!
密码[userpasswd]: XXXXXXX #remember it!
监听端口[port]: XXXXX #remember it
根路径[basePath]: /XXXX/ #remember it

登录x-ui

记得在防火墙开放设置的端口号

  1. Go to the browser and type in the address block:
1
http://[YOUR_IPV6_ADDRESS]:port/basePath/

For example my IPv6 address is 2600:1900:1134:268:: , my port is 12345, my basePath is /hp23/, then I should type:

1
http://[2600:1900:1134:268::]:12345/hp23/

在入站列表添加节点,然后Window下载V2rayN连接节点就可以用啦

Turn on the BBR accelerator (Optional)

BBR is a TCP congestion control algorithm designed by Google researchers and built for the congestion of the modern internet, it can boost your network speed.

Method 1

1
2
3
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
sysctl -p

Method 2

1
wget -N --no-check-certificate "https://raw.githubusercontent.com/chiakge/Linux-NetSpeed/master/tcp.sh" && chmod +x tcp.sh && ./tcp.sh