甲骨文的安全组要开放,这里略去

本次环境

  • 春川arm4C
  • ubuntu 20.04

关闭甲骨文的防火墙

使用脚本一键关闭

bash <(curl -Lsk https://raw.githubusercontent.com/n0thing2speak/speedtest-go-arm/master/fuckiptables.sh)

安装hysteria

注意,我这里用的是arm64的架构,amd的要去下载对应架构的elf文件,去hysteria的release自己复制对应的链接

killall hysteria

wget -qO /usr/local/bin/hysteria https://github.com/HyNetwork/hysteria/releases/download/v0.9.6/hysteria-linux-arm64

安装xray,用来自签证书,记得也要下对应架构的

wget https://github.com/XTLS/Xray-core/releases/download/v1.5.3/Xray-linux-arm64-v8a.zip

unzip Xray-linux-arm64-v8a.zip
cp xray /usr/local/bin/xray

设置权限

chmod +x /usr/local/bin/{hysteria,xray}

查看一下是否设置正确了

root@debian:~# xray --version
Xray 1.5.3 (Xray, Penetrates Everything.) Custom (go1.17.6 linux/arm64)
A unified platform for anti-censorship.
root@debian:~# hysteria --version
Hysteria version v0.9.6 2022-02-04T05:46:56.416Z 03a1bf1dd8b8ae587e30e85ae97e5fc3b58720c8

对udp buffer进行优化

sysctl -w net.core.rmem_max=4000000

自签一个证书

mkdir -p /etc/hysteria
xray tls cert --ca \
--domain="cdn" \
--name="CDN Inc" \
--org="CDN Inc" \
--expire=876000h \
--file=/etc/hysteria/ \
--json=false

进入到/etc/hysteria可以查看到已经生成的证书。

生成配置文件config.json

cat <<EOF > /etc/hysteria/config.json
{
  "listen": ":8553",
  "cert": "/etc/hysteria/_cert.pem",
  "key": "/etc/hysteria/_key.pem",
  "obfs": "gogoxxx",
  "up_mbps": 100,
  "down_mbps": 1000,
  "auth": {
    "mode": "passwords",
    "config": ["gogoxxx"]
  },
  "alpn": "ayaya", 
  "recv_window_conn": 15728640, 
  "recv_window_client": 67108864,
  "max_conn_client": 4096, 
}
EOF

8553是udp的端口。

添加一个系统服务

vim /etc/systemd/system/hysteria.service

输入以下内容

[Unit]
Description=The hysteria Proxy Serve
After=network-online.target

[Service]
ExecStart=/usr/local/bin/hysteria --log-level panic -c /etc/hysteria/config.json server
ExecStop=/bin/kill -s QUIT $MAINPID
Restart=1
RestartSec=15s

[Install]
WantedBy=multi-user.target

systemctl daemon-reload

运行

hysteria -c /etc/hysteria/config.json server

先运行一下是不是正确

如果正确的话运行

systemctl enable hysteria
systemctl start hysteria

查看运行状态
systemctl status hysteria
停止运行:
systemctl stop hysteria

或者你不像用service,用下面的命令也行

nohup hysteria -c /etc/hysteria/serve.json server > /dev/null 2>&1 &

配置URL的设置

具体可以看URI-Scheme的定义

如果按照我的那个配置,替换下面的ip和端口就行了

hysteria://你的IP:端口?protocol=udp&auth=gogoxxx&insecure=1&upmbps=100&downmbps=1000&alpn=ayaya&obfs=xplus&obfsParam=gogoxxx#我的hy

客户端的设置

ios的shadowrocket的设置