谷歌云vps上搭建hysteria节点

1. 通过浏览器,点击ssh连接

2. 切换root

1
sudo -i

3. 设置PasswordAuthentication为yes

去掉前面的#号(如果有的话)

1
vim /etc/ssh/sshd_config

修改以下内容:

1
2
PasswordAuthentication yes
ChallengeResponseAuthentication yes # 部分机器需要配置为yes

4. 重启ssh服务

1
sudo systemctl restart ssh

5. 修改登录账号的密码

例如我的登录账号是ubuntu

1
passwd ubuntu

6. 安装hysteria

1
bash <(curl -fsSL https://get.hy2.sh/)

7. 配置hysteria

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# listen: :443
acme:
domains:
- 你的域名
email: [email protected]

auth:
type: password
password: 设置你的密码

masquerade:
type: proxy
proxy:
url: https://news.ycombinator.com/
rewriteHost: true

8. 操作hysteria

启动hysteria

1
systemctl start hysteria-server.service

重启hysteria

1
systemctl restart hysteria-server.service

查看状态

1
systemctl status hysteria-server.service

9. 客户端配置模板

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
server:
你的域名:443
auth:
你的密码

bandwidth:
up: 20 mbps
down: 60 mbps

tls:
sni: 你的域名
insecure: false # 使用自签时需要改成true

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

10. 手机客户端配置文件

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": "你的对应服务器的域名",
"server_port": 443,
"up_mbps": 20,
"down_mbps": 200,
"password": "密码",
"tls": {
"enabled": true,
"server_name": "你的对应服务器的域名",
"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
}
}