前言

1.目前伪装最好的两种协议,一个代表tcp协议(reality)的目前巅峰,一个新型UDP协议(hysteria2)的宠儿。
2.这次用的sing-box搭建 https://sing-box.sagernet.org/zh 因为简单。之前一直用八合一,最大的问题就是各种伪装后,机器就只能拿来科学上网了,因为安装Nginx,搭建个网页啥的都很麻烦。
3.教程亮点,无需自备域名。
3.passwall发现没有类似的设置教程,所以出一个。

安装sing-box

直接安装预发布版(支持hysteria2)

1
bash -c "$(curl -L https://sing-box.vercel.app)" @ install --beta

如何需要卸载

1
bash -c "$(curl -L https://sing-box.vercel.app)" @ remove

等会用得到的指令
重启

1
systemctl restart sing-box

状态

1
systemctl status sing-box

实时日志

1
journalctl -u sing-box -o cat -f

服务端vps搭建

自签证书申请,这里申请的是bing.com,申请了10年,可以用到你vps商家跑路了

1
mkdir -p /etc/hysteria && openssl ecparam -genkey -name prime256v1 -out /etc/hysteria/private.key && openssl req -new -x509 -days 3650 -key /etc/hysteria/private.key -out /etc/hysteria/cert.pem -subj "/CN=bing.com"

搭建组合选择
参考网站 https://github.com/chika0801/sing-box-examples 后期可以根据需求自由组合
为什么选择reality和hysteria2
1.reality目前是TCP协议里面号称最安全的
2.hysteria2作者是最用心的,教程写得很清楚 https://v2.hysteria.network/zh/
开始
编辑confing文件

1
nano /usr/local/etc/sing-box/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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{
"inbounds": [
{
"type": "hysteria2",
"listen": "::",
"listen_port": 8443,
"users": [
{
"password": "" //你的密码
}
],
"masquerade": "https://bing.com",
"tls": {
"enabled": true,
"alpn": [
"h3"
],
"certificate_path": "/etc/hysteria/cert.pem",
"key_path": "/etc/hysteria/private.key"
}
},
{
"type": "vless",
"listen": "::",
"listen_port": 443,
"users": [
{
"uuid": "", //vps上执行sing-box generate uuid
"flow": "xtls-rprx-vision"
}
],
"tls": {
"enabled": true,
"server_name": "www.tesla.com",
"reality": {
"enabled": true,
"handshake": {
"server": "www.tesla.com",
"server_port": 443
},
"private_key": "", //vps上执行sing-box generate reality-keypair
"short_id": [
"0123456789abcdef"// 0到f,长度为2的倍数,长度上限为16,默认这个也可以
]
}
}
}
],
"outbounds": [
{
"type": "direct"
}
]
}

然后重启

1
systemctl restart sing-box

再查看日志

1
journalctl -u sing-box -o cat -f

没问题就OK拉,开始导入passwall了因为申请的是自签证书,所有设置,都是开启允许不安全连接

hysteria2客户端配置文件

客户端配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
server: ip:443
auth: 123456

bandwidth:
up: 20 mbps
down: 100 mbps

tls:
sni: a.com
insecure: false #使用自签域名时需要改成true

socks5:
listen: 127.0.0.1:1080
http:
listen: 127.0.0.1:8080

sing-box配置文件(Android/IOS)

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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
{
"dns": {
"servers": [
{
"tag": "cf",
"address": "https://1.1.1.1/dns-query"
},
{
"tag": "local",
"address": "223.5.5.5",
"detour": "direct"
},
{
"tag": "block",
"address": "rcode://success"
}
],
"rules": [
{
"geosite": "category-ads-all",
"server": "block",
"disable_cache": true
},
{
"outbound": "any",
"server": "local"
},
{
"geosite": "cn",
"server": "local"
}
],
"strategy": "ipv4_only"
},
"inbounds": [
{
"type": "tun",
"inet4_address": "172.19.0.1/30",
"auto_route": true,
"strict_route": false,
"sniff": true
}
],
"outbounds": [
{
"type": "hysteria2",
"tag": "proxy",
"server": "这里填ip",
"server_port": 443,
"up_mbps": 20,
"down_mbps": 100,
"password": "这里填密码",
"tls": {
"enabled": true,
"server_name": "a.com",
"insecure": false
}
},
{
"type": "direct",
"tag": "direct"
},
{
"type": "block",
"tag": "block"
},
{
"type": "dns",
"tag": "dns-out"
}
],
"route": {
"rules": [
{
"protocol": "dns",
"outbound": "dns-out"
},
{
"geosite": "cn",
"geoip": [
"private",
"cn"
],
"outbound": "direct"
},
{
"geosite": "category-ads-all",
"outbound": "block"
}
],
"auto_detect_interface": true
}
}

相关链接

客户端下载

v2rayN 下载:https://github.com/2dust/v2rayN/releases/latest
Hysteria 2下载:https://github.com/apernet/hysteria/releases
Hysteria 2文档:https://v2.hysteria.network/zh/
sing-box文档:https://sing-box.sagernet.org/zh/
Android客户端(SFA):https://install.appcenter.ms/users/nekohasekai/apps/sfa/distribution_groups/publictest
IOS客户端(TestFlight):https://testflight.apple.com/join/AcqO44FH (1.5.0 beta版支持Hysteria 2)
IOS客户端(AppStore):https://apps.apple.com/us/app/sing-box/id6451272673 (暂不支持Hysteria 2)

视频教程参考

2023年最安全协议hysteria2和reality同时搭建 | 无需自备域名 | passwall设置hysteria2方法:https://youtu.be/S0jSGOdeTs4?si=w4vYPa44zIoQ4zHv

【遥遥领先】黑科技!垃圾VPS线路网速大幅提升!第二代hysteria节点搭建教程,歇斯底里为什么可以提升网速?windows/ios/android手机移动端使用方式,sing-box配置hy2方式:https://youtu.be/CXj-ID33MhU?si=bgcrlIpW5BwOc9uL

文档参考

视频1:https://ybfl.xyz/sites/283.html

视频2:https://bulianglin.com/archives/hysteria2.html