Home About Me

Getting Started with Hysteria: Current Setup and a Legacy v1 Example

Hysteria is a network tool built for difficult connection conditions and optimized for two-way acceleration. It is designed for situations such as satellite links, congested public Wi-Fi, or connecting from China to overseas servers. Its transport is based on a modified QUIC protocol.

It supports a fairly broad set of proxy and forwarding modes:

  • SOCKS5 proxy (TCP & UDP)
  • HTTP/HTTPS proxy
  • TCP/UDP forwarding
  • TCP/UDP TPROXY transparent proxy on Linux
  • TCP REDIRECT transparent proxy on Linux
  • TUN, or TAP on Windows

The project is available at:

https://github.com/HyNetwork/hysteria

Hysteria 2 basic example

A quick installation can be done with:

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

A minimal client configuration might look like this:

## config.yaml
server: your.domain.net:443
auth: Se7RAuFZ8Lzg
bandwidth:
  up: 20 mbps
  down: 100 mbps
socks5:
  listen: 127.0.0.1:1080
http:
  listen: 127.0.0.1:8080
tls:
  insecure: true

This example points the client to your.domain.net:443, defines an authentication string, sets upstream and downstream bandwidth values, and enables both SOCKS5 and HTTP local proxy ports. The TLS section is configured with insecure: true, which matches the example shown above.


Legacy Hysteria v1 example

The following is an older v1 deployment example.

Server installation and configuration

The server in this example runs Debian 11. Installation is done with:

wget https://raw.githubusercontent.com/HyNetwork/hysteria/master/install_server.sh
bash ./install_server.sh

Enable and start the service:

systemctl enable hysteria-server
systemctl start hysteria-server

Generate a self-signed certificate

Use OpenSSL to create a private key and certificate:

openssl genrsa -out server.key 1024
openssl req -new -x509 -days 3650 -key server.key -out server.crt -subj "/C=CN/ST=mykey/L=mykey/O=mykey/OU=mykey/CN=domain1/CN=domain2/CN=domain3"

Then create a configuration file named config.json:

{
  "listen": ":39870",
  "cert": "/root/server.crt",
  "key": "/root/server.key",
  "obfs": "fuckgfw2022",
  "up_mbps": 500,
  "down_mbps": 500
}

This configuration listens on port 39870, uses the generated certificate and key, sets an obfuscation string, and assigns both upstream and downstream bandwidth to 500 Mbps.

To keep Hysteria running in the background, start it inside screen:

screen hysteria -c config.json server

If no error message appears, the server is considered to be running normally.

Using it with the V2rayN client

On Windows, the client can be set up through V2rayN.

First, download the Windows executable from the Hysteria releases page, for example hysteria-tun-windows-6.0-amd64.exe. After downloading, rename it to hysteria.exe and place it in the V2rayN root directory.

Next, create a client.json file with the following contents:

{
  "server": "ip:port", //填写自己的IP和端口
  "obfs": "fuckgfw2022",
  "up_mbps": 500,
  "down_mbps": 500,
  "socks5": {
    "listen": "127.0.0.1:10808"
  },
  "http": {
    "listen": "127.0.0.1:10809"
  }
}

In V2rayN, add a custom configuration server, choose hysteria as the core type, then browse to and import the client.json file.

With that in place, the client will expose a local SOCKS5 proxy on 127.0.0.1:10808 and an HTTP proxy on 127.0.0.1:10809, while connecting to the Hysteria server using the IP, port, and obfuscation settings you configured.