English
Server on a VPS
First config with Hysteria 2 as a fallback: VLESS with REALITY on 443/tcp and Hysteria 2 on 443/udp. Hysteria 2 runs over QUIC and is faster on lossy networks, but it needs a certificate for your own domain. The client tries REALITY and falls back to Hysteria 2 if REALITY does not answer.
You need: a VPS with Linux, a domain vpn.example.com pointing to it (for Hysteria 2 only), and a certificate for that domain, for example from Let's Encrypt (certbot certonly --standalone -d vpn.example.com).
Keys
REALITY keys as in First config, plus a password for Hysteria 2:
sh
ours generate rand 16 --base64Pick the REALITY handshake.server so that it is not blocked in the client's network and is close to the VPS.
Server
/etc/ours/config.yaml:
yaml
log:
level: info
inbounds:
vless-in:
vless:
listen: ":443"
users:
- name: alice
uuid: 88a58c49-bc95-4797-835b-883e345536d5
flow: xtls-rprx-vision
tls:
sni: www.example.com
reality:
handshake:
server: www.example.com:443
private_key: gDYKEVP_HyaNvNgoRnAUMw7XBbTY9YPyFjJVuGcNm34
short_id: [2c97154e0c1ce004]
hy2-in:
hysteria2:
listen: ":443"
users:
- name: alice
password: UL7HLbpgC79KYDw2Bkt1AA==
masquerade: https://www.example.com/
tls:
certificate_path: /etc/ours/cert.pem
key_path: /etc/ours/key.pem
outbounds:
direct:
direct:
route:
rules:
- match:
ip_is_private: true
to: block
final:
outbound: direct- Both inbounds are on
:443: VLESS listens on TCP, Hysteria 2 on UDP, they do not get in each other's way. - The rule with
ip_is_privatekeeps clients from reaching the server's local network and127.0.0.1through it. masqueradeis what Hysteria 2 answers to an ordinary browser that comes tohttps://vpn.example.comover HTTP/3: here, the content of someone else's site.- Users can be added as a list;
namegoes into the log and the dashboard.
Let's Encrypt certificates are in /etc/letsencrypt/live/vpn.example.com/fullchain.pem and privkey.pem: point to these paths or copy the files. The files are reread when they change, so renewing the certificate needs no restart.
Check, then run as a service (the unit is in Installation):
sh
ours check -c /etc/ours/config.yaml
sudo systemctl enable --now oursOpen 443/tcp and 443/udp in the VPS firewall.
Client
yaml
inbounds:
local:
mixed:
listen: 127.0.0.1:1080
outbounds:
reality:
vless:
server: vpn.example.com:443
uuid: 88a58c49-bc95-4797-835b-883e345536d5
flow: xtls-rprx-vision
tls:
sni: www.example.com
utls:
fingerprint: chrome
reality:
public_key: 7r2W5J3jxGzHWeG2i3PcD3w9hZNkQzrCiyyCgWn4LTc
short_id: 2c97154e0c1ce004
hy2:
hysteria2:
server: vpn.example.com:443
password: UL7HLbpgC79KYDw2Bkt1AA==
tls:
sni: vpn.example.com
direct:
direct:
groups:
proxy:
members: [reality, hy2]
rank: order
route:
rules:
- match:
ip_is_private: true
to:
outbound: direct
final:
group: proxyrank: orderis the first member that answers the probes: REALITY, and if it is unavailable, Hysteria 2 (groups).- REALITY's
sniis the same third-party site as on the server; Hysteria 2's is your domain.
Check from the client:
sh
ours run -c client.yaml
curl -x socks5h://127.0.0.1:1080 https://www.example.com/If connections do not go through, see Troubleshooting.